From: John Baldwin Date: Tue, 28 Jun 2016 00:44:58 +0000 (-0700) Subject: Set debug registers on all threads belonging to the current inferior. X-Git-Tag: gdb-7.12-release~330 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5077bfff905136e9d9a8fdf0886f6217887622ad;p=external%2Fbinutils.git Set debug registers on all threads belonging to the current inferior. gdb/ChangeLog: * x86bsd-nat.c: Include 'gdbthread.h'. (x86bsd_dr_set): Set debug registers on all threads belonging to the current inferior. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0089d68..e4f7e3a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2016-07-01 John Baldwin + * x86bsd-nat.c: Include 'gdbthread.h'. + (x86bsd_dr_set): Set debug registers on all threads belonging to + the current inferior. + +2016-07-01 John Baldwin + * Makefile.in [HFILES_NO_SRCDIR]: Replace 'amd64bsd-nat.h' with 'x86bsd-nat.h'. * amd64bsd-nat.c: Include 'x86bsd-nat.h' instead of diff --git a/gdb/x86bsd-nat.c b/gdb/x86bsd-nat.c index 0c56848..bde25ab 100644 --- a/gdb/x86bsd-nat.c +++ b/gdb/x86bsd-nat.c @@ -19,6 +19,7 @@ #include "defs.h" #include "inferior.h" +#include "gdbthread.h" /* We include to make sure `struct fxsave64' is defined on NetBSD, since NetBSD's needs it. */ @@ -71,6 +72,7 @@ x86bsd_dr_get (ptid_t ptid, int regnum) static void x86bsd_dr_set (int regnum, unsigned long value) { + struct thread_info *thread; struct dbreg dbregs; if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid), @@ -84,9 +86,13 @@ x86bsd_dr_set (int regnum, unsigned long value) DBREG_DRX ((&dbregs), regnum) = value; - if (ptrace (PT_SETDBREGS, get_ptrace_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) - perror_with_name (_("Couldn't write debug registers")); + ALL_NON_EXITED_THREADS (thread) + if (thread->inf == current_inferior ()) + { + if (ptrace (PT_SETDBREGS, get_ptrace_pid (thread->ptid), + (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) + perror_with_name (_("Couldn't write debug registers")); + } } static void