[PATCH] Allow 'ptype/o' for assembly
Philippe Waroquiers
philippe.waroquiers@skynet.be
Mon Nov 14 20:05:15 GMT 2022
On Mon, 2022-11-14 at 06:32 -0700, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
>
> Philippe> At work, I relatively often use ptype/o for Ada types.
> Philippe> As it only works in C mode, as part of our zillions of site aliases,
> Philippe> we have added:
> Philippe> alias Wc = with language c -- with annotate 0 --
> Philippe> (where annotate 0 avoids spurious language switch messages in the output).
>
> Philippe> So, waiting for Adacore to implement ptype/o for Ada (hint hint :)),
> Philippe> we use e.g.
> Philippe> (gdb) Wc ptype/o sometype
>
> I've considered it, and maybe the basics aren't too hard to do, but I
> didn't really know what to do with types that have a dynamic layout.
> Here the offsets would maybe have to be symbolic (which I'd suppose is a
> pain to implement) and holes couldn't really be determined.
Effectively, Ada types can have a very rich/sophisticated layout.
When I really need to have a in depth look at a complex type representation,
the compiler option -gnatR3 produces this (including the symbolic offsets
where needed, and "formulas" to compute offsets).
>
> Maybe gdb could just print a warning in this scenario and drop the '/o'
> modifier. That might be easier to do.
Currently, ptype /o an_ada_type just prints the type, without the offsets.
I have no problem with this behaviour, but producing a warning that /o
is ignored in Ada mode will not harm).
Thanks
Philippe
More information about the Gdb-patches
mailing list