Remote query for structure layout
David Blaikie
dblaikie@gmail.com
Tue Mar 30 22:03:20 GMT 2021
On Tue, Mar 30, 2021 at 2:49 PM Simon Marchi <simon.marchi@polymtl.ca>
wrote:
> 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));
>
> ?
>
Perhaps - though I was thinking actually hardcoded in the compiler - since
it's the one that chooses/knows the layout, it's not (presumably) using any
code it reads from a header, etc, in user code to define the layout.
More information about the Gdb
mailing list