Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing string pointed to from Register in GDB

Tags:

c

gdb

I have a string being moved and i want to print it based on the register.

I did the following:

gdb x $esp
0xbffff110:  "\274\205\004\b\324\361\377\277\334\361\377\277]\257\344\267\304s\374\267"

{then I copied the address}

>> x *0xbffff110
0x80485bc <__dso_handle+12>:     "test1"

Is there any way to do this in one step?

like image 798
user994165 Avatar asked Oct 06 '12 08:10

user994165


1 Answers

Is there any way to do this in one step?

 (gdb) print *(char**)$esp
like image 171
Employed Russian Avatar answered Nov 15 '22 06:11

Employed Russian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!