[Dwarf-discuss] new kind of value expression (future work)

Chris Quenelle Chris.Quenelle
Sat May 28 17:23:41 PDT 2005

Subject was: Issue 050222.1

[ discussion of creating a new 'value expression' which
   can calculate any program value ]

Jim Blandy wrote:
> In principle, sure.  The details are going to be a mess, though,
> because it'll have to match the semantics of the source language.  For
> example, if the value in question were a structure, the dwarf value
> expression would need to actually compute the whole structure as its
> value.  Imagine Dwarf expressions that compute instances of C++
> classes...

I was assuming the semantics of a proper "value expression"
would be lowered to the machine level.  The semantics won't
be expected to match the source language.  I was assuming
it would just be a way of collecting an arbitrary string of bits
and doing some common math and indirection operations on them.

In my head it seems more like a mini machine-language,
hopefully language independant.

If a C++ object instance is one contiguous block of
memory, then you just need to calculate it's start
address and size.

Both of these things can be non-trivial depending on
the implementation, and they can require digging into the
runtime data structures to find the proper dynamic-type
of the C++ object.

Of course, an implementation may choose to only specify
the starting address of the object using the existing dwarf data
and allow the debugger to do the rest in a platform dependant way.

More information about the Dwarf-Discuss mailing list