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. The most specific doc that talks about debugging was the http://www.llvm.org/docs/DebuggingJITedCode.html It seems to indicate that debugging support was at least partial. Thanks. -jason -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100805/d2016d66/attachment.html>
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 helloUsing -g at both levels leads to issues... gcc is trying to add debugging info to assembly with debugging info. -Eli
Hi Eli, thanks for your response. AFAIK, Removing -g from the second call to gcc does not seem to do anything. The generated executable shows the same behavior under gdb. -jason On Thu, Aug 5, 2010 at 6:31 PM, Eli Friedman <eli.friedman at gmail.com> wrote:> 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 > > Using -g at both levels leads to issues... gcc is trying to add > debugging info to assembly with debugging info. > > -Eli >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100805/d28b1e99/attachment.html>
On 6 August 2010 02:22, Jason Kim <jasonwkim at google.com> wrote:> I'm willing to help out on this, so someone please point me in the right > direction.The main class, which has all Dwarf information is: llvm/Support/Dwarf.h The classe that deals with debug info in LLVM (metadata) is: llvm/Analysis/DebugInfo.h In Clang, the class that builds the debug information is: llvm/tools/clang/lib/CodeGen/CGDebugInfo.h to serve as a template. I'm not sure how complete the debug info is in Clang, but it's supposed to be complete. I haven't tested the results.> The most specific doc that talks about debugging was > the http://www.llvm.org/docs/DebuggingJITedCode.html > It seems to indicate that debugging support was at least partial.There's a post on this in the blog: http://blog.llvm.org/2010/04/extensible-metadata-in-llvm-ir.html -- cheers, --renato http://systemcall.org/ Reclaim your digital rights, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm
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