如何在 GDB 中打印 #defined 常量? [英] How do I print a #defined constant in GDB?
本文介绍了如何在 GDB 中打印 #defined 常量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据主题.
我有一些常量哈希定义如下:
I have some constants hash defined like so:
#define CONST 40
我在我的程序中设置了一个断点.如何打印该常量的值?(我知道我可以只看源代码,但我想确定一下)
I've set a breakpoint in my program. How do I print the value of that constant? (I know I can just look at the source code, but I want to be sure of it)
推荐答案
help macro
您必须使用 -g3 标志进行编译才能使其工作并在加载宏之前启动您的程序.
You must compile with the -g3 flag for it to work and start your program before the macros are loaded.
在你的情况下:
info macro CONST
或
macro expand CONST
更多信息:http://sourceware.org/gdb/current/onlinedocs/gdb/Macros.html
这篇关于如何在 GDB 中打印 #defined 常量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文