Re: [PATCH v3 10/20] gendwarfksyms: Expand structure types
From: Sami Tolvanen
Date: Tue Oct 01 2024 - 17:21:35 EST
On Tue, Oct 1, 2024 at 2:16 PM Petr Pavlu <petr.pavlu@xxxxxxxx> wrote:
>
> On 9/23/24 20:18, Sami Tolvanen wrote:
> > +static void process_variant_type(struct state *state, struct die *cache,
> > + Dwarf_Die *die)
> > +{
> > + process_list_comma(state, cache);
> > + process(cache, "variant {");
> > + process_linebreak(cache, 1);
> > + check(process_die_container(state, cache, die, process_type,
> > + match_member_type));
> > + process_linebreak(cache, -1);
> > + process(cache, "}");
> > +}
> > +
> > +static void process_variant_part_type(struct state *state, struct die *cache,
> > + Dwarf_Die *die)
> > +{
> > + process_list_comma(state, cache);
> > + process(cache, "variant_part {");
> > + process_linebreak(cache, 1);
> > + check(process_die_container(state, cache, die, process_type,
> > + match_variant_type));
> > + process_linebreak(cache, -1);
> > + process(cache, "}");
> > +}
>
> For variant types, should the tool worry also about DW_AT_discr and
> DW_AT_discr_value?
Hmm, I initially thought they were not necessary, but looking at the
rustc DWARF output a bit more closely, it might actually be a good
idea to include this information. I'll add these both, although since
DW_AT_discr just points to a member DIE, it's probably enough to just
process all child DIEs for the variant_part instead of limiting
ourselves to variants only.
> > +static void process_unspecified_type(struct state *state, struct die *cache,
> > + Dwarf_Die *die)
> > +{
> > + /*
> > + * These can be emitted for stand-elone assembly code, which means we
> > + * might run into them in vmlinux.o.
> > + */
>
> Nit: stand-elone -> stand-alone.
Oops, I'll fix this too. Thanks!
Sami