Re: Remote query for structure layout

Tim Newsome
2021-03-30T20:35:32Z

On Sun, Mar 28, 2021 at 5:00 AM <gdb-request@sourceware.org> wrote:

> I would like to propose a new command for the remote protocol that can be
> used to
> query structure layouts.
> Essentially a `qSymbol` equivalent for the output of `ptype`.
>

I'm really interested in this. I've been working on OpenOCD FreeRTOS
support and as Thomas points out, it's a fragile mess.

There's another use case that this would be great for. FreeRTOS stores
registers on the stack when it switches to another thread. OpenOCD needs to
know what this register layout is, and it also depends on compile time
options. With this mechanism I think it would be possible for FreeRTOS to
define a struct that represents how the registers are laid out on the
stack. E.g.:
struct register_stacking_t {
uint32_t x1;
uint32_t x2;
uint32_t x3;
uint32_t x4;
...
uint32_t pc;
};

Am I right that this will end up in the dwarf info even if the struct
itself isn't used anywhere in the FreeRTOS code? This would simplify so
much.

Tim