title: How to print the next N executed lines automatically in GDB?
body: <p>I have been trying to find a way for some time to automate the progress in GDB of tracing the control flow of a program.</p>
  
  <p>Even just a simple way of automating the <code>n</code> command so you can see in what order routines are called.</p>
  
  <p>I realise that you can issues <code>n x</code> where x is the number of times GDB steps through, but the trouble with that is that it shows the command but not the address of the routine! But if you press <code>n</code> manually in GDB (then press return to issue the previous command) it shows the address.</p>
  
  <p>I have tried the following in GDB:</p>
  
  <pre><code>(after setting a breakpoint at say 0x0123456)
  b *0x0123456
  </code></pre>
  
  <p>GDB says <code>&lt;breakpoint 1 at 0x123456&gt;</code>. I type:</p>
  
  <pre><code>commands 1
  n 1000
  c
  end
  </code></pre>
  
  <p>but it doesn't loop as expected, and it doesn't show the address location :-(.</p>
  
  <p>Any help would be appreciated! Surely it must be simple to automatically log the order routines are called??</p>