Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GDB is not displaying hexadecimal values for stack

Tags:

c++

c

hex

gdb

I'm trying to have GDB display the hexadecimal values for the stack, so I used the command x /48b $esp, which is a command that I saw on the Internet that should show the hexdecimal values for 48 bytes on the stack starting at the location pointed to by the stack pointer. However, when I do this command I get integer values (some negative instead). An example is show below:

(gdb) x /48b $esp
0xbffff200: 40  -14 -1  -65 24  -114    4   8
0xbffff208: 123 0   0   0   0   0   0   0
0xbffff210: 16  0   0   0   -3  -112    17  0
0xbffff218: -18 64  27  0   -1  -1  -1  -1
0xbffff220: 88  40  19  0   45  -9  17  0
0xbffff228: 38  38  -64 -14 -1  -65 -64 -14

I've had this command work before (as far as I know it was the exact same command), however all of a sudden it seems not to be working. Any ideas?

like image 246
Nosrettap Avatar asked Oct 09 '22 04:10

Nosrettap


1 Answers

You're probably mistyping your command:

Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal), t(binary), f(float), a(address), i(instruction), c(char) and s(string).

You should use this command for hex output: x /48x $esp

like image 177
Alexander Putilin Avatar answered Oct 12 '22 11:10

Alexander Putilin