title: What does the gdb 'x' command do?
body: <p>In my quest to learn more about the computer in general, I stumbled upon a book which has some chapters about disassembling, the x86 assembly language, and the relationship between C and x86 assembly. Now I have been reading this <code>GDB</code> command but I am unable to fully understand it.</p>
  
  <p>The command, along with its results, follows:</p>
  
  <pre><code>(gdb) x/32xw $esp
  0xbffff7e0:    0xb8000ce0 0x08048510 0xbffff848 0xb7eafebc
  0xbffff7f0:    0x00000002 0xbffff874 0xbffff880 0xb8001898
  0xbffff800:    0x00000000 0x00000001 0x00000001 0x00000000
  0xbffff810:    0xb7fd6ff4 0xb8000ce0 0x00000000 0xbffff848
  0xbffff820:    0x40f5f7f0 0x48e0fe81 0x00000000 0x00000000
  0xbffff830:    0x00000000 0xb7ff9300 0xb7eafded 0xb8000ff4
  0xbffff840:    0x00000002 0x08048350 0x00000000 0x08048371
  0xbffff850:    0x08048474 0x00000002 0xbffff874 0x08048510
  </code></pre>
  
  <p>Now, from what I understand, the command that I issue tells the debugger to:</p>
  
  <ul>
  <li>x (first one): examine the memory</li>
  <li>32: get 32 of what follows</li>
  <li>x: enable hexadecimal representation</li>
  <li>w: show me <code>Word</code> size data.</li>
  <li><code>**Note:**</code> I know that I ask about the esp register, but I don't quite fully understand what $ is doing in front of it. When I try not to use it, I get a missing symbol error, so I get it has something to do with reference/de-reference?</li>
  </ul>
  
  <p>What has been bugging me is how did I find all those bytes? Since I am examining a register, who's size is 32 bit, shouldn't I get only 32 bits, or 4 bytes (only 1 row of the above)? If I am correct with my assumption, then were did we find the rest of the data? Does it have to do something with the stack, and a particular stack frame, which I currently am unaware of?</p>
  
  <p>I would appreciate your input so that I can clarify things in my mind.</p>