This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [RFA] dwarf debug format: Support DW_AT_variable_parameter attribute


> 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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]