[llvm-dev] LLVM IR Debugger

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 4 00:09:43 PST 2018


On 4 January 2018 at 07:11, Brenda So via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> interesting ... just curious, why did they delete "-debug-ir" to begin with ?

The metadata describing the information debuggers need (line numbers,
variable locations and so on) was evolving rapidly at the time I
think. The -debug-ir pass was lagging behind I think, and rarely used
as far as anyone knew.

> Also, it's extremely interesting that gdb and lldb can be used to debug LLVM IR. How does your code work (on a high level)? A high level explanation will help me understand what you've done better.

It adds the information necessary to produce normal DWARF debugging
information in the object files. That format is designed to be
generic.

One part is just mapping some byte of the output instructions back to
the source file and line number, which is just as easy for IR as for a
more conventional language. The other major part is describing where
in memory or registers named variables are, which is also pretty much
the same for LLVM IR as for normal code. After that the magic of
debuggers takes over.

Cheers.

Tim.


More information about the llvm-dev mailing list