Re: RFA: Location list support for DWARF-2

Jim Blandy
2003-04-09T05:05:52Z

This looks good to me --- please commit it, once you've addressed the
minor things I mention here.

(Yay!)

Daniel Jacobowitz <drow@mvista.com> writes:
> > Rather than putting 'if (foo->is_list)' everywhere, why not just
> > introduce a separate 'struct location_funcs' for location lists?
> > Aside from just being cleaner, you'll save a word in each baton.
>
> Actually, it won't save any space to remove is_list: it goes into the
> padding between size and the following CORE_ADDR/pointer. It does save
> space for non-location-list variables though, because of the base
> address, so I think it's a good idea.

Okay, I think that's a big improvement.

> It requires introducing one annoying hack in dwarf_expr_frame_base
> but I'm not terribly upset by it.

I can think of a nice solution in C++, but it would lose so much in
the translation to C that it's not worth it.

> +struct dwarf2_loclist_baton
> +{
> + CORE_ADDR base_address;
> + unsigned char *data;
> + unsigned short size;
> + struct objfile *objfile;
> +};

The fields of this structure need to be documented, as do those of
dwarf2_locexpr_baton.

> + {
> + dwarf2_invalid_attrib_class_complaint ("location description",
> + SYMBOL_NATURAL_NAME (sym));
> + baton->size = 0;
> + baton->data = NULL;
> + }

dwarf2_evaluate_loc_desc isn't prepared to handle this; it'll get an
error when it tries to fetch the top value off the stack after
evaluating no location instructions, won't it? It should probably
return a value with its "optimized_out" flag set.