[LLVMdev] llc and debug information

Nick Jalbert jalbert at eecs.berkeley.edu
Wed Sep 16 13:34:21 PDT 2009


Hi all,

I'm having an issue with debug information and llc.  A test program:

#include <iostream>

using namespace std;

void foo() {
    cout << "My return address is " << __builtin_return_address(0) <<
        endl << flush;
}

int main(int argc, char *argv[]) {
    foo();
    return 0;
}


When I compile my test program to LLVM bytecode, and then use llc to take
the bytecode to assembly, llc appears to strip the debugging information
along the way:

> llvm-g++ -g -c -emit-llvm test.cpp
> llc test.o
> g++ test.o.s
> ./a.out
My return address is 0x400b92
> addr2line 0x400b92
??:0

My goal is to run a transformation pass on the bytecode to put in a few
instrumentation hooks for a dynamic analysis I'm writing.  Debug
information, even if it's a little off, would be extremely useful to have in
the final binary.  This build chain worked with a 2.6svn version of llc
(that is, the final binary would have debug information which corresponded
reasonably well to the source.  Also it seemed to work when this question
was sent http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-April/021697.html),
but I recently upgraded to a 2.7svn version with the results above.  Is this
change intended?  Is there a way tell llc to keep debug information in?

Thanks!
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090916/06872df2/attachment.html>


More information about the llvm-dev mailing list