Comments (9)
Maybe winch should provide a function that returns a list of backtraces and locations of insertions and let rlang include it.
from winch.
I think the error_frame
column in the rlang traceback data frame isn't being added in the winch traceback. Is that a new part of the rlang traceback?
If I follow the path of the original error through then I get to winch:::insert_native_chunk()
where it actually does the modification of the rlang traceback object (which is itself a data frame). Everything looks correct except for the fact that the rlang traceback object has an extra error_frame
column.
i.e. here is the original trace
data frame and the new
trace data frame that winch builds
Browse[5]> as.data.frame(trace)
call parent visible namespace scope error_frame
1 vctrs::num_as_location(-5, 4, oob = "extend", negative = "ignore") 0 TRUE vctrs :: TRUE
2 stop_internal_c_lib(file = file, line = line, call = call, message = message, , frame = frame) 0 FALSE rlang ::: FALSE
3 abort(message, call = call, .internal = TRUE, .frame = frame) 2 FALSE rlang :: FALSE
Browse[5]> new
call parent visible namespace scope
1 vctrs::num_as_location(-5, 4, oob = "extend", negative = "ignore") 0 TRUE vctrs ::
2 ffi_as_location() 1 TRUE /vctrs.so ::
3 vec_as_location_opts() 2 TRUE /vctrs.so ::
4 int_as_location() 3 TRUE /vctrs.so ::
5 rlang_stop_internal2() 4 TRUE /rlang.so ::
6 stop_internal_cb() 5 TRUE /rlang.so ::
7 r_exec_mask_n() 6 TRUE /rlang.so ::
8 stop_internal_c_lib(file = file, line = line, call = call, message = message, , frame = frame) 7 FALSE rlang :::
9 abort(message, call = call, .internal = TRUE, .frame = frame) 8 FALSE rlang ::
If I just hack the result of insert_native_chunk()
with new$error_frame <- FALSE
then I get a traceback again
from winch.
I think it'd be better if winch did not modify rlang backtraces.
from winch.
I agree with your suggestion about winch returning backtraces and locations and then letting rlang handle updating the traceback. I was just trying to narrow down exactly what the problem was 😛. If rlang handles the backtrace insertion then it is free to tweak the internal structure of the backtrace object without worrying about winch issues like this one.
from winch.
How do we handle this in rlang for now? I've been a bit out of touch with winch, but I need to do a release today and can work on improvements while I'm at it.
from winch.
How do we handle this in rlang for now?
Sorry I'm not sure what you mean.
from winch.
Missed the PR link, I now see it's been dealt with already. I'll fix here and PR in rlang then.
from winch.
Thanks. IIUC, you'd rather reimplement this functionality in rlang? I have tweaked winch_trace_back()
, it now contains all the data necessary to do the interweaving of the stack traces. Would you like to move winch_add_trace_back()
to rlang and adapt, do you need help with that?
from winch.
yup we could do that. On the other hand I'd like to improve extensibility / backtrace interop. But we could start from rlang for now and move back to winch later on. If you could draft the hook, that'd be great, thanks!
from winch.
Related Issues (12)
- Provide C callable replacement for Rf_error() HOT 3
- Experiment with libunwind HOT 2
- Integrate into rlang? HOT 1
- Use getLoadedDLLs() HOT 2
- Performance of winch with testthat HOT 1
- add_trace_back doesn't work correctly on 32-bit systems HOT 6
- print backtrace on crash? HOT 1
- Revdep issue with vctrs HOT 6
- Update upstream libbacktrace sources HOT 3
- Error in winch_trace_back() : unw_getcontext() error: -1073785320 HOT 9
- Fix r-universe build
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winch.