GDB plugin for chibios backtrace

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
totalkrill
Posts: 12
Joined: Thu Jul 09, 2015 2:21 pm

GDB plugin for chibios backtrace

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: GDB plugin for chibios backtrace

Post by Giovanni »

Hi,

Does GDB even support a trace functionality?

Giovanni
totalkrill
Posts: 12
Joined: Thu Jul 09, 2015 2:21 pm

Re: GDB plugin for chibios backtrace

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: GDB plugin for chibios backtrace

Post 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
totalkrill
Posts: 12
Joined: Thu Jul 09, 2015 2:21 pm

Re: GDB plugin for chibios backtrace

Post 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 :)
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: GDB plugin for chibios backtrace

Post 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
Post Reply