gdb: rename get_type_arch to type::arch
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 28 Jan 2021 15:12:10 +0000 (10:12 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 28 Jan 2021 15:12:10 +0000 (10:12 -0500)
... and update all users.

gdb/ChangeLog:

* gdbtypes.h (get_type_arch): Rename to...
(struct type) <arch>: ... this, update all users.

Change-Id: I0e3ef938a0afe798ac0da74a9976bbd1d082fc6f

30 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/ada-valprint.c
gdb/breakpoint.c
gdb/c-lang.c
gdb/c-typeprint.c
gdb/c-valprint.c
gdb/cp-valprint.c
gdb/f-array-walker.h
gdb/f-lang.c
gdb/f-typeprint.c
gdb/f-valprint.c
gdb/findvar.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v3-abi.c
gdb/go-valprint.c
gdb/guile/scm-pretty-print.c
gdb/guile/scm-value.c
gdb/infcall.c
gdb/m2-valprint.c
gdb/p-valprint.c
gdb/printcmd.c
gdb/python/py-prettyprint.c
gdb/rust-lang.c
gdb/valarith.c
gdb/valops.c
gdb/valprint.c
gdb/value.c
gdb/varobj.c

index 88dfba7c5f0103029d885a7599d22b14073bd5a7..8a23b2129188ed7e047c70cc971707e55fe031a6 100644 (file)
@@ -1,3 +1,8 @@
+2021-01-28  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * gdbtypes.h (get_type_arch): Rename to...
+       (struct type) <arch>: ... this, update all users.
+
 2021-01-28  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * gdbtypes.h (struct type) <arch>: Rename to...
index d0baf5a183fb537a096fa0fe3e3a179bea455799..70296f97797ffaed0309b76a07853c15b0ad9186 100644 (file)
@@ -4525,13 +4525,12 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
 static CORE_ADDR
 value_pointer (struct value *value, struct type *type)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
   unsigned len = TYPE_LENGTH (type);
   gdb_byte *buf = (gdb_byte *) alloca (len);
   CORE_ADDR addr;
 
   addr = value_address (value);
-  gdbarch_address_to_pointer (gdbarch, type, buf, addr);
+  gdbarch_address_to_pointer (type->arch (), type, buf, addr);
   addr = extract_unsigned_integer (buf, len, type_byte_order (type));
   return addr;
 }
@@ -11234,7 +11233,7 @@ ada_is_system_address_type (struct type *type)
 static struct type *
 ada_scaling_type (struct type *type)
 {
-  return builtin_type (get_type_arch (type))->builtin_long_double;
+  return builtin_type (type->arch ())->builtin_long_double;
 }
 
 /* Assuming that TYPE is the representation of an Ada fixed-point
index b391ea0c0c92d0c0cd8add46f6d05228ef98ec08..8af9ef0012f9b13513cc1e4ced81e8f4ffa98ea1 100644 (file)
@@ -788,7 +788,7 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
             so we have to work-around this deficiency by handling
             System.Address values as a special case.  */
 
-         struct gdbarch *gdbarch = get_type_arch (type);
+         struct gdbarch *gdbarch = type->arch ();
          struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
          CORE_ADDR addr = extract_typed_address (valaddr, ptr_type);
 
index 70b0d88cb45aedcf24a389e6bbfcbee0c926a8c4..f318a125319e2843226ea0ffd0ab86924034bf7e 100644 (file)
@@ -1982,7 +1982,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
                  for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next))
                    ;
                  *tmp = loc;
-                 loc->gdbarch = get_type_arch (value_type (v));
+                 loc->gdbarch = value_type (v)->arch ();
 
                  loc->pspace = frame_pspace;
                  loc->address = address_significant (loc->gdbarch, addr);
