+ {
+ /* We're working on the TAG_inheritance for a base class. */
+ if (TREE_VIA_VIRTUAL (decl) && is_cxx ())
+ {
+ /* For C++ virtual bases we can't just use BINFO_OFFSET, as they
+ aren't at a fixed offset from all (sub)objects of the same
+ type. We need to extract the appropriate offset from our
+ vtable. The following dwarf expression means
+
+ BaseAddr = ObAddr + *((*ObAddr) - Offset)
+
+ This is specific to the V3 ABI, of course. */
+
+ dw_loc_descr_ref tmp;
+
+ /* Make a copy of the object address. */
+ tmp = new_loc_descr (DW_OP_dup, 0, 0);
+ add_loc_descr (&loc_descr, tmp);
+
+ /* Extract the vtable address. */
+ tmp = new_loc_descr (DW_OP_deref, 0, 0);
+ add_loc_descr (&loc_descr, tmp);
+
+ /* Calculate the address of the offset. */
+ offset = tree_low_cst (BINFO_VPTR_FIELD (decl), 0);
+ if (offset >= 0)
+ abort ();
+
+ tmp = int_loc_descriptor (-offset);
+ add_loc_descr (&loc_descr, tmp);
+ tmp = new_loc_descr (DW_OP_minus, 0, 0);
+ add_loc_descr (&loc_descr, tmp);
+
+ /* Extract the offset. */
+ tmp = new_loc_descr (DW_OP_deref, 0, 0);
+ add_loc_descr (&loc_descr, tmp);
+
+ /* Add it to the object address. */
+ tmp = new_loc_descr (DW_OP_plus, 0, 0);
+ add_loc_descr (&loc_descr, tmp);
+ }
+ else
+ offset = tree_low_cst (BINFO_OFFSET (decl), 0);
+ }