Debug Info round table notes (US LLVM 2024)
Big thanks to @cmtice for taking notes, shared below with a few minor edits, links added etc. And thanks to all attendees for the discussion.
[questions / blanks / post-discussion additions in square brackets]
Interesting DWARF 6 features?
- Improvements for GPU debugging [proposed?].
- Prologue start and epilogue end markers to compliment existing prologue end and epilogue begin, to mark regions (supports multiple entry points & more).
Line 0 (compiler generated/unknown/merged loc) regularly an issue for anyone?
- Sentiment of “yes”, but no metrics or measured impact [graph of unique non-zero locations in CTMark over llvm versions here].
- Example of recently-ish introduced line 0 bug in Orlando’s talk.
- Stephen Tozer (Sony) (not present) working on fixing spurious line 0s - fixes coming soon.
- Steven has a system that attaches stack traces to insns & records where it loses source locations. Auto-regression-detection.
- (Orlando, Sony) Is it acceptable to automatically notify people if patch drops source locations?
- (David Blaikie, Google) Should have a human review it & make sure it’s a real issue, then report it to the author. Don’t want to give folks false positives. Be sure to be non-accusatory, polite.
- Scope for automating once the concept has been proven and used in the field for some time? Possibly.
is_stmt placement (Orlando) See talk / RFC.
RemoveDIs (replace dbg.* intrinsics with DbgRecords) discussion.
- Timeline:
- Enabled by default in LLVM 19.
- Deprecated insertion methods taking instruction pointers (rather than iterators) in LLVM 20.
- [Aim to remove dbg.* intrinsic support from LLVM 21.]
- Patches caused anyone issues? (Adrian Prantl, Apple) Some, downstream porting in Swift compiler; not too bad yet.
- How close are we to “debug info doesn’t affect codegen”?
- RemoveDIs fixed ~70% of an internal test suite at Sony.
- RemoveDIs is currently only in LLVM IR - we still have debug instructions in MIR.
- Instruction Referencing (below) may enable MIR changes.
Instruction Referencing (InstrRef, alt LiveDebugValues impl).
- SSA based variable location tracking in MIR.
- Improves variable locations (over old version) but requires target support (only X86 supported currently).
- Hope to remove old version one day but need to bring up support for other targets.
- (Shubham Rastogi, Apple) hoping to look at AArch64 support.
- Turning on for unsupported target
- Others [?] noted PowerPC [and another?] support is important, but who to do the work?
Variable location coverage metrics
- Student talk: “A data-driven approach to debug info quality” (Emil Pedersen, Apple). Inserted analysis into Swift compiler to measure how much var loc info got dropped in each compiler pass.
- -mllvm -dropped-variable-stats, StandardInstrumentations.h.
- (Shubham) Patch in LLVM to reduce false positives (e.g., after DSE).
- Prints info about how many variables were dropped in particular passes, to stdout.
- Can we track these over time? Designed/thought about but not implemented.
DW_AT_trampoline
- To allow transparently stepping through wrappers/thunks to callee.
- ([?], Nintendo) current state of patches adding support in LLVM?
- Augusto Noronha at Apple has patches supporting one [?] attribute value: … [from memory, references?]
DW_OP_implicit_pointers - interest, and anyone working on it?
- Sony & Fuchsia indicate interest. No one actively working on it yet.
- Likely measurable fraction of variable location coverage improvement.
Long DIExpression / location expressions
- (Adrian) noticed v long expressions, hitting internal LLVM cap (=> kills var loc).
- (Shubham) added basic constant folding, DIExpression::foldConstantMath, applied after salvaging [and in DIExpression::append].
Please feel free to add anything missed, suggest edits, fill in blanks, etc.