safety: show error return trace when unwrapping error in switch#12807
safety: show error return trace when unwrapping error in switch#12807Vexu wants to merge 2 commits intoziglang:masterfrom
Conversation
|
Looks great. It would be nice to get rid of these frames from the stack trace too: |
6233823 to
72f132d
Compare
|
I rebased this against master branch, updated the CI tarballs for windows and macos, and force pushed. |
andrewrk
left a comment
There was a problem hiding this comment.
I suggest instead of inline calls, to have these functions use @returnAddress() and then pass this forward into the panic system so that this value ends up passed to panicImpl as the first_trace_addr parameter. Maybe this means we have to make a breaking change to the panic function signature to add this parameter. If that is the case, I'm fine with it.
This will be more appropriate for cold functions to do, and result in less bloat from inlined things.
As a side note, I'm a little uncomfortable with how much std lib formatting is being dragged in by builtin panic helper functions, and by the fact that overriding the panic handler still results in a bunch of formatting stuff being outputted. But, I don't have any concrete suggestions for improvement on that, and it's not relevant to this PR, and I think that the helpful debugging messages are worth it in the end.
That would require changing
How about a |
Let's do it.
Worth considering. Now that you mention it, I can think of a couple other options worth considering as well. Sounds like we should discuss in a separate proposal that does not block this PR, yeah? |
Any ideas to what could be causing this? I don't think |
|
Can I see the corresponding function signature from the LLVM module? |
|
How do I pass |
|
My suggestion is to invoke make like this: |
c340698 to
19b4503
Compare
A small quality-of-life improvement I thought of while trying to figure out where an
error.GenericPoisonwas coming from.Example situation:
before:
after:
This also makes
@panicshow error return trace in these same situations which you can test by uncommenting lines in the example.