Page 1 of 1

GDB plugin for chibios backtrace

Posted: Tue Sep 27, 2016 11:01 am
by totalkrill
Hello!

I was just wondering if anyone has implemented any chibios backtrace functions for gdb? Anything similar to the one in chibistudio?

- Kristoffer

Re: GDB plugin for chibios backtrace

Posted: Tue Sep 27, 2016 12:13 pm
by Giovanni
Hi,

Does GDB even support a trace functionality?

Giovanni

Re: GDB plugin for chibios backtrace

Posted: Tue Sep 27, 2016 12:30 pm
by totalkrill
Yes, you can use backtrace (bt) and that will allow you to traverse the stack and check variables and stuff ( given a unwinder is present for the architecture). But from what i gather, there is a much more powerful version of this in chibistudio.

I guess this are things stored in the memory in memory allocated to the chibios kernel? If so it should be possible to create an unwinder for this information to use under GDB since the newer version alow for python scripts to view, print and manipulate to the gdb session.

Re: GDB plugin for chibios backtrace

Posted: Tue Sep 27, 2016 2:12 pm
by Giovanni
OpenOCD implements a GDB server and is already able to decode the stack trace of each ChibiOS thread. What it can't do is to decode the trace buffer data, I believe GDB is not able to track events.

Giovanni

Re: GDB plugin for chibios backtrace

Posted: Tue Sep 27, 2016 3:47 pm
by totalkrill
How are you storing events in chibistudio then? GDB could be used to store events, but what would mean it has to invoke a breakpoint, then read out the event and store. This would be very slow i believe.

So what chibistudio is doing is basically decoding the trace buffer data only? If that is the case i guess I could implement a function to do that myself in gdb/python :)

Re: GDB plugin for chibios backtrace

Posted: Tue Sep 27, 2016 6:16 pm
by Giovanni
Events are stored into a circular buffer in RAM, see the debug/trace module, the data is read through GDB by inspecting the array.

Giovanni