[LLVMdev] Debugging LLVM IR with GDB

Renato Golin rengolin at systemcall.org
Fri Oct 19 07:08:38 PDT 2012


On 18 October 2012 15:35, Will Dietz <willdtz at gmail.com> wrote:
> The pass itself is rather simple--the hard problem it solves is
> emitting the IR to disk and reasoning about what Instruction* is on
> what line, which really shouldn't be a problem if done properly in
> LLVM.

Another thing, which would be really great, but also really hard, is
to map the SSA registers to their values.

So, in GDB, you could say:

(gdb) print %117
(int) %117 = 4

Though you'd have to generate all possible locations of the value in
the generated code, which can be a pain in the Dwarf back-end.

But just the line information is already great, as it interlaces with
C source lines, so it's easy to see what C line mapped to what group
of IR lines.

+1 for a patch to implement that! ;)

-- 
cheers,
--renato

http://systemcall.org/



More information about the llvm-dev mailing list