Don't emit symbols seen only in dynamic object, don't read duplicate
[deliverable/binutils-gdb.git] / gdb / hpacc-abi.c
index 6753cd7d865783b90488b45208dc40b4e9aa1b57..2cb21381da4820ec7538550a875ce2368cdfa006 100644 (file)
@@ -1,9 +1,10 @@
 /* Abstraction of HP aCC ABI.
+
    Contributed by Daniel Berlin <dberlin@redhat.com>
    Most of the real code is from HP, i've just fiddled it to fit in
    the C++ ABI abstraction framework.
 
-   Copyright 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -21,8 +22,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
 #include "value.h"
@@ -31,6 +32,7 @@
 #include "gdbtypes.h"
 #include "gdbcore.h"
 #include "cp-abi.h"
+#include "gnu-v2-abi.h"
 
 struct cp_abi_ops hpacc_abi_ops;
 
@@ -85,7 +87,7 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
                        struct type * type, int offset)
 {
   struct value *arg1 = *arg1p;
-  struct type *type1 = check_typedef (VALUE_TYPE (arg1));
+  struct type *type1 = check_typedef (value_type (arg1));
 
   /* Deal with HP/Taligent runtime model for virtual functions */
   struct value *vp;
@@ -97,12 +99,12 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
   argp = value_cast (type, *arg1p);
 
   if (VALUE_ADDRESS (argp) == 0)
-    error ("Address of object is null; object may not have been created.");
+    error (_("Address of object is null; object may not have been created."));
 
   /* pai: FIXME -- 32x64 possible problem? */
   /* First word (4 bytes) in object layout is the vtable pointer */
-  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (argp));    /* pai: (temp)  */
-  /* + offset + VALUE_EMBEDDED_OFFSET (argp)); */
+  coreptr = *(CORE_ADDR *) (value_contents (argp));    /* pai: (temp)  */
+  /* + offset + value_embedded_offset (argp)); */
 
   if (!coreptr)
     error
@@ -128,9 +130,9 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
        * which case the multiplier should be 8 and values should be long */
       vp = value_at (builtin_type_int,
                     coreptr + 4 * (TYPE_FN_FIELD_VOFFSET (f, j) +
-                                   HP_ACC_VFUNC_START), NULL);
+                                   HP_ACC_VFUNC_START));
 
-      coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
+      coreptr = *(CORE_ADDR *) (value_contents (vp));
       /* coreptr now contains the address of the virtual function */
       /* (Actually, it contains the pointer to the plabel for the function. */
     }
@@ -147,14 +149,14 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
       /* pai: FIXME 32x64 problem here, if words are 8 bytes long
        * the multiplier below has to be 8 and value should be long. */
       vp = value_at (builtin_type_int,
-                    coreptr + 4 * (HP_ACC_VFUNC_START + class_index), NULL);
+                    coreptr + 4 * (HP_ACC_VFUNC_START + class_index));
       /* Indirect once more, offset by function index */
       /* pai: FIXME 32x64 problem here, again multiplier could be 8 and value long */
       coreptr =
-       *(CORE_ADDR *) (VALUE_CONTENTS (vp) +
+       *(CORE_ADDR *) (value_contents (vp) +
                        4 * TYPE_FN_FIELD_VOFFSET (f, j));
-      vp = value_at (builtin_type_int, coreptr, NULL);
-      coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
+      vp = value_at (builtin_type_int, coreptr);
+      coreptr = *(CORE_ADDR *) (value_contents (vp));
 
       /* coreptr now contains the address of the virtual function */
       /* (Actually, it contains the pointer to the plabel for the function.) */
@@ -162,11 +164,11 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
     }
 
   if (!coreptr)
-    error ("Address of virtual function is null; error in virtual table?");
+    error (_("Address of virtual function is null; error in virtual table?"));
 
   /* Wrap this addr in a value and return pointer */
   vp = allocate_value (ftype);
-  VALUE_TYPE (vp) = ftype;
+  deprecated_set_value_type (vp, ftype);
   VALUE_ADDRESS (vp) = coreptr;
 
   /* pai: (temp) do we need the value_ind stuff in value_fn_field? */
@@ -193,7 +195,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
     *using_enc = 0;
 
   /* Get declared type */
-  known_type = VALUE_TYPE (v);
+  known_type = value_type (v);
   CHECK_TYPEDEF (known_type);
   /* RTTI works only or class objects */
   if (TYPE_CODE (known_type) != TYPE_CODE_CLASS)
