Re: Binary Compatibility: debug info for compiled Java programs

Daniel Jacobowitz
2004-06-09T13:29:54Z

On Wed, Jun 09, 2004 at 02:16:44PM +0100, Andrew Haley wrote:
> Daniel Jacobowitz writes:
> >
> > I'm not familiar with the BC ABI (and missed the talk); could you give
> > me an example of what information you have at compile time and what you
> > generate at runtime?
>
> All structures are laid out at runtime.
>
> http://people.redhat.com/lockhart/.gcc04/MasterGCC-2side.pdf Page 169.

So: the list of members, the inheritance tree, et cetera is static at
compile time; for their locations you have runtime tables.

> > I suspect that a fourth solution is possible: gcj generating DWARF
> > which describes how to read the metadata. It may not be very
> > efficient, though, and it will still require a certain amount of
> > playing with GDB.
>
> Yeah, that was suggested as well. I forgot to mention it. I don't
> know if this is possible in DWARF data: don't member offsets have to
> be constants?
>
> I must admit I like this idea least of all! Maybe I subconsciously
> suppressed the memory.

Could you explain what you don't like about it?

Member offsets definitely don't have to be constant. In fact, from the
spec:
For a C++ virtual base, the data member location attribute will
usually consist of a non-trivial location expression.
The way C++ handles virtual bases is similar enough in execution that
the same thing will work here. For a member it would look like:

# Base location of the class is on the stack
DW_OP_addr <otable location>
DW_OP_constu <otable offset>
DW_OP_plus
DW_OP_deref (or DW_OP_deref_size <size of atable entry>)
DW_OP_plus

--
Daniel Jacobowitz