Threads Debugging in GDB and Chibistudio

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

Threads Debugging in GDB and Chibistudio

Postby Kunal Gupta » Tue Jul 20, 2021 6:47 pm

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: 13726
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 917 times
Been thanked: 781 times
Contact:

Re: Threads Debugging in GDB and Chibistudio

Postby Giovanni » Tue Jul 20, 2021 7:31 pm

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

Postby Kunal Gupta » Wed Jul 21, 2021 5:12 am

Here I have attached the images again
WhatsApp Image 2021-07-20 at 23.13.55.jpeg
GDB debugging of threads


WhatsApp Image 2021-07-20 at 23.14.17.jpeg
Chibistudio debugging


Yeah I am using GDB and Openocd both for debugging, I started the openocd session via Chibistudio only
like this
Screenshot 2021-07-21 093910.png
Openocd connection
and then just launching the gdb using Cygwin.

Am I putting some incorrect gdb commands to list threads????

mikeprotts
Posts: 158
Joined: Wed Jan 09, 2019 12:37 pm
Has thanked: 19 times
Been thanked: 25 times

Re: Threads Debugging in GDB and Chibistudio

Postby mikeprotts » Wed Jul 21, 2021 2:02 pm

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

Postby Kunal Gupta » Wed Jul 21, 2021 6:32 pm

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: 195
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 3 times
Been thanked: 15 times

Re: Threads Debugging in GDB and Chibistudio

Postby dflogeras » Fri Jul 30, 2021 2:17 am

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.


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 4 guests