AArch64: Racy: Don't set empty set of hardware BPs/WPs on new thread
[deliverable/binutils-gdb.git] / gdb / nat / aarch64-linux-hw-point.c
index 18b5af2d49b7989c7d339bd964c942c1aca7da67..b446e198310160d5200ac6e69f91007de135d6c2 100644 (file)
@@ -717,6 +717,26 @@ aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state,
     }
 }
 
+/* See nat/aarch64-linux-hw-point.h.  */
+
+bool
+aarch64_linux_any_set_debug_regs_state (aarch64_debug_reg_state *state,
+                                       bool watchpoint)
+{
+  int count = watchpoint ? aarch64_num_wp_regs : aarch64_num_bp_regs;
+  if (count == 0)
+    return false;
+
+  const CORE_ADDR *addr = watchpoint ? state->dr_addr_wp : state->dr_addr_bp;
+  const unsigned int *ctrl = watchpoint ? state->dr_ctrl_wp : state->dr_ctrl_bp;
+
+  for (int i = 0; i < count; i++)
+    if (addr[i] != 0 || ctrl[i] != 0)
+      return true;
+
+  return false;
+}
+
 /* Print the values of the cached breakpoint/watchpoint registers.  */
 
 void
This page took 0.025622 seconds and 4 git commands to generate.