[WIP] Associate messages with failures in debug info#26148
Closed
jckarter wants to merge 3 commits into
Closed
Conversation
The idea here is that we'd use the constant-evaluated message as a symbol name we can put in the image's debug info, allowing debuggers and crash tracers to present a reason for the crash in backtraces.
Encode the message as the name of an inlined function location, so that it shows up in backtraces.
jckarter
commented
Jul 15, 2019
|
|
||
| if (DL) { | ||
| Builder.SetCurrentDebugLocation(DL); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
@compnerd It sounds like CodeView debug info has some additional invariants that aren't clear to me. I tried to preserve the existing logic here, but how would what we're trying to do here fit in with Windows debug info?
Contributor
Author
|
It looks like Erik already started on this as #25978. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on @adrian-prantl's idea. Improve the experience of debugging Swift traps by encoding a reason message in the line table as the name of a fake inlined function, so that debuggers and DWARF-aware symbolicators like
addr2linepresent the message in the backtrace, for example:TODO:
struct_extract (struct)andinttoptr (ptrtoint)to be able to look through the abstraction ofStringandStaticStringin transparent code.os_log, we could potentially encode interpolated messages likefatalError("foo \(x)")in debug info by encodingxas a local variable of the inlined trap function location, allowing the debugger to try to find and present the value as part of the failure message.