Threads Debugging in GDB and Chibistudio

Discussions and support about ChibiOS/RT, the free embedded RTOS.
Post Reply
Kunal Gupta
Posts: 10
Joined: Tue Jul 20, 2021 6:31 pm
Has thanked: 1 time

Threads Debugging in GDB and Chibistudio

Post by Kunal Gupta »

Hi to all, I am new to Chibistudio and debugging its threads.
Now the thing is that when I use the debug window of chibistudio, it lists all the threads which are running as shown in this image.
Image
And when I debug the same code using gdb commands, and for listing the threads it with info threads command, it shows only one thread and that too of name remote.
Image
Want to know what thing is wrong here. why does it not showing all threads in case of gdb with correct names.????
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Threads Debugging in GDB and Chibistudio

Post by Giovanni »

Hi,

Images are not showing, you need to attach them to the message.

Anyway, if you want to see threads in GDB then you need to start OpenOCD with the option for RTOSes, you need to look at the manual, I don't remember the details.

ChibiStudio uses a different method to look at threads, this is why it works.

Giovanni
Kunal Gupta
Posts: 10
Joined: Tue Jul 20, 2021 6:31 pm
Has thanked: 1 time

Re: Threads Debugging in GDB and Chibistudio

Post by Kunal Gupta »

Here I have attached the images again
GDB debugging of threads
GDB debugging of threads


Chibistudio debugging
Chibistudio debugging


Yeah I am using GDB and Openocd both for debugging, I started the openocd session via Chibistudio only
like this
Openocd connection
Openocd connection
and then just launching the gdb using Cygwin.

Am I putting some incorrect gdb commands to list threads????
mikeprotts
Posts: 166
Joined: Wed Jan 09, 2019 12:37 pm
Has thanked: 19 times
Been thanked: 31 times

Re: Threads Debugging in GDB and Chibistudio

Post by mikeprotts »

For opeonocd I've added the following to the end of a copy of the target file:

Code: Select all

$_TARGETNAME configure -rtos ChibiOS


Mike
Kunal Gupta
Posts: 10
Joined: Tue Jul 20, 2021 6:31 pm
Has thanked: 1 time

Re: Threads Debugging in GDB and Chibistudio

Post by Kunal Gupta »

Yeah, correct and I too have done and tried that.
So then when u connect to gdb via CLI and list the threads by info threads command, did it show u all the threads as it shows in chibistudio debug window.
dflogeras
Posts: 232
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

Re: Threads Debugging in GDB and Chibistudio

Post by dflogeras »

Hi Kunal,

First, thanks for this discussion, I wasn't aware of this feature.

Second, I can verify that it works in gdb with simply "info threads" for me. I've added the aforementioned line to my openocd .cfg file. I connect gdb with "target ext :[myport]". I've also tested with "target remote :[myport]". I'm not even sure what the difference is between those two commands but they both worked for me.

I'm using openocd-0.10.0. This project I tested on was under ChibiOS_19.x.y because that's what I had lying around with threads to test. I'm using gdb 10.1.

If you can't get it working, you could try in the openocd IRC channel on libera chat. The main author is quite responsive and helpful.
Post Reply