[GCC-XML] Offsets of base classes

Brad King brad.king at kitware.com
Tue Mar 28 15:01:34 EST 2006


Petri Rehtonen wrote:
> Hi Brad,
> 
> I am solving a problem where I need to know the offset of the subclass
> in the class. I have found out that in the function
> xml_output_record_type(xml_dump_info_p xdi, tree rt, xml_dump_node_p dn)
> the bases of the class are added as sub-elements to the Class and the
> offset can be added as an attribute for the Base element. The way I am
> currently getting the offset of a base is like this:
> tree_low_cst (BINFO_OFFSET (base_binfo), 0) * 8;
> 
> Does this seems ok?
> 
> I would be glad if this information could also be found from the XML
> output of the official GCC-XML and I can provide the changes needed in
> xml.c if it is needed.

I've committed it in CVS:

/cvsroot/GCC_XML/gccxml/GCC/gcc/cp/../../../GCC_XML/xml.c,v  <--  xml.c
new revision: 1.108; previous revision: 1.107

I left off the multiplication by 8.  According to the documentation of 
BINFO_OFFSET the offset is in bytes.  Since other sizes and offsets are 
stored in bytes and the smallest base object offset increment is 1 byte 
anyway there is no reason to convert to bits.

-Brad



More information about the gccxml mailing list