Duncan Sands wrote:> Hi Pablo,
>
> > Has anybody debugged LLVM IR with GDB? I'm using dragonegg to
transform C into
> > IR, then applying my optimizations. Passing "-g" to
dragonegg doesn't seem to
> > work since it generates debug info for the C code, not the IR. I
really need GDB
> > (lli doesn't solve my problems) in order to debug multi-threaded
and
> > multi-process MPI code.
> >
> > More clearly, if I have a file hello.ll and I execute:
> >
> > $> llc hello.ll -march=x86-64 -o hello.s
> > $> mpicc -O0 hello.s -o hello
> >
> > Can I debug "hello" with GDB at the IR level? If so, how? If
not, would it be
> > possible to add debug info generation at the IR level (and how much
effort
> > required)? I read something about DwarfDebug but it's not clear to
me how to use
> > it or even if it does what I need. I hope I didn't miss any
obvious solution.
>
> it would be great to have a utility that, given an IR file, adds location
debug
> info to each line of it, the location being the line number within the IR
file.
> Then in the debugger you would get to see yourself moving around in the IR
file
> as you step through the program built from it. Unfortunately I have no
idea how
> to implement this in a reasonable way.
>
> Ciao, Duncan.
There's always what the integrated assembler does if you say "-g"
and
there aren't any debug-info directives in the assembler source. It
does something based on input line number, not that I find it very
useful, but it might be the most appropriate tactic for LLC.
--paulr