[RFA] dwarf debug format: Support DW_AT_variable_parameter attribute

Pierre Muller
2010-05-12T13:27:04Z

Free Pascal compiler has support for
DW_AT_variable_parameter attribute, but this is disabled because
GDB does not support it yet.

The value of the attribute must be a flag according to
DWARF specs. The only point I am unsure about is
what does a zero value of this flag mean:
Should zero be considered as FALSE and
thus the should say that this parameter is NOT a variable parameter,
or does the simple presence of this attribute condfirm
this it is a variable parameter, no matter the value of the flag.
I took the first approach here, but have the impression
that it is not always the case inside dwarf2read.c code.

The following patch adds support for this
inside dwarf2read.c source.
Tested on gcc16, no regression found.

Is this OK?

Pierre Muller
Pascal language support maintainer for GDB

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

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

Index: src/gdb/dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.383
diff -u -p -r1.383 dwarf2read.c
--- src/gdb/dwarf2read.c 8 May 2010 04:58:45 -0000 1.383
+++ src/gdb/dwarf2read.c 12 May 2010 13:00:17 -0000
@@ -8630,6 +8630,10 @@ 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))
+ SYMBOL_CLASS (sym) = LOC_REF_ARG;
+
add_symbol_to_list (sym, cu->list_in_scope);
break;