Debugging fails with threads

CodeLite installation/troubleshooting forum
mabl
CodeLite Curious
Posts: 2
Joined: Mon Oct 15, 2012 11:36 pm
Genuine User: Yes
IDE Question: C++
Contact:

Debugging fails with threads

Post 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
You do not have the required permissions to view the files attached to this post.
mabl
CodeLite Curious
Posts: 2
Joined: Mon Oct 15, 2012 11:36 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugging fails with threads

Post by mabl »

A better way of getting the thread information is probably -thread-info
http://sourceware.org/gdb/onlinedocs/gd ... mands.html
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugging fails with threads

Post 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
Make sure you have read the HOW TO POST thread
Post Reply