2012-08-06 Luis Machado * ppc-linux-nat.c (ppc_linux_new_thread): Clear the new thread's debug state prior to replicating existing hardware watchpoints or breakpoints. Index: gdb_head/gdb/ppc-linux-nat.c =================================================================== --- gdb_head.orig/gdb/ppc-linux-nat.c 2012-08-06 11:02:12.538532628 -0300 +++ gdb_head/gdb/ppc-linux-nat.c 2012-08-06 11:04:38.486536320 -0300 @@ -2179,7 +2179,21 @@ ppc_linux_new_thread (struct lwp_info *l /* Copy that thread's breakpoints and watchpoints to the new thread. */ for (i = 0; i < max_slots_number; i++) if (hw_breaks[i].hw_break) - booke_insert_point (hw_breaks[i].hw_break, tid); + { + /* The ppc Linux kernel causes a thread to inherit its parent + thread's debug state, and that includes any hardware + watchpoints or breakpoints that the parent thread may have set. + + For this reason, the debug state of the new thread is cleared + before trying to replicate any hardware watchpoints or + breakpoints contained in other threads. */ + + /* The ppc debug resource accounting is done through "slots". + Ask the kernel the deallocate this specific *point's slot. */ + ptrace (PPC_PTRACE_DELHWDEBUG, tid, 0, hw_breaks[i].slot); + + booke_insert_point (hw_breaks[i].hw_break, tid); + } } else ptrace (PTRACE_SET_DEBUGREG, tid, 0, saved_dabr_value);