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

Tom Tromey
2010-05-19T22:10:01Z

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