[LLVMdev] Debugging Status on x86?

Devang Patel devang.patel at gmail.com
Fri Aug 6 11:22:56 PDT 2010


On Thu, Aug 5, 2010 at 6:22 PM, Jason Kim <jasonwkim at google.com> wrote:
>
> Hi everyone,
> I was under the impression that debugging support on llvm-gcc-4.2.1 +
> llvm-2.7 was pretty complete (at least on x86 linux), but ran into a glitch.
> First off, are there any docs that discuss the current state, in so far as
> DWARF support is concerned?
> The behavior I am seeing is the following:
> llvm-gcc -g hello.c -o hello
> produces a working executable with apparently complete debugging support.
> (stepping
> However,
> llvm-gcc -g -c -emit-llvm hello.c -o hello.bc
> llc hello.bc -o hello.s
> llvm-gcc -g hello.s -o hello
> seem to produce an executable that gdb7 has some issues with, such as
> inability to examine variables... (but stepping/nexting seem to be okay, and
> line numbers show up properly
> So is this an llvm-gcc issue? or is this an issue with llvm itself?
> I'm willing to help out on this, so someone please point me in the right
> direction.

As Eli mentioned, add -O0 on llc command line. Otherwise llc by
default runs code gen optimizations and transformations to improve
code, which are disabled when you run llvm-gcc without any
optimization flag.

The issue is at llvm code gen phase. The optimization phases are
removing variable's info in your case because probably it is
interfering with the optimization. If you've a small test case then
please file bugzilla report. Supporting debugging of optimized code is
a challenging task.

-
Devang



More information about the llvm-dev mailing list