如何在GDB中打印#defined常量?
根据主题。
我有一些常量哈希定义如下:
#define CONST 40 我在程序中设置了一个断点。 如何打印该常数的值? (我知道我只能看源代码,但我想确定它)
 help macro 
您必须使用-g3标志进行编译,才能在加载macros之前启动程序。
在你的情况下:
 info macro CONST 
要么
 macro expand CONST 
更多信息: http : //sourceware.org/gdb/current/onlinedocs/gdb/Macros.html