@@ -204,7 +206,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
    * we can't do anything. */
   if (!TYPE_HAS_VTABLE (known_type))
     {
-      known_type = VALUE_ENCLOSING_TYPE (v);
+      known_type = value_enclosing_type (v);
       CHECK_TYPEDEF (known_type);
       if ((TYPE_CODE (known_type) != TYPE_CODE_CLASS) ||
           !TYPE_HAS_VTABLE (known_type))
@@ -217,11 +219,11 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
     *using_enc = 1;
 
   /* First get the virtual table address */
-  coreptr = *(CORE_ADDR *) ((VALUE_CONTENTS_ALL (v))
-                            + VALUE_OFFSET (v)
+  coreptr = *(CORE_ADDR *) ((value_contents_all (v))
+                            + value_offset (v)
                             + (using_enclosing
                                ? 0
-                               : VALUE_EMBEDDED_OFFSET (v)));
+                               : value_embedded_offset (v)));
   if (coreptr == 0)
     /* return silently -- maybe called on gdb-generated value */
     return NULL;
@@ -229,38 +231,36 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
   /* Fetch the top offset of the object */
   /* FIXME possible 32x64 problem with pointer size & arithmetic */
   vp = value_at (builtin_type_int,
-                 coreptr + 4 * HP_ACC_TOP_OFFSET_OFFSET,
-                 VALUE_BFD_SECTION (v));
+                 coreptr + 4 * HP_ACC_TOP_OFFSET_OFFSET);
   top_offset = value_as_long (vp);
   if (top)
     *top = top_offset;
 
   /* Fetch the typeinfo pointer */
   /* FIXME possible 32x64 problem with pointer size & arithmetic */
-  vp = value_at (builtin_type_int, coreptr + 4 * HP_ACC_TYPEINFO_OFFSET,
-                 VALUE_BFD_SECTION (v));
+  vp = value_at (builtin_type_int, coreptr + 4 * HP_ACC_TYPEINFO_OFFSET);
   /* Indirect through the typeinfo pointer and retrieve the pointer
    * to the string name */
-  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
+  coreptr = *(CORE_ADDR *) (value_contents (vp));
   if (!coreptr)
-    error ("Retrieved null typeinfo pointer in trying to determine "
-           "run-time type");
+    error (_("Retrieved null typeinfo pointer in trying to determine "
+           "run-time type"));
   /* 4 -> offset of name field */
-  vp = value_at (builtin_type_int, coreptr + 4, VALUE_BFD_SECTION (v));
+  vp = value_at (builtin_type_int, coreptr + 4);
   /* FIXME possible 32x64 problem */
 
-  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
+  coreptr = *(CORE_ADDR *) (value_contents (vp));
 
   read_memory_string (coreptr, rtti_type_name, 256);
 
   if (strlen (rtti_type_name) == 0)
-    error ("Retrieved null type name from typeinfo");
+    error (_("Retrieved null type name from typeinfo"));
 
   /* search for type */
   rtti_type = lookup_typename (rtti_type_name, (struct block *) 0, 1);
 
   if (!rtti_type)
-    error ("Could not find run-time type: invalid type name %s in typeinfo??",
+    error (_("Could not find run-time type: invalid type name %s in typeinfo??"),
            rtti_type_name);
   CHECK_TYPEDEF (rtti_type);
 #if 0
@@ -278,18 +278,15 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
        ||
        /* Or we checked on the embedded object and top offset was the
           same as the embedded offset */
-       ((top_offset == VALUE_EMBEDDED_OFFSET (v)) &&
+       ((top_offset == value_embedded_offset (v)) &&
         !using_enclosing &&
-        TYPE_LENGTH (VALUE_ENCLOSING_TYPE (v)) == TYPE_LENGTH (rtti_type))))
+        TYPE_LENGTH (value_enclosing_type (v)) == TYPE_LENGTH (rtti_type))))
 
     *full = 1;
 
   return rtti_type;
 }
 
-extern int gnuv2_baseclass_offset (struct type *type, int index,
-                                  char *valaddr, CORE_ADDR address);
-
 static void
 init_hpacc_ops (void)
 {
@@ -309,6 +306,7 @@ init_hpacc_ops (void)
   hpacc_abi_ops.baseclass_offset = gnuv2_baseclass_offset;
 }
 
+extern initialize_file_ftype _initialize_hpacc_abi; /* -Wmissing-prototypes */
 
 void
 _initialize_hpacc_abi (void)
@@ -324,5 +322,5 @@ _initialize_hpacc_abi (void)
   regcomp (&operator_pattern,
           "^This will never match anything, please fill it in$", REG_NOSUB);
 
-  register_cp_abi (hpacc_abi_ops);
+  register_cp_abi (&hpacc_abi_ops);
 }
This page took 0.026202 seconds and 4 git commands to generate.