How can one see content of stack with GDB?

后端 未结 3 927
时光说笑
时光说笑 2020-12-12 13:33

I am new to GDB, so I have some questions:

  • How can I look at content of the stack? Example: to see content of register, I type info registers.

3条回答
  •  执笔经年
    2020-12-12 13:56

    You need to use gdb's memory-display commands. The basic one is x, for examine. There's an example on the linked-to page that uses

    gdb> x/4xw $sp
    

    to print "four words (w ) of memory above the stack pointer (here, $sp) in hexadecimal (x)". The quotation is slightly paraphrased.

提交回复
热议问题