How to print register values in GDB?

前端 未结 6 1439
北恋
北恋 2020-12-02 04:53

How do I print the value of %eax and %ebp?

(gdb) p $eax
$1 = void
6条回答
  •  甜味超标
    2020-12-02 05:16

    Gdb commands:

    • i r : print a single register, e.g i r rax, i r eax
    • i r ...: print multiple registers, e.g i r rdi rsi,
    • i r: print all register except floating point & vector register (xmm, ymm, zmm).
    • i r a: print all register, include floating point & vector register (xmm, ymm, zmm).
    • i r f: print all FPU floating registers (st0-7 and a few other f*)

    Other register groups besides a (all) and f (float) can be found with:

    maint print reggroups
    

    as documented at: https://sourceware.org/gdb/current/onlinedocs/gdb/Registers.html#Registers

    Tips:

    • xmm0 ~ xmm15, are 128 bits, almost every modern machine has it, they are released in 1999.
    • ymm0 ~ ymm15, are 256 bits, new machine usually have it, they are released in 2011.
    • zmm0 ~ zmm31, are 512 bits, normal pc probably don't have it (as the year 2016), they are released in 2013, and mainly used in servers so far.
    • Only one serial of xmm / ymm / zmm will be shown, because they are the same registers in different mode. On my machine ymm is shown.

提交回复
热议问题