Search code examples
gdbembeddedremote-debuggingopenocd

Remote GDB disconnects whenever I press control + c


I am remote debugging a Stellaris Launchpad. I use OpenOCD to connect to the stellaris and then connect GDB to the server provided by openOCD. I use Open On-Chip Debugger 0.10.0-dev-00002-g79fdeb3 (2015-07-09-23:28). GDB is the one from arm-gcc-none-eabi, the 4_9-2015q1 release. I invoke openOCD like this:

/usr/local/bin/openocd --file \
/usr/local/share/openocd/scripts/board/ek-lm4f120xl.cfg \
>> openocdLog.txt 2>&1 &

And then GDB like this:

arm-none-eabi-gdb proj//debug/exec -x gdb//gdb.script

gdb/gdb.script contains:

set remotetimeout 10000
target extended-remote :3333
monitor reset halt
load
monitor reset init

The problem is that whenever I hit control+c GDB disconnects. Normally this would halt the remote, but GDB just disconnects:

(gdb) cont
Continuing.
^CError detected on fd 6
Remote communication error.  Target disconnected.: Interrupted system call.
(gdb) 

OpenOCD has the following things to say, this one while GDB is launching:

Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1258). Workaround: increase "set remotetimeout" in GDB

Which is weird, considering the gdb/gdb.script file forces remotetimeout to an insanly large number.

And when pressing control+c openOCD says:

Debug: 2602 5089 hla_interface.c:119 hl_interface_quit(): hl_interface_quit

So, how do I resolve this? How can I make GDB halt the remote instead of disconnecting when pressing control+c?


Solution

  • The problem was OpenOCD being too bleeding edge. I had issues with 0.6.1, but version 0.7.0 of OpenOCD works great.