How to print register values in GDB?

如何打印%eax%ebp的值?

(gdb) p $eax
$1 = void

info registers shows all the registers; info registers eax shows just the register eax . The command can be abbreviated as ir


If you're trying to print a specific register in GDB, you have to omit the % sign. For example,

info registers eip

If your executable is 64 bit, the registers start with r. Starting them with e is not valid.

info registers rip

Those can be abbreviated to:

i r rip

There is also:

info all-registers

Then you can get the register name you are interested in -- very useful for finding platform-specific registers (like NEON Q... on ARM).

链接地址: http://www.djcxy.com/p/86034.html

上一篇: 如何在bash脚本中使用gdb使用命令行参数运行程序?

下一篇: 如何在GDB中打印寄存器值?