Hi,
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?
Hi,
Hi,
...
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?
Debug information can be placed in the assembler source. This is what
GCC does; you can see for yourself if you run
gcc -g -save-temps filename.c
Csaba
Debug information can be placed in the assembler source. This is what
GCC does; you can see for yourself if you run
gcc -g -save-temps filename.c
I guess he want to ask if llc can emit debugging information which GDB
can use.
Regards,
chenwj
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.
I am sorry for my poor statement of my problem.
Yes, êífÈÎ is right.
I want to know whether llvm could emit debugging information which GDB could use directly. Ex, how does the executable file generated from llc could be debug using gdb?
A simple demonstration is greatly appreciated.
2011/6/14 êífÈÎ <chenwj@iis.sinica.edu.tw>
You're looking to use the wrong tool. LLC isn't where the debug info is from. The debug information is created by the front end, as Duncan pointed out. LLC will propagate that information but will not create it if it's not already there. The debug information is compatible with GDB. Usage is just as with gcc or any other compiler; add the "-g" flag.
For example,
$ clang -g myfile.c -o myfile
$ gdb myfile
-Jim