aboutsummaryrefslogtreecommitdiff
path: root/gdb/ppc-linux-nat.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-03-24 18:08:12 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-03-24 18:08:24 -0400
commit328d42d87e97c75d6e52800bfd4bc1bfdfb745d2 (patch)
tree4dee500fe0bf6acd7dcb8153aabebaa27936c564 /gdb/ppc-linux-nat.c
parentd777bf0df22f1048fd24999ae563e30abcbcfbe7 (diff)
downloadgdb-328d42d87e97c75d6e52800bfd4bc1bfdfb745d2.zip
gdb-328d42d87e97c75d6e52800bfd4bc1bfdfb745d2.tar.gz
gdb-328d42d87e97c75d6e52800bfd4bc1bfdfb745d2.tar.bz2
gdb: remove current_top_target function
The current_top_target function is a hidden dependency on the current inferior. Since I'd like to slowly move towards reducing our dependency on the global current state, remove this function and make callers use current_inferior ()->top_target () There is no expected change in behavior, but this one step towards making those callers use the inferior from their context, rather than refer to the global current inferior. gdb/ChangeLog: * target.h (current_top_target): Remove, make callers use the current inferior instead. * target.c (current_top_target): Remove. Change-Id: Iccd457036f84466cdaa3865aa3f9339a24ea001d
Diffstat (limited to 'gdb/ppc-linux-nat.c')
-rw-r--r--gdb/ppc-linux-nat.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index f1ba165..171f5b3 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1967,8 +1967,8 @@ ppc_linux_nat_target::read_description ()
features.wordsize = ppc_linux_target_wordsize (tid);
- CORE_ADDR hwcap = linux_get_hwcap (current_top_target ());
- CORE_ADDR hwcap2 = linux_get_hwcap2 (current_top_target ());
+ CORE_ADDR hwcap = linux_get_hwcap (current_inferior ()->top_target ());
+ CORE_ADDR hwcap2 = linux_get_hwcap2 (current_inferior ()->top_target ());
if (have_ptrace_getsetvsxregs
&& (hwcap & PPC_FEATURE_HAS_VSX))
@@ -2125,7 +2125,8 @@ 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_top_target ()) & PPC_FEATURE_BOOKE)
+ && (linux_get_hwcap (current_inferior ()->top_target ())
+ & PPC_FEATURE_BOOKE))
return 2;
/* Check if the processor provides DAWR interface. */
if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR)
@@ -2153,7 +2154,8 @@ 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_top_target ()) & PPC_FEATURE_BOOKE)
+ if (((linux_get_hwcap (current_inferior ()->top_target ())
+ & PPC_FEATURE_BOOKE)
&& (addr + len) > (addr & ~3) + 4)
|| (addr + len) > (addr & ~7) + 8)
return 0;
@@ -2640,7 +2642,8 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
long wp_value;
long read_mode, write_mode;
- if (linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
+ if (linux_get_hwcap (current_inferior ()->top_target ())
+ & PPC_FEATURE_BOOKE)
{
/* PowerPC 440 requires only the read/write flags to be passed
to the kernel. */
@@ -3013,9 +3016,11 @@ ppc_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
int mask;
if (m_dreg_interface.hwdebug_p ()
- && linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
+ && (linux_get_hwcap (current_inferior ()->top_target ())
+ & PPC_FEATURE_BOOKE))
return start <= addr && start + length >= addr;
- else if (linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
+ else if (linux_get_hwcap (current_inferior ()->top_target ())
+ & PPC_FEATURE_BOOKE)
mask = 3;
else
mask = 7;