This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [RFA] dwarf debug format: Support DW_AT_variable_parameter attribute
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: <tromey at redhat dot com>
- Cc: "'Joel Brobecker'" <brobecker at adacore dot com>, <gdb-patches at sourceware dot org>, "'FPC Core Developer List'" <core at freepascal dot org>
- Date: Wed, 19 May 2010 22:53:46 +0200
- Subject: RE: [RFA] dwarf debug format: Support DW_AT_variable_parameter attribute
- References: <8830.7035308846$1273670829@news.gmane.org> <m34oibvhgh.fsf@fleche.redhat.com> <20100517172758.GJ2805@adacore.com> <000301caf5e7$222ac800$66805800$@muller@ics-cnrs.unistra.fr> <20100517174726.GK2805@adacore.com> <44296.7587885962$1274132782@news.gmane.org> <m3fx1n90ul.fsf@fleche.redhat.com>
> Pierre> I fear that my patch will have to wait until
> Pierre> this static expression evaluator is implemented...
>
> I'm not totally convinced that we would want such an evaluator.
>
> Could you change the type of a parameter marked with
> DW_AT_variable_parameter to be a reference type instead? It seems to
> me
> that this would give the same result, or nearly so.
That is what is done for now on Free Pascal,
i.e. the debug information generates a reference_type for
parameters passed by var.
It's not ideal yet, but this is just a matter of
twicks inside p-* files...
The following patch does make the same as
if the reference_type is created by Free Pascal.
I am unsure about the type allocation procedure,
could you just tell me if this looks OK
before I resubmit an RFA.
Pierre
$ cvs diff -u -p dwarf2read.c
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 20:52:42 -0000
@@ -8662,6 +8662,20 @@ 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 = TYPE_REFERENCE_TYPE (SYMBOL_TYPE (sym));
+ if (!ref_type)
+ {
+ ref_type = alloc_type (objfile);
+ ref_type = make_reference_type (SYMBOL_TYPE (sym),
&ref_type);
+ }
+ SYMBOL_TYPE (sym) = ref_type;
+ }
+
add_symbol_to_list (sym, cu->list_in_scope);
break;
case DW_TAG_unspecified_parameters: