Page 1 of 1

Debugging fails with threads

Posted: Mon Oct 15, 2012 11:53 pm
by mabl
Hello,

i've already posted this issue on the tracker but was directed here.

My setup
I have the following setup:
I'm programming for an embedded ARM target running ChibiOS/RT:

Code: Select all

[ARM Target with ChibiOS] <--> JTAG <--> openOCD patched with ChibiOS thread support <--> arm-none-eabi-gdb <-> codelite
Software versions:
  • Ubuntu 12.04.1 LTS 64 bit
  • Codelite 4.1.5770 from repository
  • OpenOCD master, patched with #1, #2 and ChibiOS support
The setup works fine with command line gdb and Eclipse, I think it can be considered very stable.

Now to the problem:
Debugging works great if i disable thread support in OpenOCD - basically it then only shows the current execution. But once I move to threads, it works fine - but if threads are destroyed (this happens for example when initializing the RTOS), codelight chockes on the gdb output.

Most probably this is cause by a parsing error of the "info threads" command, which is nicely illustrated in this screenshot:
codelite_threadbug.log
The corresponding lines from the gdb log:

Code: Select all

DEBUG>>&"info threads\n"
DEBUG>>=thread-exited,id="1",group-id="i1"
=thread-exited,id="1",group-id="i1"
DEBUG>>=thread-created,id="2",group-id="i1"
=thread-created,id="2",group-id="i1"
DEBUG>>~"[New Thread 1]\n"
DEBUG>>~"  2 Thread 1 (Current Execution :  : No RTOS thread)  main () at main.cpp:69\n"
DEBUG>>~"\nThe current thread <Thread ID 1> has terminated.  See `help thread'.\n"
DEBUG>>00000018^done
DEBUG>>00000019-exec-next
DEBUG>>00000019^error,msg="Cannot execute this command without a live selected thread."
Cannot execute this command without a live selected thread.
DEBUG>>00000020-exec-next
DEBUG>>00000020^error,msg="Cannot execute this command without a live selected thread."
Cannot execute this command without a live selected thread.
DEBUG>>00000021info threads
DEBUG>>&"info threads\n"
DEBUG>>~"  2 Thread 1 (Current Execution :  : No RTOS thread)  main () at main.cpp:69\n"
DEBUG>>~"\nThe current thread <Thread ID 1> has terminated.  See `help thread'.\n"
DEBUG>>00000021^done
Best,
MaBl

Re: Debugging fails with threads

Posted: Tue Oct 16, 2012 11:20 am
by mabl
A better way of getting the thread information is probably -thread-info
http://sourceware.org/gdb/onlinedocs/gd ... mands.html

Re: Debugging fails with threads

Posted: Wed Oct 17, 2012 11:29 am
by eranif
mabl wrote:A better way of getting the thread information is probably -thread-info
http://sourceware.org/gdb/onlinedocs/gd ... mands.html
Initially this was the way it was done, however, it did not work quite well on old machines with an older version of gdb.
However, there have been few years since that.. so I changed the code to use the -thread-info command.

In addition I replaced the column 'Information' with 3 columns: Function | File | Line (to make it more readable)
This change is committed to trunk
Eran