What I want to know is how is the data in a stack translated. We can see the data like: 0x80808080 but does it have a meaning? What parts of the numbers stand for something different? And what does '0x' stand for?

The main thing I want to know, is how is the data organized. I know how push and pop work but I don't full understand things like:

(gdb) x/300wx 0xbffff155
0xbffff155: 0x80808080 0x80808080
0xbffff355: 0x80808080 0x80808080

What does each part mean? ^ I know r=4 w=2 x=1 & -=0

  • Does the output of help x (in gdb) make it any clearer? – JigglyNaga Jul 13 '16 at 23:33

0x is a very common prefix for numbers written in hexadecimal, i.e. in base 16.

x is a GDB command to display the content of a part of the memory. The digits and letters after the / indicate what to print: 300 words (w), in hexadecimal (x). The number after that is the address at which to start printing.

“r=4 w=2 x=1” is about the numerical and symbolic representation Unix file permissions and has absolutely nothing to do with this.

Printing a random part of the memory of a process doesn't produce any useful data. If you have the source code and a binary built with debugging symbols, the debugger may be able to tell you at what address each variable in the program is stored; this gives information about data on the stack but not on memory that is allocated dynamically. If you don't have the source, then you're doing reverse engineering, which is a lot more complicated than debugging.

The meaning of the data, i.e. what the data in the variable represents, isn't something a computer can tell you.

Understanding data shown by a debugger, in general, requires some programming experience. The meaning of this data is entirely dependent on the program, there aren't any general considerations. Without diving deep into the specific program and the way it was compiled, it's just a bunch of numbers.

Not the answer you're looking for? Browse other questions tagged or ask your own question.