title: Can not find return address in gdb
body: <p>I wrote that program in C (just for debugging purposes):</p>
  
  <pre><code>void return_input(void)
  {
      char array[10];
  
      gets(array);
      printf("%s\n", array);
  }
  
  main()
  {
      return_input();
  
      return 0;
  </code></pre>
  
  <p>}</p>
  
  <p>I have been experimenting with stack overflows, and since I am working with a 64 bit machine I compiled it with</p>
  
  <pre><code>gcc -m32 -mpreferred-stack-boundary=2 -ggdb overflow.c -o overflow
  </code></pre>
  
  <p>I then debugged the program with gdb, and disassembled the return_input function, I got:</p>
  
  <pre><code>   0x0804841b &lt;+0&gt;: push   %ebp
     0x0804841c &lt;+1&gt;: mov    %esp,%ebp
     0x0804841e &lt;+3&gt;: sub    $0xc,%esp
     0x08048421 &lt;+6&gt;: lea    -0xa(%ebp),%eax
     0x08048424 &lt;+9&gt;: push   %eax
     0x08048425 &lt;+10&gt;:    call   0x80482e0 &lt;gets@plt&gt;
     0x0804842a &lt;+15&gt;:    add    $0x4,%esp
     0x0804842d &lt;+18&gt;:    lea    -0xa(%ebp),%eax
     0x08048430 &lt;+21&gt;:    push   %eax
     0x08048431 &lt;+22&gt;:    call   0x80482f0 &lt;puts@plt&gt;
     0x08048436 &lt;+27&gt;:    add    $0x4,%esp
     0x08048439 &lt;+30&gt;:    nop
     0x0804843a &lt;+31&gt;:    leave  
     0x0804843b &lt;+32&gt;:    ret
  </code></pre>
  
  <p>This marks that the return address should be 0x0804843b (or is it not?) However, when examining the esp (remember this is a 32bit compiled program on a 64bit machine) with <code>x/20x $esp</code> (after setting a breakpoint at the gets function and the ret), I can't find the return address:</p>
  
  <pre><code>    0xffffd400: 0xffffd406  0x080481ec  0x08048459  0x00000000
      0xffffd410: 0xffffd418  0x08048444  0x00000000  0xf7e195f7
      0xffffd420: 0x00000001  0xffffd4b4  0xffffd4bc  0x00000000
      0xffffd430: 0x00000000  0x00000000  0xf7fb0000  0xf7ffdc04
      0xffffd440: 0xf7ffd000  0x00000000  0xf7fb0000  0xf7fb0000
  </code></pre>
  
  <p>Why can't I see the return address? Sorry for the long question. Thanks in advance</p>