[RFA-v2] dwarf debug format: Support DW_AT_variable_parameter attribute

Pierre Muller
2010-05-19T22:34:47Z

So, here is a new version of this patch.

I will try to improve reference type handling inside the
pascal specific sources later.

Does that look OK?

Pierre

2010-05-20 Pierre Muller <muller@ics.u-strasbg.fr>

* dwarf2read.c (new_symbol): Handle DW_AT_variable_parameter
attribute.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.386
diff -u -p -r1.386 dwarf2read.c
--- dwarf2read.c 17 May 2010 15:55:01 -0000 1.386
+++ dwarf2read.c 19 May 2010 22:29:04 -0000
@@ -8662,6 +8662,15 @@ new_symbol (struct die_info *die, struct
{
dwarf2_const_value (attr, sym, cu);
}
+ attr = dwarf2_attr (die, DW_AT_variable_parameter, cu);
+ if (attr && DW_UNSND (attr))
+ {
+ struct type *ref_type;
+
+ ref_type = lookup_reference_type (SYMBOL_TYPE (sym));
+ SYMBOL_TYPE (sym) = ref_type;
+ }
+
add_symbol_to_list (sym, cu->list_in_scope);
break;
case DW_TAG_unspecified_parameters:

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : Thursday, May 20, 2010 12:09 AM
> À : Pierre Muller
> Cc : 'Joel Brobecker'; gdb-patches@sourceware.org; 'FPC Core Developer
> List'
> Objet : Re: [RFA] dwarf debug format: Support DW_AT_variable_parameter
> attribute
>
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
> writes:
>
> Pierre> That is what is done for now on Free Pascal,
> Pierre> i.e. the debug information generates a reference_type for
> Pierre> parameters passed by var.
> Pierre> It's not ideal yet, but this is just a matter of
> Pierre> twicks inside p-* files...
>
> I suppose it is less than ideal in that the type is exposed to the
> user.
>
> Another idea would be to augment the DWARF expression evaluator to do
> an
> additional indirection when this bit is set. Though then one must
> wonder why the compiler does not simply emit an expression to that
> effect.
>
> Pierre> I am unsure about the type allocation procedure,
> Pierre> could you just tell me if this looks OK
> Pierre> before I resubmit an RFA.
>
> Pierre> + struct type *ref_type;
> Pierre> +
> Pierre> + ref_type = TYPE_REFERENCE_TYPE (SYMBOL_TYPE
> (sym));
> Pierre> + if (!ref_type)
> Pierre> + {
> Pierre> + ref_type = alloc_type (objfile);
> Pierre> + ref_type = make_reference_type (SYMBOL_TYPE
> (sym),
> Pierre> &ref_type);
> Pierre> + }
>
> Just use 'lookup_reference_type (SYMBOL_TYPE (sym))'.
> That will handle the details for you.
>
> Tom