[lldb] [llvm] Annotate disassembly with register‐resident variable locations (PR #147460)

Jason Molenda via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 23:00:28 PDT 2025


jasonmolenda wrote:

Incidentally, this is always something get a little confused by when reading assembly, we see it with backtraces.  A CALL instruction executes and the return address is the next instruction.  That confuses people looking at the assembly language -- the "pc" pointer is pointing to the next instruction! -- but we cheat it for source symbolication, subtracting 1 from the return address when we do source line lookup so we show the function call as "currently executing" when we really have the return address which may point to the next source line.  We have to do the same thing with dwarf location list lookups, where we might have a `noreturn` function call, and the variables available at the return address (which is the target of a branch from another part of the function) are drastically different.

I'm aways unsure of how much to lie to the user in these scenarios.  The general call is "at source level lie, at assembly level tell the truth of what the return address shows us".  It gets a little messier on a function that ends in a noreturn CALL as the last instruction, we don't want to show the return address as the next function in memory, even though that's what it really shows us.

https://github.com/llvm/llvm-project/pull/147460


More information about the llvm-commits mailing list