gdb如何使用寄存器作为地址并显示偏移内容?

How does gdb use register as address and display offset content?

在 gdb 中:

p $ebp #will print content pointed by ebp

p 4$ebp # gdb says this is illegal operand.

我想显示ebp指向的地址后的4个字节,显示一个int。如何在gdb中指定这个命令?

p $ebp #will print content pointed by ebp

不,它将打印 $EBP

I wish to show 4 bytes after the address pointed by ebp, and display an int.

(gdb) x/x $EBP+4
(gdb) x/d $EBP+4
(gdb) p *(int*)($EBP+4)