]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/findvar.c
Fix powerpc-power8.exp test with new mnemonics
[thirdparty/binutils-gdb.git] / gdb / findvar.c
index 7e9dab567f64ea0bcf809f3f2e7efb10d8578e0e..fcd97191c14543148db5697f71c5308095f1b6fb 100644 (file)
@@ -1,6 +1,6 @@
 /* Find a variable's value in memory, for GDB, the GNU debugger.
 
-   Copyright (C) 1986-2020 Free Software Foundation, Inc.
+   Copyright (C) 1986-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -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
@@ -362,7 +362,7 @@ symbol_read_needs (struct symbol *sym)
   switch (SYMBOL_CLASS (sym))
     {
       /* All cases listed explicitly so that gcc -Wall will detect it if
-         we failed to consider one.  */
+        we failed to consider one.  */
     case LOC_COMPUTED:
       gdb_assert_not_reached (_("LOC_COMPUTED variable missing a method"));
 
@@ -380,8 +380,8 @@ symbol_read_needs (struct symbol *sym)
 
     case LOC_LABEL:
       /* Getting the address of a label can be done independently of the block,
-         even if some *uses* of that address wouldn't work so well without
-         the right frame.  */
+        even if some *uses* of that address wouldn't work so well without
+        the right frame.  */
 
     case LOC_BLOCK:
     case LOC_CONST_BYTES:
@@ -608,7 +608,7 @@ language_defn::read_var_value (struct symbol *var,
   sym_need = symbol_read_needs (var);
   if (sym_need == SYMBOL_NEEDS_FRAME)
     gdb_assert (frame != NULL);
-  else if (sym_need == SYMBOL_NEEDS_REGISTERS && !target_has_registers)
+  else if (sym_need == SYMBOL_NEEDS_REGISTERS && !target_has_registers ())
     error (_("Cannot read `%s' without registers"), var->print_name ());
 
   if (frame != NULL)
@@ -638,11 +638,9 @@ language_defn::read_var_value (struct symbol *var,
       v = allocate_value (type);
       if (overlay_debugging)
        {
-         addr
-           = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
-                                       SYMBOL_OBJ_SECTION (symbol_objfile (var),
-                                                           var));
-
+         struct objfile *var_objfile = symbol_objfile (var);
+         addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
+                                          var->obj_section (var_objfile));
          store_typed_address (value_contents_raw (v), type, addr);
        }
       else
@@ -665,9 +663,9 @@ language_defn::read_var_value (struct symbol *var,
 
     case LOC_STATIC:
       if (overlay_debugging)
-       addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
-                                        SYMBOL_OBJ_SECTION (symbol_objfile (var),
-                                                            var));
+       addr
+         = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
+                                     var->obj_section (symbol_objfile (var)));
       else
        addr = SYMBOL_VALUE_ADDRESS (var);
       break;
@@ -709,7 +707,7 @@ language_defn::read_var_value (struct symbol *var,
       if (overlay_debugging)
        addr = symbol_overlayed_address
          (BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (var)),
-          SYMBOL_OBJ_SECTION (symbol_objfile (var), var));
+          var->obj_section (symbol_objfile (var)));
       else
        addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (var));
       break;
@@ -729,7 +727,7 @@ language_defn::read_var_value (struct symbol *var,
 
            if (regval == NULL)
              error (_("Value of register variable not available for `%s'."),
-                    var->print_name ());
+                    var->print_name ());
 
            addr = value_as_address (regval);
          }
@@ -739,7 +737,7 @@ language_defn::read_var_value (struct symbol *var,
 
            if (regval == NULL)
              error (_("Value of register variable not available for `%s'."),
-                    var->print_name ());
+                    var->print_name ());
            return regval;
          }
       }
@@ -777,7 +775,7 @@ language_defn::read_var_value (struct symbol *var,
            error (_("Missing %s symbol \"%s\"."),
                   flavour_name, var->linkage_name ());
          }
-       obj_section = MSYMBOL_OBJ_SECTION (lookup_data.result.objfile, msym);
+       obj_section = msym->obj_section (lookup_data.result.objfile);
        /* Relocate address, unless there is no section or the variable is
           a TLS variable. */
        if (obj_section == NULL
@@ -826,7 +824,7 @@ read_var_value (struct symbol *var, const struct block *var_block,
 
 struct value *
 default_value_from_register (struct gdbarch *gdbarch, struct type *type,
-                             int regnum, struct frame_id frame_id)
+                            int regnum, struct frame_id frame_id)
 {
   int len = TYPE_LENGTH (type);
   struct value *value = allocate_value (type);
@@ -890,7 +888,7 @@ read_frame_register_value (struct value *value, struct frame_info *frame)
       int reg_len = type_length_units (value_type (regval)) - reg_offset;
 
       /* If the register length is larger than the number of bytes
-         remaining to copy, then only copy the appropriate bytes.  */
+        remaining to copy, then only copy the appropriate bytes.  */
       if (reg_len > len)
        reg_len = len;
 
@@ -917,12 +915,12 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
       int optim, unavail, ok;
 
       /* The ISA/ABI need to something weird when obtaining the
-         specified value from this register.  It might need to
-         re-order non-adjacent, starting with REGNUM (see MIPS and
-         i386).  It might need to convert the [float] register into
-         the corresponding [integer] type (see Alpha).  The assumption
-         is that gdbarch_register_to_value populates the entire value
-         including the location.  */
+        specified value from this register.  It might need to
+        re-order non-adjacent, starting with REGNUM (see MIPS and
+        i386).  It might need to convert the [float] register into
+        the corresponding [integer] type (see Alpha).  The assumption
+        is that gdbarch_register_to_value populates the entire value
+        including the location.  */
       v = allocate_value (type);
       VALUE_LVAL (v) = lval_register;
       VALUE_NEXT_FRAME_ID (v) = get_frame_id (get_next_frame_sentinel_okay (frame));