如何查看编译后Image是否包含调试信息?

方法一,查看编译选项
有Makefile可以看Makefile,如果编译选项中包含“-g”,说明编译后是包含调试信息的。如U-Boot可通过根目录下的config.mk文件,DBGFLAGS是否赋值:
1
DBGFLAGS= -g
其中DBGFLAGS最后是赋值给CFLAGS。

方法二,命令查看
如要查看u-boot镜像是否包含调试信息,可用命令:
1
readelf –S u-boot | grep “debug”
如果输出如下多行,说明包含调试信息:

[27] .debug_aranges PROGBITS 00000000 00191b 000020 00 0 0 1
[28] .debug_info PROGBITS 00000000 00193b 00060a 00 0 0 1
[29] .debug_abbrev PROGBITS 00000000 001f45 000148 00 0 0 1
[30] .debug_line PROGBITS 00000000 00208d 000296 00 0 0 1
[31] .debug_frame PROGBITS 00000000 002324 00011c 00 0 0 4
[32] .debug_str PROGBITS 00000000 002440 0002c0 01 MS 0 0 1
[33] .debug_loc PROGBITS 00000000 002700 000134 00 0 0 1
其中,可调试镜像必须包含有.debug_info和.debug_line。

猜你喜欢

转载自blog.csdn.net/weixin_42418557/article/details/88943846