From 4bd817e71eefd659f51ec75bfb13109c486e8311 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 22 Mar 2022 12:05:43 -0700 Subject: nat: Split out platform-independent aarch64 debug register support. Move non-Linux-specific support for hardware break/watchpoints from nat/aarch64-linux-hw-point.c to nat/aarch64-hw-point.c. Changes beyond a simple split of the code are: - aarch64_linux_region_ok_for_watchpoint and aarch64_linux_any_set_debug_regs_state renamed to drop linux_ as they are not platform specific. - Platforms must implement the aarch64_notify_debug_reg_change function which is invoked from the platform-independent code when a debug register changes for a given debug register state. This does not use the indirection of a 'low' structure as is done for x86. - The handling for kernel_supports_any_contiguous_range is not pristine. For non-Linux it is simply defined to true. Some uses of this could perhaps be implemented as new 'low' routines for the various places that check it instead? - Pass down ptid into aarch64_handle_breakpoint and aarch64_handle_watchpoint rather than using current_lwp_ptid which is only defined on Linux. In addition, pass the ptid on to aarch64_notify_debug_reg_change instead of the unused state argument. --- gdb/aarch64-linux-nat.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'gdb/aarch64-linux-nat.c') diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index db76497..dd072d9 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -834,7 +834,8 @@ aarch64_linux_nat_target::insert_hw_breakpoint (struct gdbarch *gdbarch, "insert_hw_breakpoint on entry (addr=0x%08lx, len=%d))\n", (unsigned long) addr, len); - ret = aarch64_handle_breakpoint (type, addr, len, 1 /* is_insert */, state); + ret = aarch64_handle_breakpoint (type, addr, len, 1 /* is_insert */, + inferior_ptid, state); if (show_debug_regs) { @@ -866,7 +867,8 @@ aarch64_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, (gdb_stdlog, "remove_hw_breakpoint on entry (addr=0x%08lx, len=%d))\n", (unsigned long) addr, len); - ret = aarch64_handle_breakpoint (type, addr, len, 0 /* is_insert */, state); + ret = aarch64_handle_breakpoint (type, addr, len, 0 /* is_insert */, + inferior_ptid, state); if (show_debug_regs) { @@ -899,7 +901,8 @@ aarch64_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len, gdb_assert (type != hw_execute); - ret = aarch64_handle_watchpoint (type, addr, len, 1 /* is_insert */, state); + ret = aarch64_handle_watchpoint (type, addr, len, 1 /* is_insert */, + inferior_ptid, state); if (show_debug_regs) { @@ -931,7 +934,8 @@ aarch64_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len, gdb_assert (type != hw_execute); - ret = aarch64_handle_watchpoint (type, addr, len, 0 /* is_insert */, state); + ret = aarch64_handle_watchpoint (type, addr, len, 0 /* is_insert */, + inferior_ptid, state); if (show_debug_regs) { @@ -947,7 +951,7 @@ aarch64_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len, int aarch64_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) { - return aarch64_linux_region_ok_for_watchpoint (addr, len); + return aarch64_region_ok_for_watchpoint (addr, len); } /* Implement the "stopped_data_address" target_ops method. */ -- cgit v1.1