aboutsummaryrefslogtreecommitdiff
path: root/gdb/loongarch-linux-nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/loongarch-linux-nat.c')
-rw-r--r--gdb/loongarch-linux-nat.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/gdb/loongarch-linux-nat.c b/gdb/loongarch-linux-nat.c
index 8736287..fd3581b 100644
--- a/gdb/loongarch-linux-nat.c
+++ b/gdb/loongarch-linux-nat.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "cli/cli-cmds.h"
#include "elf/common.h"
#include "gregset.h"
#include "inferior.h"
@@ -607,17 +608,11 @@ loongarch_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p)
if (siginfo.si_signo != SIGTRAP || (siginfo.si_code & 0xffff) != TRAP_HWBKPT)
return false;
- /* Make sure to ignore the top byte, otherwise we may not recognize a
- hardware watchpoint hit. The stopped data addresses coming from the
- kernel can potentially be tagged addresses. */
- struct gdbarch *gdbarch = thread_architecture (inferior_ptid);
- const CORE_ADDR addr_trap
- = gdbarch_remove_non_address_bits (gdbarch, (CORE_ADDR) siginfo.si_addr);
-
/* Check if the address matches any watched address. */
state = loongarch_get_debug_reg_state (inferior_ptid.pid ());
- return loongarch_stopped_data_address (state, addr_trap, addr_p);
+ return
+ loongarch_stopped_data_address (state, (CORE_ADDR) siginfo.si_addr, addr_p);
}
/* Implement the "stopped_by_watchpoint" target_ops method. */
@@ -765,4 +760,19 @@ _initialize_loongarch_linux_nat ()
{
linux_target = &the_loongarch_linux_nat_target;
add_inf_child_target (&the_loongarch_linux_nat_target);
+
+ /* Add a maintenance command to enable printing the LoongArch internal
+ debug registers mirror variables. */
+ add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
+ &show_debug_regs, _("\
+Set whether to show the LoongArch debug registers state."), _("\
+Show whether to show the LoongArch debug registers state."), _("\
+Use \"on\" to enable, \"off\" to disable.\n\
+If enabled, the debug registers values are shown when GDB inserts\n\
+or removes a hardware breakpoint or watchpoint, and when the inferior\n\
+triggers a breakpoint or watchpoint."),
+ NULL,
+ NULL,
+ &maintenance_set_cmdlist,
+ &maintenance_show_cmdlist);
}