diff options
| author | jeffreytan81 <jeffreytan@meta.com> | 2025-11-11 16:31:57 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-12 00:31:57 +0000 |
| commit | 2acd65288696c854028d2e61482e0b884af44062 (patch) | |
| tree | 310abbc14f57d1ba4ba338cf44390918225789d9 /llvm/unittests/Transforms/Utils/LocalTest.cpp | |
| parent | 362119d03cb5156599825cd43ceff65b4dd54068 (diff) | |
| download | llvm-2acd65288696c854028d2e61482e0b884af44062.zip llvm-2acd65288696c854028d2e61482e0b884af44062.tar.gz llvm-2acd65288696c854028d2e61482e0b884af44062.tar.bz2 | |
Fix lldb-dap non-leaf frame source resolution issue (#165944)
Summary
-------
While dogfooding lldb-dap, I observed that VSCode frequently displays
certain stack frames as greyed out. Although these frames have valid
debug information, double-clicking them shows disassembly instead of
source code. However, running `bt` from the LLDB command line correctly
displays source file and line information for these same frames,
indicating this is an lldb-dap specific issue.
Root Cause
----------
Investigation revealed that `DAP::ResolveSource()` incorrectly uses a
frame's PC address directly to determine whether valid source line
information exists. This approach works for leaf frames, but fails for
non-leaf (caller) frames where the PC points to the return address
immediately after a call instruction. This return address may fall into
compiler-generated code with no associated line information, even though
the actual call site has valid source location data.
The correct approach is to use the symbol context's line entry, which
LLDB resolves by effectively checking PC-1 for non-leaf frames, properly
identifying the line information for the call instruction rather than
the return address.
Testing
-------
Manually tested with VSCode debugging sessions on production workloads.
Verified that non-leaf frames now correctly display source code instead
of disassembly view.
Before the change symptom:
<img width="1013" height="216" alt="image"
src="https://github.com/user-attachments/assets/9487fbc0-f438-4892-a8d2-1437dc25399b"
/>
And here is after the fix:
<img width="1068" height="198" alt="image"
src="https://github.com/user-attachments/assets/0d2ebaa7-cca6-4983-a1d1-1a26ae62c86f"
/>
---------
Co-authored-by: Jeffrey Tan <jeffreytan@fb.com>
Diffstat (limited to 'llvm/unittests/Transforms/Utils/LocalTest.cpp')
0 files changed, 0 insertions, 0 deletions
