对于release的core,通过gdb program -c core.xxxx打开后只能显示函数栈,没有行号也没有代码。可以通过导出符号表加载,或者通过同时加载release程序和debug程序获取符号表。
导出符号表方法:
objcopy --only-keep-debug pp_debug pp_debug.symbol
加载符号表的方法
gdb --symbol=pp_debug.symbol -exec=pp_release
gdb --symbol=pp_debug -exec=pp_release
# 调试core文件
gdb --symbol=pp_debug -exec=pp.core
也可以
gdb --symbol=debug_pro --exec=release_pro -c core.xxxx
对于release程序,可以通过symble 命令进行加载debug程序的符号表