title: How to make gem5 wait for GDB to connect to reliably break at the start of simulation and see start_kernel of the Linux kernel?
body: <p>On QEMU, I can use <code>-S -s</code>, which waits for GDB to connect before starting the simulation</p>
  
  <p>How to do the same thing on gem5, hopefully with the <code>fs.py</code> script?</p>
  
  <p>By the time I swap terminals and connect, the simulation has already gone past <code>start_kernel</code>.</p>
  
  <p>I saw the <code>--debug-break</code> flag, but I don't know how to use it, if I do:</p>
  
  <pre><code>--debug-break=1
  </code></pre>
  
  <p>The run just fails with:</p>
  
  <pre><code>Trace/breakpoint trap   (core dumped)
  </code></pre>
  
  <ul>
  <li><a href="https://www.mail-archive.com/gem5-users@gem5.org/msg15206.html" rel="nofollow noreferrer">https://www.mail-archive.com/gem5-users@gem5.org/msg15206.html</a></li>
  <li><a href="https://www.mail-archive.com/gem5-users@gem5.org/msg09298.html" rel="nofollow noreferrer">https://www.mail-archive.com/gem5-users@gem5.org/msg09298.html</a></li>
  </ul>
  
  <p><strong>Edit</strong>: after looking a bit further, I now found that commit c2baaab0ed43ad09fc8b7fcda25207b6ccd6c0e3 adds a parameter:</p>
  
  <pre><code>+    wait_for_remote_gdb = Param.Bool(False,
  +        "Wait for a remote GDB connection");
  </code></pre>
  
  <p>which must be what I'm looking for. But I didn't find how to enable it from <code>fs.py</code>, seems to not be exposed?</p>