如何打印在GDB一个#define的常数? [英] How do I print a #defined constant in GDB?
本文介绍了如何打印在GDB一个#define的常数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按主题。
我有些常量哈希像这样定义的:
的#define CONST 40
我已经设置在我的程序断点。我如何打印常量的值? (我知道我可以查看源$ C $ C,但我想确保它)
解决方案
帮助宏
您必须使用-g3标志编译为它工作和加载宏之前启动程序。
在您的情况:
信息宏CONST
或
宏扩展CONST
更多信息:<一href=\"http://sourceware.org/gdb/current/onlinedocs/gdb/Macros.html\">http://sourceware.org/gdb/current/onlinedocs/gdb/Macros.html
As per subject.
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
You must compile with the -g3 flag for it to work and start your program before the macros are loaded.
In your case:
info macro CONST
or
macro expand CONST
More info: http://sourceware.org/gdb/current/onlinedocs/gdb/Macros.html
这篇关于如何打印在GDB一个#define的常数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文