pyOCD gdbserver crashes

25 Sep 2013

Hi,

I am currently testing pyOCD for debugging via GDB. But when I connect to the server via "target remote localhost:3333" the server often (but not always) crashes. The console output of the error looks like this:

Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/dist-packages/pyOCD/gdbserver/gdbserver.py", line 169, in run
    [resp, ack, detach] = self.handleMsg(data)
  File "/usr/local/lib/python2.7/dist-packages/pyOCD/gdbserver/gdbserver.py", line 213, in handleMsg
    return self.lastSignal(), 1, 0
  File "/usr/local/lib/python2.7/dist-packages/pyOCD/gdbserver/gdbserver.py", line 490, in lastSignal
    fault = FAULT[fault]
KeyError: 41

I am not a Python expert but me it looks like the fault variable has a value (41) that is not part of the FAULT mapping. https://github.com/mbedmicro/mbed/blob/master/workspace_tools/debugger/pyOCD/gdbserver/gdbserver.py#L490

Thanks, Josef

-deleted-
05 Oct 2013

Hi!

Looks like bit mask (0xff) is not correct at line https://github.com/mbedmicro/mbed/blob/master/workspace_tools/debugger/pyOCD/gdbserver/gdbserver.py#L489

I guess mask should be changed to 0xf. This fix works fine for me. Can always connect with gdb.

Regards, Ivan.