生成独立的gcc调试文件

来源:互联网 发布:java api 连接hdfs 编辑:程序博客网 时间:2024/05/27 00:46

Compile with debug information:

gcc -g -o main main.c

Separate the debug information:

objcopy --only-keep-debug main main.debug

or

cp main main.debugstrip --only-keep-debug main.debug

Strip debug information from origin file:

objcopy --strip-debug main

or

strip --strip-debug --strip-unneeded main

debug by debuglink mode:

objcopy --add-gnu-debuglink main.debug maingdb main

You can also use exec file and symbol file separatly:

gdb -s main.debug -e main

or

gdb(gdb) exec-file main(gdb) symbol-file main.debug

For details:

(gdb) help exec-file(gdb) help symbol-file

Ref:
https://sourceware.org/gdb/onlinedocs/gdb/Files.html#Files

https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html


From: http://stackoverflow.com/questions/866721/how-to-generate-gcc-debug-symbol-outside-the-build-target

0 0
原创粉丝点击