+
+/* This function prints out virtual table entries for a class; it
+ * recurses on the base classes to find all virtual functions
+ * available in a class.
+ *
+ * pai/1997-05-21 Note: As the name suggests, it's currently
+ * implemented for HP aCC runtime only. g++ objects are handled
+ * differently and I have made no attempt to fold that logic in
+ * here. The runtime layout is different for the two cases. Also,
+ * this currently has only the code for non-RRBC layouts generated by
+ * the HP aCC compiler; RRBC code is stubbed out and will have to be
+ * added later. */
+
+
+static void
+cp_print_hpacc_virtual_table_entries (struct type *type, int *vfuncs,
+ struct value *v, struct ui_file *stream,
+ int format, int recurse,
+ enum val_prettyprint pretty)
+{
+ int fn, oi;
+
+ /* pai: FIXME this function doesn't work. It should handle a given
+ * virtual function only once (latest redefinition in class hierarchy)
+ */
+
+ /* Recursion on other classes that can share the same vtable */
+ struct type *pbc = primary_base_class (type);
+ if (pbc)
+ cp_print_hpacc_virtual_table_entries (pbc, vfuncs, v, stream, format,
+ recurse, pretty);
+
+ /* Now deal with vfuncs declared in this class */
+ for (fn = 0; fn < TYPE_NFN_FIELDS (type); fn++)
+ for (oi = 0; oi < TYPE_FN_FIELDLIST_LENGTH (type, fn); oi++)
+ if (TYPE_FN_FIELD_VIRTUAL_P (TYPE_FN_FIELDLIST1 (type, fn), oi))
+ {
+ char *vf_name;
+ const char *field_physname;
+
+ /* virtual function offset */
+ int vx = (TYPE_FN_FIELD_VOFFSET (TYPE_FN_FIELDLIST1 (type, fn), oi)
+ - 1);
+
+ /* Get the address of the vfunction entry */
+ struct value *vf = value_copy (v);
+ if (value_lazy (vf))
+ (void) value_fetch_lazy (vf);
+ /* adjust by offset */
+ /* NOTE: cagney/2005-01-02: THIS IS BOGUS. */
+ value_contents_writeable (vf)[0] += 4 * (HP_ACC_VFUNC_START + vx);
+ vf = value_ind (vf); /* get the entry */
+ /* make it a pointer */
+ deprecated_set_value_type (vf, value_type (v));
+
+ /* print out the entry */
+ common_val_print (vf, stream, format, 0, recurse + 1, pretty);
+ field_physname
+ = TYPE_FN_FIELD_PHYSNAME (TYPE_FN_FIELDLIST1 (type, fn), oi);
+ /* pai: (temp) FIXME Maybe this should be DMGL_ANSI */
+ vf_name = cplus_demangle (field_physname, DMGL_ARM);
+ fprintf_filtered (stream, " %s", vf_name);
+ if (--(*vfuncs) > 0)
+ fputs_filtered (", ", stream);
+ }
+}
+
+
+