This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] disable ptrace BookE interface for PowerPC server processors
> Date: Fri, 25 May 2012 00:49:39 -0300
> From: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
>
> On 05/22/2012 02:34 PM, Mark Kettenis wrote:
>
> > But how are you going to handle this when that functionality does
> > become available?
>
>
> Thanks for the feedback and sorry for the late reply. I was discussing
> with the kernel developer responsible for the next version of the ptrace
> booke interface and he proposed that the 'features' field from the
> struct ppc_debug_info returned by ptrace PPC_PTRACE_GETHWDBGINFO call
> could be used to check if its availability. According to him, this field
> is currently 0 for servers, but once the new ptrace interface becomes
> functional, it will return the flag PPC_DEBUG_FEATURE_DATA_BP_RANGE
> enabled. Moreover, this change will not affect the behavior on embedded
> processors (which already has PPC_DEBUG_FEATURE_DATA_BP_RANGE and
> PPC_DEBUG_FEATURE_DATA_BP_MASK enabled).
>
> Please consider the new version of the patch below.
Certainly makes more sense to me ;)
> gdb/
> 2012-25-05 Edjunior Machado <emachado@linux.vnet.ibm.com>
>
> * ppc-linux-nat.c (have_ptrace_booke_interface): disable ptrace booke
> interface for powerpc server processors if not available in kernel.
>
> diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
> index 34c40b4..9ffcf88 100644
> --- a/gdb/ppc-linux-nat.c
> +++ b/gdb/ppc-linux-nat.c
> @@ -1421,17 +1421,18 @@ have_ptrace_booke_interface (void)
> /* Check for kernel support for BOOKE debug registers. */
> if (ptrace (PPC_PTRACE_GETHWDBGINFO, tid, 0, &booke_debug_info) >= 0)
> {
> - have_ptrace_booke_interface = 1;
> - max_slots_number = booke_debug_info.num_instruction_bps
> - + booke_debug_info.num_data_bps
> - + booke_debug_info.num_condition_regs;
> - }
> - else
> - {
> - /* Old school interface and no BOOKE debug registers support. */
> - have_ptrace_booke_interface = 0;
> - memset (&booke_debug_info, 0, sizeof (struct ppc_debug_info));
> + if (booke_debug_info.features)
> + {
> + have_ptrace_booke_interface = 1;
> + max_slots_number = booke_debug_info.num_instruction_bps
> + + booke_debug_info.num_data_bps
> + + booke_debug_info.num_condition_regs;
> + return have_ptrace_booke_interface;
> + }
> }
> + /* Old school interface and no BOOKE debug registers support. */
> + have_ptrace_booke_interface = 0;
> + memset (&booke_debug_info, 0, sizeof (struct ppc_debug_info));
> }
>
> return have_ptrace_booke_interface;
>
>