[WIP] Associate messages with failures in debug info #26148
Closed
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
addr2line
present the message in the backtrace, for example:TODO:
struct_extract (struct)
andinttoptr (ptrtoint)
to be able to look through the abstraction ofString
andStaticString
in transparent code.os_log
, we could potentially encode interpolated messages likefatalError("foo \(x)")
in debug info by encodingx
as 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.