X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fppc-linux-nat.c;h=1ff00a6d04e6251eb5206b0d5b041be297d543be;hb=c8c735b96348ead98a7ddeb25a5eed4912586396;hp=edb16c0b7a6b945c21ddbe2e2489bd855c6fa15a;hpb=e362b51003ad60f4984bf7bed3bc02259db10546;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index edb16c0b7a..1ff00a6d04 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -1503,16 +1503,19 @@ ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) to determine the hardcoded watchable region for watchpoints. */ if (have_ptrace_booke_interface ()) { - /* DAC-based processors (i.e., embedded processors), like the PowerPC 440 - have ranged watchpoints and can watch any access within an arbitrary - memory region. This is useful to watch arrays and structs, for - instance. It takes two hardware watchpoints though. */ + /* Embedded DAC-based processors, like the PowerPC 440 have ranged + watchpoints and can watch any access within an arbitrary memory + region. This is useful to watch arrays and structs, for instance. It + takes two hardware watchpoints though. */ if (len > 1 - && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE) + && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE + && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE) return 2; - else if (booke_debug_info.data_bp_alignment - && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1)) - + booke_debug_info.data_bp_alignment)) + /* Server processors provide one hardware watchpoint and addr+len should + fall in the watchable region provided by the ptrace interface. */ + if (booke_debug_info.data_bp_alignment + && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1)) + + booke_debug_info.data_bp_alignment)) return 0; } /* addr+len must fall in the 8 byte watchable region for DABR-based @@ -2178,7 +2181,18 @@ ppc_linux_new_thread (struct lwp_info *lp) /* 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); + { + /* Older kernels did not make new threads inherit their parent + thread's debug state, so we always clear the slot and replicate + the debug state ourselves, ensuring compatibility with all + kernels. */ + + /* 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);