Page 1 of 1

Threads Debugging in GDB and Chibistudio

Posted: Tue Jul 20, 2021 6:47 pm
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.????

Re: Threads Debugging in GDB and Chibistudio

Posted: Tue Jul 20, 2021 7:31 pm
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

Re: Threads Debugging in GDB and Chibistudio

Posted: Wed Jul 21, 2021 5:12 am
by Kunal Gupta
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????

Re: Threads Debugging in GDB and Chibistudio

Posted: Wed Jul 21, 2021 2:02 pm
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

Re: Threads Debugging in GDB and Chibistudio

Posted: Wed Jul 21, 2021 6:32 pm
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.

Re: Threads Debugging in GDB and Chibistudio

Posted: Fri Jul 30, 2021 2:17 am
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.