Re: interface to partial support for DW_OP_piece in dwarf2expr.[ch]

Jim Blandy
2004-08-04T23:17:16Z

Daniel Jacobowitz <drow@false.org> writes:
> On Wed, Aug 04, 2004 at 05:19:30PM -0500, Jim Blandy wrote:
> > Well, in the immediate term, dwarf2loc.c should simply reject
> > locations with pieces, and generate an error message. This is the
> > same behavior we have now, but instead of dwarf2expr.c saying
> > "Unrecognized opcode 0x93", dwarf2loc.c can say something more
> > informative like "The value of variable 'foo' is distributed across
> > several locations, and GDB cannot access its value."
> >
> > The next step is to have something that will recognize when a series
> > of pieces is actually a reference to a single register --- presumably
> > one that GDB has a number for, but one that Dwarf only has numbers for
> > pieces of. That needs to be an arch method that recognizes the cases
> > that can be simplified, and passes on the cases it can't handle. This
> > will address all the current uses of DW_OP_piece, I believe.
>
> No, it won't. GCC already generates more than that.

Okay --- that's good to know.

> I'm dubious as to whether this step is even worthwhile. Another
> possible intermediate step is to immediately combine the pieces,
> marking the value as not_lval; read them all and piece them together in
> GDB's memory. Yes, this means that they can't be assigned to, but at
> least we'd be able to inspect them.

It seems worthwhile to me, because it will allow GDB to work
correctly, assignments and all, in the cases where the current value
structures can handle it, and it's very little work. At some point,
resources will materialize to do the larger project, but what's the
harm in getting the best behavior we can out of the current structures
until then?