From 4bd817e71eefd659f51ec75bfb13109c486e8311 Mon Sep 17 00:00:00 2001 From: John Baldwin <jhb@FreeBSD.org> 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. --- gdbserver/configure.srv | 1 + gdbserver/linux-aarch64-low.cc | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'gdbserver') diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv index 6e09b0e..d370536 100644 --- a/gdbserver/configure.srv +++ b/gdbserver/configure.srv @@ -39,6 +39,7 @@ fi case "${gdbserver_host}" in aarch64*-*-linux*) srv_tgtobj="linux-aarch64-low.o" + srv_tgtobj="$srv_tgtobj nat/aarch64-hw-point.o" srv_tgtobj="$srv_tgtobj nat/aarch64-linux-hw-point.o" srv_tgtobj="$srv_tgtobj linux-aarch32-low.o" srv_tgtobj="$srv_tgtobj linux-aarch32-tdesc.o" diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index aef69b3..0091f99 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -413,9 +413,10 @@ aarch64_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr, if (targ_type != hw_execute) { - if (aarch64_linux_region_ok_for_watchpoint (addr, len)) + if (aarch64_region_ok_for_watchpoint (addr, len)) ret = aarch64_handle_watchpoint (targ_type, addr, len, - 1 /* is_insert */, state); + 1 /* is_insert */, + current_lwp_ptid (), state); else ret = -1; } @@ -429,7 +430,8 @@ aarch64_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr, len = 2; } ret = aarch64_handle_breakpoint (targ_type, addr, len, - 1 /* is_insert */, state); + 1 /* is_insert */, current_lwp_ptid (), + state); } if (show_debug_regs) @@ -464,7 +466,7 @@ aarch64_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, if (targ_type != hw_execute) ret = aarch64_handle_watchpoint (targ_type, addr, len, 0 /* is_insert */, - state); + current_lwp_ptid (), state); else { if (len == 3) @@ -475,7 +477,8 @@ aarch64_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, len = 2; } ret = aarch64_handle_breakpoint (targ_type, addr, len, - 0 /* is_insert */, state); + 0 /* is_insert */, current_lwp_ptid (), + state); } if (show_debug_regs) -- cgit v1.1