title: Source and exe out of sync: commented line seems to call function in gdb
body: <p>I am fairly new to GDB debugging and am struggling on the following: I need to know when a function endpage() is called, so I set a breakpoint on it using</p>
  
  <pre><code>(gdb) b endpage
  </code></pre>
  
  <p>I run the program, hit the breakpoint and have a look at the call stack:</p>
  
  <pre><code>(gdb) bt
  #0  endpage () at ./szreptf.c:652
  #1  0x0807ef91 in _repstr (s=0x80ac780 "") at mntrep.c:1818
  #2  0x0807eef9 in repstr (s=0x80aa0f0 "") at mntrep.c:1798
  [...]
  #9  0x08052894 in main (argc=2, argv=0xbfb01994) at ./szmainf.c:514
  </code></pre>
  
  <p>And the call of this function is a commented line, and empty at that !</p>
  
  <pre><code>(gdb) l mntrep.c:1818
  1813    //  extern int pdf_page_length;     /* sydenham - imanage project */
  1814    //#endif /*I_MANAGE_SITE*/
  1815    //
  1816    //  if( !repcanwrite() )                
  1817    //      return;
  1818    //       
  1819    //  if( keychst() == 'Q' &amp;&amp; rep.pfquit != NULLFN)
  1820    //      (*rep.pfquit)(); // Calls endpage() in szreptf.c 
  1821    //  
  1822    //  if( rep.on == 'C' )
  </code></pre>
  
  <p>This line wasn't originally commented, but I tried to see whether GDB was looking at the right file, and it is: any change I make in that file, I can see it in GDB with the l command.</p>
  
  <p>But for some reason endpage() is still called out of the blue, so it looks like GDB shows me a file that is not the one I compiled.</p>
  
  <p><strong>So my question is:</strong> how does GDB decides which file to display when debugging ? I thought it was inferred from the executable, but apparently it is not the case.</p>
  
  <p>Any clues ?</p>
  
  <p>Thanks in advance :)</p>
  
  <p><strong>Edit:</strong> I forgot to mention it, but I attached GDB to a running program, I didn't start the program with GDB.</p>