aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/linux-low.c
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2018-12-05 10:34:54 +0000
committerAlan Hayward <alan.hayward@arm.com>2018-12-05 10:44:03 +0000
commit754e31689866524049b9cfc68053ed4e1293cfac (patch)
tree846cc5cebcccac79c3fb9fcb8b5e5dad5f93b493 /gdb/gdbserver/linux-low.c
parent9af7cc783aebb975a487747e530030b47beeca09 (diff)
downloadbinutils-754e31689866524049b9cfc68053ed4e1293cfac.zip
binutils-754e31689866524049b9cfc68053ed4e1293cfac.tar.gz
binutils-754e31689866524049b9cfc68053ed4e1293cfac.tar.bz2
AArch64: Racy: Don't set empty set of hardware BPs/WPs on new thread
On some heavily loaded AArch64 boxes, GDB will sometimes hang forever when the inferior creates a thread. This hang happens inside the kernel during the ptrace call to set hardware watchpoints or hardware breakpoints. Currently, GDB will always set hw wp/bp at the start of each thread even if there are none set in the process. This patch works around the issue by avoiding setting hw wp/bp if there are none set for the process. On an effected machine, this fix drastically reduces the racy nature of the gdb.threads test set. I ran the entire gdb test suite across all processors for 100 iterations, then ran the results through the racy tests script. Without the patch, 58 .exp files in gdb.threads were marked as racy. After the patch this reduced to the same ~14 tests as the non effected boxes. Clearly GDB will still be subject to hangs on an effect box if hw wp/bp's are used prior to creating inferior threads on a heavily loaded system. To enable this in gdbserver, the sequence in gdbserver add_lwp() is switched to the same as gdb order as gdb, to ensure the thread is registered before calling new_thread(). This allows aarch64_linux_new_thread() to read the ptid. gdb/ChangeLog: * nat/aarch64-linux-hw-point.c (aarch64_linux_any_set_debug_regs_state): New function. * nat/aarch64-linux-hw-point.h (aarch64_linux_any_set_debug_regs_state): New declaration. * nat/aarch64-linux.c (aarch64_linux_new_thread): Check if any BPs or WPs are set. gdb/gdbserver/ChangeLog: * linux-low.c (add_lwp): Switch ordering.
Diffstat (limited to 'gdb/gdbserver/linux-low.c')
-rw-r--r--gdb/gdbserver/linux-low.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 4d84927..9e1faf3 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -951,11 +951,11 @@ add_lwp (ptid_t ptid)
lwp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
+ lwp->thread = add_thread (ptid, lwp);
+
if (the_low_target.new_thread != NULL)
the_low_target.new_thread (lwp);
- lwp->thread = add_thread (ptid, lwp);
-
return lwp;
}