title: what does -0x4(%rbp) means in gdb disassembly?
body: <p>i am currently working on gdb disassembly to help me understand more detail about the c program so i write a c program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void swap(int a, int b){
          int temp = a;
          a = b;
          b = temp;
  }
  void main(){
          int a = 1,b = 2;
          swap(a, b);
  }
  </code></pre>
  
  <p>I use gdb and run <code>disass /m main</code> to get those:</p>
  
  <pre><code>(gdb) disass /m main
  Dump of assembler code for function main:
  8   void main(){
     0x0000000000400492 &lt;+0&gt;: push   %rbp
     0x0000000000400493 &lt;+1&gt;: mov    %rsp,%rbp
     0x0000000000400496 &lt;+4&gt;: sub    $0x10,%rsp
  
  9       int a = 1,b = 2;
     0x000000000040049a &lt;+8&gt;: movl   $0x1,-0x8(%rbp)
     0x00000000004004a1 &lt;+15&gt;:    movl   $0x2,-0x4(%rbp)
  
  10      swap(a, b);
     0x00000000004004a8 &lt;+22&gt;:    mov    -0x4(%rbp),%edx
     0x00000000004004ab &lt;+25&gt;:    mov    -0x8(%rbp),%eax
     0x00000000004004ae &lt;+28&gt;:    mov    %edx,%esi
     0x00000000004004b0 &lt;+30&gt;:    mov    %eax,%edi
     0x00000000004004b2 &lt;+32&gt;:    callq  0x400474 &lt;swap&gt;
  
  11  }
     0x00000000004004b7 &lt;+37&gt;:    leaveq 
     0x00000000004004b8 &lt;+38&gt;:    retq   
  
  End of assembler dump.
  </code></pre>
  
  <h2>My question is those <code>-0x8(%rbp)</code> means what?</h2>
  
  <p>A memory or a register?</p>
  
  <p>I do know that 1 is store in <code>-0x8(%rbp)</code> and 2 is in <code>-0x4(%rbp)</code>, How can i show the value in
  thoes kind of 'place' ?
  I try to use <code>(gdb) p -0x8(%rbp)</code> but get this:</p>
  
  <pre><code>A syntax error in expression, near `%rbp)'.
  </code></pre>