Re: Remote query for structure layout

Simon Marchi via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On 2021-03-30 5:41 p.m., David Blaikie wrote:> 
> Is the register layout in this struct part of the ABI? If so the debugger could assume it/hardcode the knowledge.

I don't think this is part of any ABI, this is just how FreeRTOS stores
the registers of inactive tasks.  So it's like an implementation detail
of FreeRTOS, but one that the debugger needs to know in order to inspect
existing threads.

From what I undersand from Tim's message, the GDB stub inside OpenOCD
already hardcodes that knowledge, but the problem is that the layout can
change based on compilation options (which OpenOCD probably can't easily
detect), and the layout could change between FreeRTOS versions.

> If not, then it seems to me the right thing might be for the compiler to have builtin support for emitting this struct under a reserved name into every CU, perhaps? Not relying on source quirks to encourage it (as you say, would leave you at the whims of the compiler implementation), but actually make it explicitly part of compiler support for this architecture.

Maybe an attribute

struct the_struct {
} __attribute__((always_emit_debug));

?

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.