title: viewing the content of stack other than registers
body: <p>I just wonder how can I see the content of 8(%rsp) using GDB. according to several source that I found after googling several gdb guides, when I try to view the content of register rsp, I can use this command:</p>
  
  <pre><code>print/d $rsp
  </code></pre>
  
  <p>will print the address of $rsp. However, when I tried:</p>
  
  <pre><code>print/d 8($rsp)
  </code></pre>
  
  <p>I got segmentation fault. when I try:</p>
  
  <pre><code>print/d *$rsp+8 
  </code></pre>
  
  <p>It said that I couldn't dereference a generic pointer. I also try to use:</p>
  
  <pre><code>x/8d $rsp
  </code></pre>
  
  <p>However, I think this command will view 8 numbers below rsp instead of above rsp. am I right? The only reason why I want to view the content of 8($rsp), there is an assembly statement:</p>
  
  <pre><code>cmp    0x8(%rsp),%eax
  </code></pre>
  
  <p>any suggestion guys?</p>