index 91a04d78021769baa1fc4e7790e1ae65a1f5d60e..626dbc49a8a43829da764d9cee71254e784173ba 100644 (file)
@@ -149,7 +149,7 @@ c_emit_char (int c, struct type *type,
 {
   const char *encoding;
 
-  classify_type (type, get_type_arch (type), &encoding);
+  classify_type (type, type->arch (), &encoding);
   generic_emit_char (c, type, stream, quoter, encoding);
 }
 
@@ -161,7 +161,7 @@ language_defn::printchar (int c, struct type *type,
 {
   c_string_type str_type;
 
-  str_type = classify_type (type, get_type_arch (type), NULL);
+  str_type = classify_type (type, type->arch (), NULL);
   switch (str_type)
     {
     case C_CHAR:
@@ -199,7 +199,7 @@ c_printstr (struct ui_file *stream, struct type *type,
   const char *type_encoding;
   const char *encoding;
 
-  str_type = (classify_type (type, get_type_arch (type), &type_encoding)
+  str_type = (classify_type (type, type->arch (), &type_encoding)
              & ~C_CHAR);
   switch (str_type)
     {
@@ -279,7 +279,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
 
   if (! c_textual_element_type (element_type, 0))
     goto error;
-  classify_type (element_type, get_type_arch (element_type), charset);
+  classify_type (element_type, element_type->arch (), charset);
   width = TYPE_LENGTH (element_type);
 
   /* If the string lives in GDB's memory instead of the inferior's,
index 03612c05bab56a92b2f46a8c073c73aea4465502..b861aafbdc9b6a2a93eed9235c4219402d2e20a3 100644 (file)
@@ -528,7 +528,7 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
     }
 
   address_space_id
-    = address_space_type_instance_flags_to_name (get_type_arch (type),
+    = address_space_type_instance_flags_to_name (type->arch (),
                                                 type->instance_flags ());
   if (address_space_id)
     {
index f538cad0c67ea77dfd8de8af1a25871e2d5739df..9c82869525f7b4969bf5b295f6eafe78b90a7f94 100644 (file)
@@ -144,7 +144,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
                        const struct value_print_options *options)
 {
   int want_space = 0;
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
 
   if (elttype->code () == TYPE_CODE_FUNC)
     {
@@ -333,7 +333,6 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
     }
 
   struct type *type = check_typedef (value_type (val));
-  struct gdbarch *arch = get_type_arch (type);
   const gdb_byte *valaddr = value_contents_for_printing (val);
 
   if (options->vtblprint && cp_is_vtbl_ptr_type (type))
@@ -344,7 +343,7 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
         TYPE_CODE_STRUCT.)  */
       CORE_ADDR addr = extract_typed_address (valaddr, type);
 
-      print_function_pointer_address (options, arch, addr, stream);
+      print_function_pointer_address (options, type->arch (), addr, stream);
     }
   else
     {
@@ -373,13 +372,12 @@ c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
       /* Print vtable entry - we only get here if NOT using
         -fvtable_thunks.  (Otherwise, look under
         TYPE_CODE_PTR.)  */
-      struct gdbarch *gdbarch = get_type_arch (type);
       int offset = TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8;
       struct type *field_type = type->field (VTBL_FNADDR_OFFSET).type ();
       const gdb_byte *valaddr = value_contents_for_printing (val);
       CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type);
 
-      print_function_pointer_address (options, gdbarch, addr, stream);
+      print_function_pointer_address (options, type->arch (), addr, stream);
     }
   else
     cp_print_value_fields (val, stream, recurse, options, NULL, 0);
index 87a2d76bbc86181913c2382e1cc3466552570ca8..d303c83694da6e031377f049a121617e4686f1c2 100644 (file)
@@ -324,7 +324,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
                      i_offset += value_embedded_offset (val);
                      addr = extract_typed_address (valaddr + i_offset, i_type);
                      print_function_pointer_address (opts,
-                                                     get_type_arch (type),
+                                                     type->arch (),
                                                      addr, stream);
                    }
                }
index 9346820f99ee7fbdeee9051a25c54d239d26fe73..49a32be7530f69cd421668456fb8c52ad15067b6 100644 (file)
@@ -52,8 +52,8 @@ public:
       m_stride = type_length_units (elt_type);
     else
       {
-       struct gdbarch *arch = get_type_arch (elt_type);
-       int unit_size = gdbarch_addressable_memory_unit_size (arch);
+       int unit_size
+         = gdbarch_addressable_memory_unit_size (elt_type->arch ());
        m_stride /= (unit_size * 8);
       }
   };
index 832910969efee496800b44a29d4eb836d01f0de7..bd6ef20f9b12c295516b953fd2e169a191fc20f7 100644 (file)
@@ -82,7 +82,7 @@ f_language::get_encoding (struct type *type)
   switch (TYPE_LENGTH (type))
     {
     case 1:
-      encoding = target_charset (get_type_arch (type));
+      encoding = target_charset (type->arch ());
       break;
     case 4:
       if (type_byte_order (type) == BFD_ENDIAN_BIG)
@@ -1416,8 +1416,8 @@ fortran_adjust_dynamic_array_base_address_hack (struct type *type,
        stride = type_length_units (elt_type);
       else
        {
-         struct gdbarch *arch = get_type_arch (elt_type);
-         int unit_size = gdbarch_addressable_memory_unit_size (arch);
+         int unit_size
+           = gdbarch_addressable_memory_unit_size (elt_type->arch ());
          stride /= (unit_size * 8);
        }
 
index 6bf3705516052f1edf2a9d7ee6dd0cbc24bdc434..976fc387b5f3607e99083b02c918ff0df46e0624 100644 (file)
@@ -242,8 +242,8 @@ f_language::f_type_print_varspec_suffix (struct type *type,
          fprintf_filtered (stream, ") ");
        fprintf_filtered (stream, "(");
        if (nfields == 0 && type->is_prototyped ())
-         print_type (builtin_f_type (get_type_arch (type))->builtin_void,
-                       "", stream, -1, 0, 0);
+         print_type (builtin_f_type (type->arch ())->builtin_void,
+                     "", stream, -1, 0, 0);
        else
          for (i = 0; i < nfields; i++)
            {
@@ -342,8 +342,7 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream,
 
     case TYPE_CODE_VOID:
       {
-       gdbarch *gdbarch = get_type_arch (type);
-       struct type *void_type = builtin_f_type (gdbarch)->builtin_void;
+       struct type *void_type = builtin_f_type (type->arch ())->builtin_void;
        fprintf_filtered (stream, "%*s%s", level, "", void_type->name ());
       }
       break;
index 066827f21f2b35aeb1c9e371afd2cee3de8287d6..240daaf34f9cc8bfc8bef5b8a52806e1a3a285e5 100644 (file)
@@ -218,7 +218,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
                               const struct value_print_options *options) const
 {
   struct type *type = check_typedef (value_type (val));
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   int printed_field = 0; /* Number of fields printed.  */
   struct type *elttype;
   CORE_ADDR addr;
index 79f0ad23c8e604cebc3a75d6b8e41760d24651e0..6abcd3a946f06c0aa2112a36712146c215a6878d 100644 (file)
@@ -158,7 +158,7 @@ extract_typed_address (const gdb_byte *buf, struct type *type)
                    _("extract_typed_address: "
                    "type is not a pointer or reference"));
 
-  return gdbarch_pointer_to_address (get_type_arch (type), type, buf);
+  return gdbarch_pointer_to_address (type->arch (), type, buf);
 }
 
 /* All 'store' functions accept a host-format integer and store a
@@ -211,7 +211,7 @@ store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
                    _("store_typed_address: "
                    "type is not a pointer or reference"));
 
-  gdbarch_address_to_pointer (get_type_arch (type), type, buf, addr);
+  gdbarch_address_to_pointer (type->arch (), type, buf, addr);
 }
 
 /* Copy a value from SOURCE of size SOURCE_SIZE bytes to DEST of size DEST_SIZE
index 638c8a66af91b2c4ca720b2110163f7f0857be46..4dd1a6a64ec27590fefd49bd0f1a80fd2b9548d3 100644 (file)
@@ -232,24 +232,23 @@ alloc_type_copy (const struct type *type)
     return alloc_type_arch (type->arch_owner ());
 }
 
-/* If TYPE is gdbarch-associated, return that architecture.
-   If TYPE is objfile-associated, return that objfile's architecture.  */
+/* See gdbtypes.h.  */
 
-struct gdbarch *
-get_type_arch (const struct type *type)
+gdbarch *
+type::arch () const
 {
   struct gdbarch *arch;
 
-  if (type->is_objfile_owned ())
-    arch = type->objfile_owner ()->arch ();
+  if (this->is_objfile_owned ())
+    arch = this->objfile_owner ()->arch ();
   else
-    arch = type->arch_owner ();
+    arch = this->arch_owner ();
 
   /* The ARCH can be NULL if TYPE is associated with neither an objfile nor
      a gdbarch, however, this is very rare, and even then, in most cases
-     that get_type_arch is called, we assume that a non-NULL value is
+     that type::arch is called, we assume that a non-NULL value is
      returned.  */
-  gdb_assert (arch != NULL);
+  gdb_assert (arch != nullptr);
   return arch;
 }
 
@@ -273,8 +272,7 @@ get_target_type (struct type *type)
 unsigned int
 type_length_units (struct type *type)
 {
-  struct gdbarch *arch = get_type_arch (type);
-  int unit_size = gdbarch_addressable_memory_unit_size (arch);
+  int unit_size = gdbarch_addressable_memory_unit_size (type->arch ());
 
   return TYPE_LENGTH (type) / unit_size;
 }
@@ -291,7 +289,7 @@ alloc_type_instance (struct type *oldtype)
   /* Allocate the structure.  */
 
   if (!oldtype->is_objfile_owned ())
-    type = GDBARCH_OBSTACK_ZALLOC (get_type_arch (oldtype), struct type);
+    type = GDBARCH_OBSTACK_ZALLOC (oldtype->arch_owner (), struct type);
   else
     type = OBSTACK_ZALLOC (&oldtype->objfile_owner ()->objfile_obstack,
                           struct type);
@@ -371,8 +369,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
 
   /* FIXME!  Assumes the machine has only one representation for pointers!  */
 
-  TYPE_LENGTH (ntype)
-    = gdbarch_ptr_bit (get_type_arch (type)) / TARGET_CHAR_BIT;
+  TYPE_LENGTH (ntype) = gdbarch_ptr_bit (type->arch ()) / TARGET_CHAR_BIT;
   ntype->set_code (TYPE_CODE_PTR);
 
   /* Mark pointers as unsigned.  The target converts between pointers
@@ -455,8 +452,7 @@ make_reference_type (struct type *type, struct type **typeptr,
      references, and that it matches the (only) representation for
      pointers!  */
 
-  TYPE_LENGTH (ntype) =
-    gdbarch_ptr_bit (get_type_arch (type)) / TARGET_CHAR_BIT;
+  TYPE_LENGTH (ntype) = gdbarch_ptr_bit (type->arch ()) / TARGET_CHAR_BIT;
   ntype->set_code (refcode);
 
   *reftype = ntype;
@@ -1617,8 +1613,7 @@ smash_to_memberptr_type (struct type *type, struct type *self_type,
   set_type_self_type (type, self_type);
   /* Assume that a data member pointer is the same size as a normal
      pointer.  */
-  TYPE_LENGTH (type)
-    = gdbarch_ptr_bit (get_type_arch (to_type)) / TARGET_CHAR_BIT;
+  TYPE_LENGTH (type) = gdbarch_ptr_bit (to_type->arch ()) / TARGET_CHAR_BIT;
 }
 
 /* Smash TYPE to be a type of pointer to methods type TO_TYPE.
@@ -2228,7 +2223,7 @@ resolve_dynamic_range (struct type *dyn_range_type,
         I really don't think this is going to work with current GDB, the
         array indexing code in GDB seems to be pretty heavily tied to byte
         offsets right now.  Assuming 8 bits in a byte.  */
-      struct gdbarch *gdbarch = get_type_arch (dyn_range_type);
+      struct gdbarch *gdbarch = dyn_range_type->arch ();
       int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
       if (!byte_stride_p && (value % (unit_size * 8)) != 0)
        error (_("bit strides that are not a multiple of the byte size "
@@ -2903,7 +2898,7 @@ check_typedef (struct type *type)
          if (sym)
            TYPE_TARGET_TYPE (type) = SYMBOL_TYPE (sym);
          else                                  /* TYPE_CODE_UNDEF */
-           TYPE_TARGET_TYPE (type) = alloc_type_arch (get_type_arch (type));
+           TYPE_TARGET_TYPE (type) = alloc_type_arch (type->arch ());
        }
       type = TYPE_TARGET_TYPE (type);
 
@@ -3071,7 +3066,7 @@ safe_parse_type (struct gdbarch *gdbarch, const char *p, int length)
 static void
 check_stub_method (struct type *type, int method_id, int signature_id)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   struct fn_field *f;
   char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
   char *demangled_name = gdb_demangle (mangled_name,
@@ -3510,8 +3505,7 @@ type_align (struct type *type)
     return raw_align;
 
   /* Allow the architecture to provide an alignment.  */
-  struct gdbarch *arch = get_type_arch (type);
-  ULONGEST align = gdbarch_type_align (arch, type);
+  ULONGEST align = gdbarch_type_align (type->arch (), type);
   if (align != 0)
     return align;
 
@@ -3878,7 +3872,7 @@ is_unique_ancestor (struct type *base, struct value *val)
 enum bfd_endian
 type_byte_order (const struct type *type)
 {
-  bfd_endian byteorder = gdbarch_byte_order (get_type_arch (type));
+  bfd_endian byteorder = gdbarch_byte_order (type->arch ());
   if (type->endianity_is_not_default ())
     {
       if (byteorder == BFD_ENDIAN_BIG)
@@ -5505,7 +5499,7 @@ copy_type_recursive (struct objfile *objfile,
   if (*slot != NULL)
     return ((struct type_pair *) *slot)->newobj;
 
-  new_type = alloc_type_arch (get_type_arch (type));
+  new_type = alloc_type_arch (type->arch ());
 
   /* We must add the new type to the hash table immediately, in case
      we encounter this type again during a recursive call below.  */
@@ -5518,7 +5512,7 @@ copy_type_recursive (struct objfile *objfile,
      copy the entire thing and then update specific fields as needed.  */
   *TYPE_MAIN_TYPE (new_type) = *TYPE_MAIN_TYPE (type);
 
-  new_type->set_owner (get_type_arch (type));
+  new_type->set_owner (type->arch ());
 
   if (type->name ())
     new_type->set_name (xstrdup (type->name ()));
@@ -5844,10 +5838,8 @@ append_flags_type_field (struct type *type, int start_bitpos, int nr_bits,
 void
 append_flags_type_flag (struct type *type, int bitpos, const char *name)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
-
   append_flags_type_field (type, bitpos, 1,
-                          builtin_type (gdbarch)->builtin_bool,
+                          builtin_type (type->arch ())->builtin_bool,
                           name);
 }
 
index df3b84ba838af58970c43e466c658b6c8b3bf6d5..40b1aed031e70f303ff55377990fe6dbdc6fc4cf 100644 (file)
@@ -1282,6 +1282,13 @@ struct type
     return this->main_type->m_owner.gdbarch;
   }
 
+  /* Return the type's architecture.  For types owned by an
+     architecture, that architecture is returned.  For types owned by an
+     objfile, that objfile's architecture is returned.
+
+     The return value is always non-nullptr.  */
+  gdbarch *arch () const;
+
   /* * Return true if this is an integer type whose logical (bit) size
      differs from its storage size; false otherwise.  Always return
      false for non-integer (i.e., non-TYPE_SPECIFIC_INT) types.  */
@@ -2258,12 +2265,6 @@ extern struct type *alloc_type (struct objfile *);
 extern struct type *alloc_type_arch (struct gdbarch *);
 extern struct type *alloc_type_copy (const struct type *);
 
-/* * Return the type's architecture.  For types owned by an
-   architecture, that architecture is returned.  For types owned by an
-   objfile, that objfile's architecture is returned.  */
-
-extern struct gdbarch *get_type_arch (const struct type *);
-
 /* * This returns the target type (or NULL) of TYPE, also skipping
    past typedefs.  */
 
@@ -2661,9 +2662,9 @@ extern bool is_fixed_point_type (struct type *type);
 extern void allocate_fixed_point_type_info (struct type *type);
 
 /* * When the type includes explicit byte ordering, return that.
-   Otherwise, the byte ordering from gdbarch_byte_order for 
-   get_type_arch is returned.  */
-   
+   Otherwise, the byte ordering from gdbarch_byte_order for
+   the type's arch is returned.  */
+
 extern enum bfd_endian type_byte_order (const struct type *type);
 
 /* A flag to enable printing of debugging information of C++
index db1080db425fcf6e60508b4733514856812871ba..8461535c6ec928d2c1d075cff8cb88dea07aa453 100644 (file)
@@ -308,7 +308,7 @@ gnuv3_rtti_type (struct value *value,
     return NULL;
 
   /* Determine architecture.  */
-  gdbarch = get_type_arch (values_type);
+  gdbarch = values_type->arch ();
 
   if (using_enc_p)
     *using_enc_p = 0;
@@ -422,7 +422,7 @@ gnuv3_virtual_fn_field (struct value **value_p,
     error (_("Only classes can have virtual functions."));
 
   /* Determine architecture.  */
-  gdbarch = get_type_arch (values_type);
+  gdbarch = values_type->arch ();
 
   /* Cast our value to the base class which defines this virtual
      function.  This takes care of any necessary `this'
@@ -454,7 +454,7 @@ gnuv3_baseclass_offset (struct type *type, int index,
   long int cur_base_offset, base_offset;
 
   /* Determine architecture.  */
-  gdbarch = get_type_arch (type);
+  gdbarch = type->arch ();
   ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
 
   /* If it isn't a virtual base, this is easy.  The offset is in the
@@ -611,7 +611,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
                        struct ui_file *stream)
 {
   struct type *self_type = TYPE_SELF_TYPE (type);
-  struct gdbarch *gdbarch = get_type_arch (self_type);
+  struct gdbarch *gdbarch = self_type->arch ();
   CORE_ADDR ptr_value;
   LONGEST adjustment;
   int vbit;
@@ -691,9 +691,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
 static int
 gnuv3_method_ptr_size (struct type *type)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
-
-  return 2 * TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
+  return 2 * TYPE_LENGTH (builtin_type (type->arch ())->builtin_data_ptr);
 }
 
 /* GNU v3 implementation of cplus_make_method_ptr.  */
@@ -702,7 +700,7 @@ static void
 gnuv3_make_method_ptr (struct type *type, gdb_byte *contents,
                       CORE_ADDR value, int is_virtual)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
   enum bfd_endian byte_order = type_byte_order (type);
 
@@ -745,7 +743,7 @@ gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
   method_type = TYPE_TARGET_TYPE (check_typedef (value_type (method_ptr)));
 
   /* Extract the pointer to member.  */
-  gdbarch = get_type_arch (self_type);
+  gdbarch = self_type->arch ();
   vbit = gnuv3_decode_method_ptr (gdbarch, contents, &ptr_value, &adjustment);
 
   /* First convert THIS to match the containing type of the pointer to
@@ -978,7 +976,7 @@ gnuv3_print_vtable (struct value *value)
       type = check_typedef (value_type (value));
     }
 
-  gdbarch = get_type_arch (type);
+  gdbarch = type->arch ();
 
   vtable = NULL;
   if (type->code () == TYPE_CODE_STRUCT)
@@ -1107,7 +1105,7 @@ gnuv3_get_typeid (struct value *value)
 
   /* Ignore top-level cv-qualifiers.  */
   type = make_cv_type (0, 0, type, NULL);
-  gdbarch = get_type_arch (type);
+  gdbarch = type->arch ();
 
   type_name = type_to_string (type);
   if (type_name.empty ())
@@ -1161,7 +1159,7 @@ gnuv3_get_typeid (struct value *value)
 static std::string
 gnuv3_get_typename_from_type_info (struct value *type_info_ptr)
 {
-  struct gdbarch *gdbarch = get_type_arch (value_type (type_info_ptr));
+  struct gdbarch *gdbarch = value_type (type_info_ptr)->arch ();
   struct bound_minimal_symbol typeinfo_sym;
   CORE_ADDR addr;
   const char *symname;
index 73429c64f67a0e9c6db6f6e3406d32fe288dda4a..e04ea6b45faa1afc5c52394c0e304863add9f5fd 100644 (file)
@@ -43,7 +43,7 @@ print_go_string (struct type *type,
                 struct value *val,
                 const struct value_print_options *options)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   struct type *elt_ptr_type = type->field (0).type ();
   struct type *elt_type = TYPE_TARGET_TYPE (elt_ptr_type);
   LONGEST length;
index 2a1ee16281d3b14f7808ac0b261fe29baaa6e93e..605615e62937a5a01d4d3d77dac65698313e2e45 100644 (file)
@@ -949,7 +949,7 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
                                 const struct language_defn *language)
 {
   struct type *type = value_type (value);
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   SCM exception = SCM_BOOL_F;
   SCM printer = SCM_BOOL_F;
   SCM val_obj = SCM_BOOL_F;
index a71fb93d2e42d1e72740c1b6c172ca493ee2bfe3..59995169cd0529c28fb2a53f7757e3aebf20a3ce 100644 (file)
@@ -671,7 +671,7 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
       struct value *index
        = vlscm_convert_value_from_scheme (FUNC_NAME, SCM_ARG2, index_scm,
                                           &except_scm,
-                                          get_type_arch (type),
+                                          type->arch (),
                                           current_language);
       if (index == NULL)
        return except_scm;
index 7fb3a88d36b09fe9798dc7fe73eb9ace9347be98..2332f293a1e46d70064a049f6f60d237cdbce1ec 100644 (file)
@@ -251,7 +251,7 @@ find_function_addr (struct value *function,
                    struct type **function_type)
 {
   struct type *ftype = check_typedef (value_type (function));
-  struct gdbarch *gdbarch = get_type_arch (ftype);
+  struct gdbarch *gdbarch = ftype->arch ();
   struct type *value_type = NULL;
   /* Initialize it just to avoid a GCC false warning.  */
   CORE_ADDR funaddr = 0;
index c98454671be692c1aae692c22b85dc830a7060b4..be21cbb014a036ff88fc7c0d4c551a7f92c64644 100644 (file)
@@ -186,7 +186,7 @@ print_unpacked_pointer (struct type *type,
                        const struct value_print_options *options,
                        struct ui_file *stream)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
   int want_space = 0;
 
@@ -228,7 +228,7 @@ print_variable_at_address (struct type *type,
                           int recurse,
                           const struct value_print_options *options)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   CORE_ADDR addr = unpack_pointer (type, valaddr);
   struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
 
index c01685e8a0b12b4df67a9de71fd92760869b9912..9a52fe14ba8fec6544217410a1953f99897fbc20 100644 (file)
@@ -70,7 +70,7 @@ pascal_language::value_print_inner (struct value *val,
 
 {
   struct type *type = check_typedef (value_type (val));
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   enum bfd_endian byte_order = type_byte_order (type);
   unsigned int i = 0;  /* Number of characters printed */
   unsigned len;
index 2e56d28e9f497ce512c3038e7757a35c1c158c2d..332d971a05cd60ccdbf016dae013f6e08ddc62be 100644 (file)
@@ -304,7 +304,7 @@ print_formatted (struct value *val, int size,
          /* We often wrap here if there are long symbolic names.  */
          wrap_here ("    ");
          next_address = (value_address (val)
-                         + gdb_print_insn (get_type_arch (type),
+                         + gdb_print_insn (type->arch (),
                                            value_address (val), stream,
                                            &branch_delay_insns));
          return;
@@ -331,7 +331,7 @@ print_formatted (struct value *val, int size,
 static struct type *
 float_type_from_length (struct type *type)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   const struct builtin_type *builtin = builtin_type (gdbarch);
 
   if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_float))
@@ -353,7 +353,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
                        const struct value_print_options *options,
                        int size, struct ui_file *stream)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   unsigned int len = TYPE_LENGTH (type);
   enum bfd_endian byte_order = type_byte_order (type);
 
@@ -2370,7 +2370,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
 {
   const gdb_byte *str;
   size_t len;
-  struct gdbarch *gdbarch = get_type_arch (value_type (value));
+  struct gdbarch *gdbarch = value_type (value)->arch ();
   struct type *wctype = lookup_typename (current_language,
                                         "wchar_t", NULL, 0);
   int wcwidth = TYPE_LENGTH (wctype);
@@ -2438,7 +2438,7 @@ printf_floating (struct ui_file *stream, const char *format,
 {
   /* Parameter data.  */
   struct type *param_type = value_type (value);
-  struct gdbarch *gdbarch = get_type_arch (param_type);
+  struct gdbarch *gdbarch = param_type->arch ();
 
   /* Determine target type corresponding to the format string.  */
   struct type *fmt_type;
@@ -2644,8 +2644,7 @@ ui_printf (const char *arg, struct ui_file *stream)
            break;
          case wide_char_arg:
            {
-             struct gdbarch *gdbarch
-               = get_type_arch (value_type (val_args[i]));
+             struct gdbarch *gdbarch = value_type (val_args[i])->arch ();
              struct type *wctype = lookup_typename (current_language,
                                                     "wchar_t", NULL, 0);
              struct type *valtype;
index 3e6b14b249f7b21b135064dcab32dd81938c1934..7c0fdaa9e70315c10f099c5784401094010d6687 100644 (file)
@@ -564,7 +564,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
                                const struct language_defn *language)
 {
   struct type *type = value_type (value);
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   enum string_repr_result print_result;
 
   if (value_lazy (value))
index ca9a74903e80dd4d670403261474d6fbcad9fe4e..80f1f59dd64c2c9a8064a57857fb2df50b65f885 100644 (file)
@@ -516,7 +516,7 @@ rust_language::value_print_inner
               that.  */
            struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
            CORE_ADDR addr = value_as_address (val);
-           struct gdbarch *arch = get_type_arch (type);
+           struct gdbarch *arch = type->arch ();
 
            if (opts.addressprint)
              {
@@ -1919,7 +1919,7 @@ rust_language::emitchar (int ch, struct type *chtype,
 {
   if (!rust_chartype_p (chtype))
     generic_emit_char (ch, chtype, stream, quoter,
-                      target_charset (get_type_arch (chtype)));
+                      target_charset (chtype->arch ()));
   else if (ch == '\\' || ch == quoter)
     fprintf_filtered (stream, "\\%c", ch);
   else if (ch == '\n')
index 81d48aae82a6603088b7e72cf6f68b907ac01644..315030988f45a755b861eac0a6f89f3fa57dec06 100644 (file)
@@ -202,7 +202,7 @@ value_subscripted_rvalue (struct value *array, LONGEST index, LONGEST lowerbound
   LONGEST stride = array_type->bit_stride ();
   if (stride != 0)
     {
-      struct gdbarch *arch = get_type_arch (elt_type);
+      struct gdbarch *arch = elt_type->arch ();
       int unit_size = gdbarch_addressable_memory_unit_size (arch);
       elt_size = stride / (unit_size * 8);
     }
@@ -539,7 +539,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
 struct value *
 value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
 {
-  struct gdbarch *gdbarch = get_type_arch (value_type (arg1));
+  struct gdbarch *gdbarch = value_type (arg1)->arch ();
   char *ptr;
   char tstr[13], mangle_tstr[13];
   int static_memfuncp, nargs;
@@ -900,7 +900,7 @@ fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
   struct type *type2 = check_typedef (value_type (arg2));
   const struct language_defn *language = current_language;
 
-  struct gdbarch *gdbarch = get_type_arch (type1);
+  struct gdbarch *gdbarch = type1->arch ();
   struct value *val;
 
   gdb_mpq v1, v2, res;
@@ -1967,7 +1967,7 @@ value_complement (struct value *arg1)
 int
 value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   LONGEST low_bound, high_bound;
   LONGEST word;
   unsigned rel_index;
index d0d5628d11bcfb0111c346568560301cd9d6481b..fec821ad932c4d98d2a0e716a79439b32e48fbba 100644 (file)
@@ -590,7 +590,7 @@ value_cast (struct type *type, struct value *arg2)
         otherwise occur when dealing with a target having two byte
         pointers and four byte addresses.  */
 
-      int addr_bit = gdbarch_addr_bit (get_type_arch (type2));
+      int addr_bit = gdbarch_addr_bit (type2->arch ());
       LONGEST longest = value_as_long (arg2);
 
       if (addr_bit < sizeof (LONGEST) * HOST_CHAR_BIT)
@@ -1100,7 +1100,7 @@ value_assign (struct value *toval, struct value *fromval)
     {
     case lval_internalvar:
       set_internalvar (VALUE_INTERNALVAR (toval), fromval);
-      return value_of_internalvar (get_type_arch (type),
+      return value_of_internalvar (type->arch (),
                                   VALUE_INTERNALVAR (toval));
 
     case lval_internalvar_component:
index 2c3541e6686b506747204a13e06437175a71f7ae..340a329f9d0f9af334b7619d8091d80507b6865c 100644 (file)
@@ -408,7 +408,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
                        CORE_ADDR address, struct ui_file *stream,
                        const struct value_print_options *options)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
 
   if (elttype->code () == TYPE_CODE_FUNC)
     {
@@ -483,7 +483,7 @@ static void
 print_ref_address (struct type *type, const gdb_byte *address_buffer,
                  int embedded_offset, struct ui_file *stream)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
 
   if (address_buffer != NULL)
     {
@@ -673,7 +673,7 @@ generic_val_print_enum (struct type *type,
                        const struct value_print_options *options)
 {
   LONGEST val;
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
 
   gdb_assert (!options->format);
@@ -694,7 +694,7 @@ generic_val_print_func (struct type *type,
                        struct value *original_value,
                        const struct value_print_options *options)
 {
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
 
   gdb_assert (!options->format);
 
@@ -1182,7 +1182,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
                             + embedded_offset);
   ULONGEST val = unpack_long (type, valaddr);
   int field, nfields = type->num_fields ();
-  struct gdbarch *gdbarch = get_type_arch (type);
+  struct gdbarch *gdbarch = type->arch ();
   struct type *bool_type = builtin_type (gdbarch)->builtin_bool;
 
   fputs_filtered ("[", stream);
@@ -2713,7 +2713,7 @@ val_print_string (struct type *elttype, const char *encoding,
   unsigned int fetchlimit;     /* Maximum number of chars to print.  */
   int bytes_read;
   gdb::unique_xmalloc_ptr<gdb_byte> buffer;    /* Dynamically growable fetch buffer.  */
-  struct gdbarch *gdbarch = get_type_arch (elttype);
+  struct gdbarch *gdbarch = elttype->arch ();
   enum bfd_endian byte_order = type_byte_order (elttype);
   int width = TYPE_LENGTH (elttype);
 
index 3551b80ef9ebfac056c1afc0a249beb3e4016d9e..4135d5ec33939f80d16d431a9a2990f6a497ae08 100644 (file)
@@ -363,7 +363,7 @@ struct value
 struct gdbarch *
 get_value_arch (const struct value *value)
 {
-  return get_type_arch (value_type (value));
+  return value_type (value)->arch ();
 }
 
 int
@@ -2674,7 +2674,7 @@ value_as_long (struct value *val)
 CORE_ADDR
 value_as_address (struct value *val)
 {
-  struct gdbarch *gdbarch = get_type_arch (value_type (val));
+  struct gdbarch *gdbarch = value_type (val)->arch ();
 
   /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
      whether we want this to be true eventually.  */
index 085942c81d72a56337a6bb94ce9cee4346f30345..7928d90bef3959e95e905ac33cdd68fb80d90514 100644 (file)
@@ -2207,7 +2207,7 @@ varobj_value_get_print_value (struct value *value,
 
                          thevalue = std::string (s.get ());
                          len = thevalue.size ();
-                         gdbarch = get_type_arch (value_type (value));
+                         gdbarch = value_type (value)->arch ();
                          type = builtin_type (gdbarch)->builtin_char;
 
                          if (!string_print)
This page took 0.050288 seconds and 4 git commands to generate.