[LLVMdev] How to get an LLVM-compiled executable which could be debugged using gdb

Duncan Sands baldrick at free.fr
Tue Jun 14 01:52:28 PDT 2011


Hi Li Qingan,

> I need a simple demonstration of compiling a program into a executable which
> could be debugged using gdb.
> After looking up the llc.cpp, llvm-ld.cpp, I found that llvm only generated the
> assemble code, and left the other work to gnu as and gnu ld.
> Since the information from LLVM into gnu as and gnu ld is limited by the
> assemble file, I am confusing with how to transfer the debug information to gnu
> as and gnu ld.
> Could any one help me?

I didn't really understand what you are asking.  If you are compiling using
clang, llvm-gcc or dragonegg then add the -g argument to the command line to
get debug info in the final program, exactly like when compiling with gcc.

Ciao, Duncan.



More information about the llvm-dev mailing list