How to get the integer string value in the EAX registry

advertisements

I'm trying to determine what the string value of an integer in the %eax register is.

I'm using gdb, the command

(gdb) info registers

outputs:

eax            0x804c800    134531072
ecx            0xf  15
edx            0x1  1
ebx            0xffffd324   -11484
esp            0xffffd24c   0xffffd24c
ebp            0xffffd288   0xffffd288
esi            0x0  0
edi            0x0  0
eip            0x8048fca    0x8048fca <strings_not_equal>
eflags         0x286    [ PF SF IF ]
cs             0x23 35
ss             0x2b 43
ds             0x2b 43
es             0x2b 43
fs             0x0  0
gs             0x63 99

i want to know how to get a word out of the value 134531072

I tried print /s %eax but im getting an error A syntax error in expression, near %eax'.


If you want to print the value of eax

You can use

(gdb) info registers $eax
(gdb) print $eax

If you want to print a string pointed to by $eax try

(gdb) x/s $eax

For more info about x command see http://sourceware.org/gdb/onlinedocs/gdb/Memory.html