How do I print a #defined constant in GDB?

后端 未结 1 1958
忘掉有多难
忘掉有多难 2020-12-02 12:03

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

1条回答
  •  死守一世寂寞
    2020-12-02 12:47

    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

    0 讨论(0)
提交回复
热议问题