Printing all global variables/local variables?

后端 未结 3 567
眼角桃花
眼角桃花 2020-11-28 17:15

How can I print all global variables/local variables? Is that possible in gdb?

3条回答
  •  时光说笑
    2020-11-28 18:01

    In addition, since info locals does not display the arguments to the function you're in, use

    (gdb) info args
    

    For example:

    int main(int argc, char *argv[]) {
        argc = 6*7;    //Break here.
        return 0;
    }
    

    argc and argv won't be shown by info locals. The message will be "No locals."

    Reference: info locals command.

提交回复
热议问题