title: Meaning of 0x8($rsp)
body: <p>My first time learning Assembly Lang. Here is a part of (gdb) disassembly:</p>
  
  <pre><code>mov    $0x131,%eax
  cmp    0x8(%rsp),%eax  //Question here, what is the value of 0x8(%rsp)?
  
  
  
  
  (gdb)i r
  rax            0x131    305
  rbx            0x7fffffffe578   140737488348536
  rcx            0x20     32
  rdx            0x7fffffffe478   140737488348280
  rsi            0x0      0
  rdi            0x1999999999999999       1844674407370955161
  rbp            0x0      0x0
  rsp            0x7fffffffe470   0x7fffffffe470
  r8             0x37ed3bb080     240203313280
  r9             0x0      0
  r10            0x1e     30
  r11            0x0      0
  r12            0x400cb0 4197552
  r13            0x7fffffffe570   140737488348528
  r14            0x0      0
  r15            0x0      0
  rip            0x400fd9 0x400fd9 &lt;phase_3+129&gt;
  eflags         0x212    [ AF IF ]
  cs             0x33     51
  ss             0x2b     43
  ds             0x0      0
  es             0x0      0
  fs             0x0      0
  </code></pre>
  
  <p>I have trouble figuring out what does it compare. and what is the value of <code>0x8(%rsp)</code>.</p>
  
  <p>(I know this question sounds like stupid)</p>
  
  <p>Thanks in advance</p>
  
  <p>=-==========</p>
  
  <p>Finally I solved by </p>
  
  <pre><code>(gdb) p /x *(int *)($rsp+0x8)
  </code></pre>
  
  <p>with the help of this post <a href="https://stackoverflow.com/questions/5455832/how-to-print-0x4rbp-in-gdb">How to print -0x4(%rbp) in gdb?</a></p>
  
  <p>Zack's answer should be right, but it is not working since I'm using a 64 bit OS.</p>