title: gdb executing the same statement twice
body: <p>While trying to understand the functionality of the unique_ptr, I wrote following program</p>
  
  <pre><code> 1#include &lt;memory&gt;
   2
   3int main(int argc, char *argv[])
   4{
   5    int i;
   6    
   7    std::unique_ptr&lt;int&gt; a(&amp;i);
   8    std::unique_ptr&lt;int&gt; c(a.get());
   9    
  10    return 0;
  11}
  </code></pre>
  
  <p>When I run this program through gdb I noticed that after "return 0" instruction at line no 10, gdb again goes back to execute line no. 8 instruction. </p>
  
  <pre><code>$ gdb ./unptr 
  GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
  (gdb) b main
  Breakpoint 1 at 0x400686: file unptr.cpp, line 4.
  (gdb) run
  Starting program: /home/sbahir/work/funstuff/cplusplus/unptr 
  
  Breakpoint 1, main (argc=1, argv=0x7fffffffdae8) at unptr.cpp:4
  4       {
  (gdb) n
  7               std::unique_ptr&lt;int&gt; a(&amp;i);
  (gdb) n
  8               std::unique_ptr&lt;int&gt; c(a.get());
  (gdb) n
  10              return 0;
  (gdb) n
  8               std::unique_ptr&lt;int&gt; c(a.get());
  (gdb) p a
  $1 = std::unique_ptr&lt;int&gt; containing 0x7fffffffd9cc
  (gdb) p c
  $2 = std::unique_ptr&lt;int&gt; containing 0x7fffffffd9cc
  (gdb) 
  </code></pre>
  
  <p>I am not able to understand why this is happening. It would be great if someone could please explain or point to some reference to the material.</p>
  
  <p>Thanks</p>