diff options
-rw-r--r-- | gdb/aarch64-linux-nat.c | 6 | ||||
-rw-r--r-- | gdb/aarch64-linux-tdep.c | 6 | ||||
-rw-r--r-- | gdb/arm-fbsd-nat.c | 2 | ||||
-rw-r--r-- | gdb/arm-fbsd-tdep.c | 25 | ||||
-rw-r--r-- | gdb/arm-fbsd-tdep.h | 12 | ||||
-rw-r--r-- | gdb/arm-linux-nat.c | 2 | ||||
-rw-r--r-- | gdb/arm-linux-tdep.c | 3 | ||||
-rw-r--r-- | gdb/auxv.c | 94 | ||||
-rw-r--r-- | gdb/auxv.h | 22 | ||||
-rw-r--r-- | gdb/elfread.c | 2 | ||||
-rw-r--r-- | gdb/fbsd-tdep.c | 7 | ||||
-rw-r--r-- | gdb/linux-tdep.c | 58 | ||||
-rw-r--r-- | gdb/linux-tdep.h | 26 | ||||
-rw-r--r-- | gdb/ppc-linux-nat.c | 19 | ||||
-rw-r--r-- | gdb/ppc-linux-tdep.c | 3 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 3 | ||||
-rw-r--r-- | gdb/s390-linux-nat.c | 2 | ||||
-rw-r--r-- | gdb/s390-linux-tdep.c | 3 | ||||
-rw-r--r-- | gdb/solib-svr4.c | 15 | ||||
-rw-r--r-- | gdb/sparc64-tdep.c | 6 |
20 files changed, 200 insertions, 116 deletions
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index eda79ec..caefcb3 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -781,8 +781,8 @@ aarch64_linux_nat_target::read_description () if (ret == 0) return aarch32_read_description (); - CORE_ADDR hwcap = linux_get_hwcap (this); - CORE_ADDR hwcap2 = linux_get_hwcap2 (this); + CORE_ADDR hwcap = linux_get_hwcap (); + CORE_ADDR hwcap2 = linux_get_hwcap2 (); aarch64_features features; features.vq = aarch64_sve_get_vq (tid); @@ -918,7 +918,7 @@ aarch64_linux_nat_target::thread_architecture (ptid_t ptid) bool aarch64_linux_nat_target::supports_memory_tagging () { - return (linux_get_hwcap2 (this) & HWCAP2_MTE) != 0; + return (linux_get_hwcap2 () & HWCAP2_MTE) != 0; } /* Implement the "fetch_memtags" target_ops method. */ diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 0954e21..476db5a 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -33,6 +33,7 @@ #include "target.h" #include "target/target.h" #include "expop.h" +#include "auxv.h" #include "regcache.h" #include "regset.h" @@ -779,8 +780,9 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd) { asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls"); - CORE_ADDR hwcap = linux_get_hwcap (target); - CORE_ADDR hwcap2 = linux_get_hwcap2 (target); + gdb::optional<gdb::byte_vector> auxv = target_read_auxv (target); + CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch); + CORE_ADDR hwcap2 = linux_get_hwcap2 (auxv, target, gdbarch); aarch64_features features; features.vq = aarch64_linux_core_read_vq (gdbarch, abfd); diff --git a/gdb/arm-fbsd-nat.c b/gdb/arm-fbsd-nat.c index b161b7e..bbd722e 100644 --- a/gdb/arm-fbsd-nat.c +++ b/gdb/arm-fbsd-nat.c @@ -122,7 +122,7 @@ arm_fbsd_nat_target::read_description () #ifdef PT_GETREGSET tls = have_regset (inferior_ptid, NT_ARM_TLS) != 0; #endif - desc = arm_fbsd_read_description_auxv (this, tls); + desc = arm_fbsd_read_description_auxv (tls); if (desc == NULL) desc = this->beneath ()->read_description (); return desc; diff --git a/gdb/arm-fbsd-tdep.c b/gdb/arm-fbsd-tdep.c index dabbceb..28fc73d 100644 --- a/gdb/arm-fbsd-tdep.c +++ b/gdb/arm-fbsd-tdep.c @@ -190,15 +190,17 @@ arm_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, &arm_fbsd_vfpregset, "VFP floating-point", cb_data); } -/* Lookup a target description from a target's AT_HWCAP auxiliary - vector. */ +/* See arm-fbsd-tdep.h. */ const struct target_desc * -arm_fbsd_read_description_auxv (struct target_ops *target, bool tls) +arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv, + target_ops *target, gdbarch *gdbarch, bool tls) { CORE_ADDR arm_hwcap = 0; - if (target_auxv_search (target, AT_FREEBSD_HWCAP, &arm_hwcap) != 1) + if (!auxv.has_value () + || target_auxv_search (*auxv, target, gdbarch, AT_FREEBSD_HWCAP, + &arm_hwcap) != 1) return arm_read_description (ARM_FP_TYPE_NONE, tls); if (arm_hwcap & HWCAP_VFP) @@ -215,6 +217,18 @@ arm_fbsd_read_description_auxv (struct target_ops *target, bool tls) return arm_read_description (ARM_FP_TYPE_NONE, tls); } +/* See arm-fbsd-tdep.h. */ + +const struct target_desc * +arm_fbsd_read_description_auxv (bool tls) +{ + gdb::optional<gdb::byte_vector> auxv = target_read_auxv (); + return arm_fbsd_read_description_auxv (auxv, + current_inferior ()->top_target (), + current_inferior ()->gdbarch, + tls); +} + /* Implement the "core_read_description" gdbarch method. */ static const struct target_desc * @@ -224,7 +238,8 @@ arm_fbsd_core_read_description (struct gdbarch *gdbarch, { asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls"); - return arm_fbsd_read_description_auxv (target, tls != nullptr); + gdb::optional<gdb::byte_vector> auxv = target_read_auxv (target); + return arm_fbsd_read_description_auxv (auxv, target, gdbarch, tls != nullptr); } /* Implement the get_thread_local_address gdbarch method. */ diff --git a/gdb/arm-fbsd-tdep.h b/gdb/arm-fbsd-tdep.h index 193eb76..85d7b59 100644 --- a/gdb/arm-fbsd-tdep.h +++ b/gdb/arm-fbsd-tdep.h @@ -42,7 +42,17 @@ extern const struct regset arm_fbsd_vfpregset; #define HWCAP_VFPv3 0x00002000 #define HWCAP_VFPD32 0x00080000 +/* Lookup a target description based on the AT_HWCAP value in the auxv data + AUXV. */ + +extern const struct target_desc * + arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv, + target_ops *target, gdbarch *gdbarch, + bool tls); + +/* Same as the above, but read the auxv data from the current inferior. */ + extern const struct target_desc * -arm_fbsd_read_description_auxv (struct target_ops *target, bool tls); + arm_fbsd_read_description_auxv (bool tls); #endif /* ARM_FBSD_TDEP_H */ diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 0188c78..a8b582f 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -531,7 +531,7 @@ ps_get_thread_area (struct ps_prochandle *ph, const struct target_desc * arm_linux_nat_target::read_description () { - CORE_ADDR arm_hwcap = linux_get_hwcap (this); + CORE_ADDR arm_hwcap = linux_get_hwcap (); if (have_ptrace_getregset == TRIBOOL_UNKNOWN) { diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 86ab579..65343f6 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -732,7 +732,8 @@ arm_linux_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd) { - CORE_ADDR arm_hwcap = linux_get_hwcap (target); + gdb::optional<gdb::byte_vector> auxv = target_read_auxv (target); + CORE_ADDR arm_hwcap = linux_get_hwcap (auxv, target, gdbarch); if (arm_hwcap & HWCAP_VFP) { @@ -307,23 +307,21 @@ svr4_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr, /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR. - Use the auxv_parse method from the current inferior's gdbarch, if defined, - else use the current inferior's target stack's auxv_parse. + Use the auxv_parse method from GDBARCH, if defined, else use the auxv_parse + method of OPS. Return 0 if *READPTR is already at the end of the buffer. Return -1 if there is insufficient buffer for a whole entry. Return 1 if an entry was read into *TYPEP and *VALP. */ + static int -parse_auxv (const gdb_byte **readptr, const gdb_byte *endptr, CORE_ADDR *typep, - CORE_ADDR *valp) +parse_auxv (target_ops *ops, gdbarch *gdbarch, const gdb_byte **readptr, + const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp) { - struct gdbarch *gdbarch = target_gdbarch(); - if (gdbarch_auxv_parse_p (gdbarch)) return gdbarch_auxv_parse (gdbarch, readptr, endptr, typep, valp); - return current_inferior ()->top_target ()->auxv_parse (readptr, endptr, - typep, valp); + return ops->auxv_parse (readptr, endptr, typep, valp); } @@ -354,45 +352,45 @@ invalidate_auxv_cache (void) invalidate_auxv_cache_inf (current_inferior ()); } -/* Fetch the auxv object from inferior INF. If auxv is cached already, - return a pointer to the cache. If not, fetch the auxv object from the - target and cache it. This function always returns a valid INFO pointer. */ +/* See auxv.h. */ -static struct auxv_info * -get_auxv_inferior_data (struct target_ops *ops) +gdb::optional<gdb::byte_vector> +target_read_auxv () { - struct auxv_info *info; - struct inferior *inf = current_inferior (); + inferior *inf = current_inferior (); + auxv_info *info = auxv_inferior_data.get (inf); - info = auxv_inferior_data.get (inf); - if (info == NULL) + if (info == nullptr) { info = auxv_inferior_data.emplace (inf); - info->data = target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL); + info->data = target_read_alloc (inf->top_target (), TARGET_OBJECT_AUXV, + nullptr); } - return info; + return info->data; } -/* Extract the auxiliary vector entry with a_type matching MATCH. - Return zero if no such entry was found, or -1 if there was - an error getting the information. On success, return 1 after - storing the entry's value field in *VALP. */ -int -target_auxv_search (struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp) +/* See auxv.h. */ + +gdb::optional<gdb::byte_vector> +target_read_auxv (target_ops *ops) { - CORE_ADDR type, val; - auxv_info *info = get_auxv_inferior_data (ops); + return target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL); +} - if (!info->data) - return -1; +/* See auxv.h. */ - const gdb_byte *data = info->data->data (); +int +target_auxv_search (const gdb::byte_vector &auxv, target_ops *ops, + gdbarch *gdbarch, CORE_ADDR match, CORE_ADDR *valp) +{ + CORE_ADDR type, val; + const gdb_byte *data = auxv.data (); const gdb_byte *ptr = data; - size_t len = info->data->size (); + size_t len = auxv.size (); while (1) - switch (parse_auxv (&ptr, data + len, &type, &val)) + switch (parse_auxv (ops, gdbarch, &ptr, data + len, &type, &val)) { case 1: /* Here's an entry, check it. */ if (type == match) @@ -406,10 +404,21 @@ target_auxv_search (struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp) default: /* Bogosity. */ return -1; } - - /*NOTREACHED*/ } +/* See auxv.h. */ + +int +target_auxv_search (CORE_ADDR match, CORE_ADDR *valp) +{ + gdb::optional<gdb::byte_vector> auxv = target_read_auxv (); + + if (!auxv.has_value ()) + return -1; + + return target_auxv_search (*auxv, current_inferior ()->top_target (), + current_inferior ()->gdbarch, match, valp); +} /* Print the description of a single AUXV entry on the specified file. */ @@ -551,21 +560,23 @@ default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, /* Print the contents of the target's AUXV on the specified file. */ static int -fprint_target_auxv (struct ui_file *file, struct target_ops *ops) +fprint_target_auxv (struct ui_file *file) { struct gdbarch *gdbarch = target_gdbarch (); CORE_ADDR type, val; int ents = 0; - auxv_info *info = get_auxv_inferior_data (ops); + gdb::optional<gdb::byte_vector> auxv = target_read_auxv (); - if (!info->data) + if (!auxv.has_value ()) return -1; - const gdb_byte *data = info->data->data (); + const gdb_byte *data = auxv->data (); const gdb_byte *ptr = data; - size_t len = info->data->size (); + size_t len = auxv->size (); - while (parse_auxv (&ptr, data + len, &type, &val) > 0) + while (parse_auxv (current_inferior ()->top_target (), + current_inferior ()->gdbarch, + &ptr, data + len, &type, &val) > 0) { gdbarch_print_auxv_entry (gdbarch, file, type, val); ++ents; @@ -583,8 +594,7 @@ info_auxv_command (const char *cmd, int from_tty) error (_("The program has no auxiliary information now.")); else { - int ents = fprint_target_auxv (gdb_stdout, - current_inferior ()->top_target ()); + int ents = fprint_target_auxv (gdb_stdout); if (ents < 0) error (_("No auxiliary vector found, or failed reading it.")); @@ -46,13 +46,31 @@ extern int svr4_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr, const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp); -/* Extract the auxiliary vector entry with a_type matching MATCH. +/* Read auxv data from the current inferior's target stack. */ + +extern gdb::optional<gdb::byte_vector> target_read_auxv (); + +/* Read auxv data from OPS. */ + +extern gdb::optional<gdb::byte_vector> target_read_auxv (target_ops *ops); + +/* Search AUXV for an entry with a_type matching MATCH. + + OPS and GDBARCH are the target and architecture to use to parse auxv entries. + Return zero if no such entry was found, or -1 if there was an error getting the information. On success, return 1 after storing the entry's value field in *VALP. */ -extern int target_auxv_search (struct target_ops *ops, + +extern int target_auxv_search (const gdb::byte_vector &auxv, + target_ops *ops, gdbarch *gdbarch, CORE_ADDR match, CORE_ADDR *valp); +/* Same as the above, but read the auxv data from the current inferior. Use + the current inferior's top target and arch to parse auxv entries. */ + +extern int target_auxv_search (CORE_ADDR match, CORE_ADDR *valp); + /* Print a description of a single AUXV entry on the specified file. */ enum auxv_format { AUXV_FORMAT_DEC, AUXV_FORMAT_HEX, AUXV_FORMAT_STR }; diff --git a/gdb/elfread.c b/gdb/elfread.c index cea35fd..21d52f9 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -909,7 +909,7 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc) parameter. FUNCTION is the function entry address. ADDRESS may be a function descriptor. */ - target_auxv_search (current_inferior ()->top_target (), AT_HWCAP, &hwcap); + target_auxv_search (AT_HWCAP, &hwcap); hwcap_val = value_from_longest (builtin_type (gdbarch) ->builtin_unsigned_long, hwcap); address_val = call_function_by_hand (function, NULL, hwcap_val); diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index 309777c..8431caf 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -2308,9 +2308,7 @@ fbsd_vmmap_length (struct gdbarch *gdbarch, unsigned char *entries, size_t len, static bool fbsd_vdso_range (struct gdbarch *gdbarch, struct mem_range *range) { - struct target_ops *ops = current_inferior ()->top_target (); - - if (target_auxv_search (ops, AT_FREEBSD_KPRELOAD, &range->start) <= 0) + if (target_auxv_search (AT_FREEBSD_KPRELOAD, &range->start) <= 0) return false; if (!target_has_execution ()) @@ -2337,7 +2335,8 @@ fbsd_vdso_range (struct gdbarch *gdbarch, struct mem_range *range) { /* Fetch the list of address space entries from the running target. */ gdb::optional<gdb::byte_vector> buf = - target_read_alloc (ops, TARGET_OBJECT_FREEBSD_VMMAP, nullptr); + target_read_alloc (current_inferior ()->top_target (), + TARGET_OBJECT_FREEBSD_VMMAP, nullptr); if (!buf || buf->empty ()) return false; diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index adf5180..dccb45d 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -417,10 +417,9 @@ int linux_is_uclinux (void) { CORE_ADDR dummy; - target_ops *target = current_inferior ()->top_target (); - return (target_auxv_search (target, AT_NULL, &dummy) > 0 - && target_auxv_search (target, AT_PAGESZ, &dummy) == 0); + return (target_auxv_search (AT_NULL, &dummy) > 0 + && target_auxv_search (AT_PAGESZ, &dummy) == 0); } static int @@ -2379,8 +2378,7 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range) char filename[100]; long pid; - if (target_auxv_search (current_inferior ()->top_target (), - AT_SYSINFO_EHDR, &range->start) <= 0) + if (target_auxv_search (AT_SYSINFO_EHDR, &range->start) <= 0) return 0; /* It doesn't make sense to access the host's /proc when debugging a @@ -2570,8 +2568,7 @@ linux_displaced_step_location (struct gdbarch *gdbarch) local-store address and is thus not usable as displaced stepping location. The auxiliary vector gets us the PowerPC-side entry point address instead. */ - if (target_auxv_search (current_inferior ()->top_target (), - AT_ENTRY, &addr) <= 0) + if (target_auxv_search (AT_ENTRY, &addr) <= 0) throw_error (NOT_SUPPORTED_ERROR, _("Cannot find AT_ENTRY auxiliary vector entry.")); @@ -2658,13 +2655,15 @@ linux_displaced_step_restore_all_in_ptid (inferior *parent_inf, ptid_t ptid) per_inferior->disp_step_bufs->restore_in_ptid (ptid); } -/* See linux-tdep.h. */ +/* Helper for linux_get_hwcap and linux_get_hwcap2. */ -CORE_ADDR -linux_get_hwcap (struct target_ops *target) +static CORE_ADDR +linux_get_hwcap_helper (const gdb::optional<gdb::byte_vector> &auxv, + target_ops *target, gdbarch *gdbarch, CORE_ADDR match) { CORE_ADDR field; - if (target_auxv_search (target, AT_HWCAP, &field) != 1) + if (!auxv.has_value () + || target_auxv_search (*auxv, target, gdbarch, match, &field) != 1) return 0; return field; } @@ -2672,12 +2671,39 @@ linux_get_hwcap (struct target_ops *target) /* See linux-tdep.h. */ CORE_ADDR -linux_get_hwcap2 (struct target_ops *target) +linux_get_hwcap (const gdb::optional<gdb::byte_vector> &auxv, + target_ops *target, gdbarch *gdbarch) { - CORE_ADDR field; - if (target_auxv_search (target, AT_HWCAP2, &field) != 1) - return 0; - return field; + return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP); +} + +/* See linux-tdep.h. */ + +CORE_ADDR +linux_get_hwcap () +{ + return linux_get_hwcap (target_read_auxv (), + current_inferior ()->top_target (), + current_inferior ()->gdbarch); +} + +/* See linux-tdep.h. */ + +CORE_ADDR +linux_get_hwcap2 (const gdb::optional<gdb::byte_vector> &auxv, + target_ops *target, gdbarch *gdbarch) +{ + return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP2); +} + +/* See linux-tdep.h. */ + +CORE_ADDR +linux_get_hwcap2 () +{ + return linux_get_hwcap2 (target_read_auxv (), + current_inferior ()->top_target (), + current_inferior ()->gdbarch); } /* Display whether the gcore command is using the diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h index bb907f2..95cc29c 100644 --- a/gdb/linux-tdep.h +++ b/gdb/linux-tdep.h @@ -90,13 +90,27 @@ extern void linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch, extern int linux_is_uclinux (void); -/* Fetch the AT_HWCAP entry from the auxv vector for the given TARGET. On - error, 0 is returned. */ -extern CORE_ADDR linux_get_hwcap (struct target_ops *target); +/* Fetch the AT_HWCAP entry from auxv data AUXV. Use TARGET and GDBARCH to + parse auxv entries. -/* Fetch the AT_HWCAP2 entry from the auxv vector for the given TARGET. On - error, 0 is returned. */ -extern CORE_ADDR linux_get_hwcap2 (struct target_ops *target); + On error, 0 is returned. */ +extern CORE_ADDR linux_get_hwcap (const gdb::optional<gdb::byte_vector> &auxv, + struct target_ops *target, gdbarch *gdbarch); + +/* Same as the above, but obtain all the inputs from the current inferior. */ + +extern CORE_ADDR linux_get_hwcap (); + +/* Fetch the AT_HWCAP2 entry from auxv data AUXV. Use TARGET and GDBARCH to + parse auxv entries. + + On error, 0 is returned. */ +extern CORE_ADDR linux_get_hwcap2 (const gdb::optional<gdb::byte_vector> &auxv, + struct target_ops *target, gdbarch *gdbarch); + +/* Same as the above, but obtain all the inputs from the current inferior. */ + +extern CORE_ADDR linux_get_hwcap2 (); /* Fetch (and possibly build) an appropriate `struct link_map_offsets' for ILP32 and LP64 Linux systems. */ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index dfa81e1..795bb29 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -1965,8 +1965,8 @@ ppc_linux_nat_target::read_description () features.wordsize = ppc_linux_target_wordsize (tid); - CORE_ADDR hwcap = linux_get_hwcap (current_inferior ()->top_target ()); - CORE_ADDR hwcap2 = linux_get_hwcap2 (current_inferior ()->top_target ()); + CORE_ADDR hwcap = linux_get_hwcap (); + CORE_ADDR hwcap2 = linux_get_hwcap2 (); if (have_ptrace_getsetvsxregs && (hwcap & PPC_FEATURE_HAS_VSX)) @@ -2123,8 +2123,7 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) takes two hardware watchpoints though. */ if (len > 1 && hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE - && (linux_get_hwcap (current_inferior ()->top_target ()) - & PPC_FEATURE_BOOKE)) + && (linux_get_hwcap () & PPC_FEATURE_BOOKE)) return 2; /* Check if the processor provides DAWR interface. */ if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR) @@ -2152,8 +2151,7 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) { gdb_assert (m_dreg_interface.debugreg_p ()); - if (((linux_get_hwcap (current_inferior ()->top_target ()) - & PPC_FEATURE_BOOKE) + if (((linux_get_hwcap () & PPC_FEATURE_BOOKE) && (addr + len) > (addr & ~3) + 4) || (addr + len) > (addr & ~7) + 8) return 0; @@ -2640,8 +2638,7 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len, long wp_value; long read_mode, write_mode; - if (linux_get_hwcap (current_inferior ()->top_target ()) - & PPC_FEATURE_BOOKE) + if (linux_get_hwcap () & PPC_FEATURE_BOOKE) { /* PowerPC 440 requires only the read/write flags to be passed to the kernel. */ @@ -3014,11 +3011,9 @@ ppc_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, int mask; if (m_dreg_interface.hwdebug_p () - && (linux_get_hwcap (current_inferior ()->top_target ()) - & PPC_FEATURE_BOOKE)) + && (linux_get_hwcap () & PPC_FEATURE_BOOKE)) return start <= addr && start + length >= addr; - else if (linux_get_hwcap (current_inferior ()->top_target ()) - & PPC_FEATURE_BOOKE) + else if (linux_get_hwcap () & PPC_FEATURE_BOOKE) mask = 3; else mask = 7; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 8fcfb42..12f418f 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1599,7 +1599,8 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch, if (vsx) features.vsx = true; - CORE_ADDR hwcap = linux_get_hwcap (target); + gdb::optional<gdb::byte_vector> auxv = target_read_auxv (target); + CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch); features.isa205 = ppc_linux_has_isa205 (hwcap); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 4f2233a..8b6d666 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -5503,8 +5503,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, return 0; case 1014: /* Data Cache Block set to Zero */ - if (target_auxv_search (current_inferior ()->top_target (), - AT_DCACHEBSIZE, &at_dcsz) <= 0 + if (target_auxv_search (AT_DCACHEBSIZE, &at_dcsz) <= 0 || at_dcsz == 0) at_dcsz = 128; /* Assume 128-byte cache line size (POWER8) */ diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c index 2b21e08..96833e8 100644 --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c @@ -1002,7 +1002,7 @@ s390_linux_nat_target::read_description () that mode, report s390 architecture with 64-bit GPRs. */ #ifdef __s390x__ { - CORE_ADDR hwcap = linux_get_hwcap (current_inferior ()->top_target ()); + CORE_ADDR hwcap = linux_get_hwcap (); have_regset_tdb = (hwcap & HWCAP_S390_TE) && check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset); diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index 1ead540..ef2ed85 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -332,7 +332,8 @@ s390_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd) { asection *section = bfd_get_section_by_name (abfd, ".reg"); - CORE_ADDR hwcap = linux_get_hwcap (target); + gdb::optional<gdb::byte_vector> auxv = target_read_auxv (target); + CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch); bool high_gprs, v1, v2, te, vx, gs; if (!section) diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index ce33f38..27267e0 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -428,14 +428,11 @@ read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr) int pt_phdr_p = 0; /* Get required auxv elements from target. */ - if (target_auxv_search (current_inferior ()->top_target (), - AT_PHDR, &at_phdr) <= 0) + if (target_auxv_search (AT_PHDR, &at_phdr) <= 0) return {}; - if (target_auxv_search (current_inferior ()->top_target (), - AT_PHENT, &at_phent) <= 0) + if (target_auxv_search (AT_PHENT, &at_phent) <= 0) return {}; - if (target_auxv_search (current_inferior ()->top_target (), - AT_PHNUM, &at_phnum) <= 0) + if (target_auxv_search (AT_PHNUM, &at_phnum) <= 0) return {}; if (!at_phdr || !at_phnum) return {}; @@ -2250,8 +2247,7 @@ enable_break (struct svr4_info *info, int from_tty) /* If we were not able to find the base address of the loader from our so_list, then try using the AT_BASE auxilliary entry. */ if (!load_addr_found) - if (target_auxv_search (current_inferior ()->top_target (), - AT_BASE, &load_addr) > 0) + if (target_auxv_search (AT_BASE, &load_addr) > 0) { int addr_bit = gdbarch_addr_bit (target_gdbarch ()); @@ -2479,8 +2475,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp) if ((bfd_get_file_flags (current_program_space->exec_bfd ()) & DYNAMIC) == 0) return 0; - if (target_auxv_search (current_inferior ()->top_target (), - AT_ENTRY, &entry_point) <= 0) + if (target_auxv_search (AT_ENTRY, &entry_point) <= 0) return 0; exec_displacement diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index bf4961a..25e8ce3 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -214,12 +214,10 @@ adi_available (void) return proc->stat.is_avail; proc->stat.checked_avail = true; - if (target_auxv_search (current_inferior ()->top_target (), - AT_ADI_BLKSZ, &value) <= 0) + if (target_auxv_search (AT_ADI_BLKSZ, &value) <= 0) return false; proc->stat.blksize = value; - target_auxv_search (current_inferior ()->top_target (), - AT_ADI_NBITS, &value); + target_auxv_search (AT_ADI_NBITS, &value); proc->stat.nbits = value; proc->stat.max_version = (1 << proc->stat.nbits) - 2; proc->stat.is_avail = true; |