title: GDB remote protocol: how to analyse packets?
body: <p><strong>I have:</strong></p>
  
  <ul>
  <li>A proprietary prototype ARM board (Cortex-M3 based) with eCos OS</li>
  <li>The board has the programmed RedBoot bootloader</li>
  <li>Serial line (RS-232)</li>
  <li>GDB debugger for ARM (arm-eabi-gdb)</li>
  <li>Host OS is Windows/Cygwin and/or Linux (actually, doesn't matter)</li>
  </ul>
  
  <p><strong>Problem:</strong> GDB debugger cannot connect to the target over the serial line.</p>
  
  <p><strong>What I want:</strong> is to sniff the packets of the GDB remote protocol in order to undestand whether the GDB stub on the target is alive and operating.</p>
  
  <p><strong>Details:</strong> RedBoot has an option to pass the target's control to the built-in GDB stub. I know that the RedBoot is alive, I can connect to it and send it commands over the serial line. <a href="http://ecos.sourceware.org/docs-latest/redboot/redboot-commands-and-examples.html">The RedBoot manual</a> says that the switch to the GDB stub can be made by typing $ or + symbols (which are actually the prefixes of the GDB remote protocol packets). It seems to work for when I send those symbols the terminal dies. But I'm not sure if the RedBoot was compiled with the GDB stub support (don't ask me why :-)).</p>
  
  <p>Then, when I try to connect to the board with my GDB debugger I get the following picture (on Windows):</p>
  
  <pre><code>(gdb) target remote COM3
  Remote debugging using COM3
  Ignoring packet error, continuing...
  Ignoring packet error, continuing...
  Ignoring packet error, continuing...
  Ignoring packet error, continuing...
  </code></pre>
  
  <p>The port is correct, the baudrate as well. Actually the same output I get if I try to do the same with another serial port which is not connected with anything.</p>
  
  <p>What I want to know is does GDB stub send back anything or not?  </p>
  
  <p>Intuitively I thought that probably</p>
  
  <pre><code>set verbose on
  </code></pre>
  
  <p>would help, but GDB manual says it has very a limited effect and my case is beyond it.</p>
  
  <p>May be it is possible to compile GDB debugger with a macro which enables debug logging?</p>