From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26945 invoked by alias); 31 May 2012 20:56:06 -0000 Received: (qmail 26875 invoked by uid 22791); 31 May 2012 20:56:05 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 31 May 2012 20:55:48 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4VKtjOE001624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 31 May 2012 16:55:45 -0400 Received: from psique (ovpn-113-133.phx2.redhat.com [10.3.113.133]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4VKtg4A022232; Thu, 31 May 2012 16:55:43 -0400 From: Sergio Durigan Junior To: Edjunior Barbosa Machado Cc: gdb-patches@sourceware.org, Mark Kettenis , "K.Prasad" Subject: Re: [PATCH] disable ptrace BookE interface for PowerPC server processors References: <1337700251-9366-1-git-send-email-emachado@linux.vnet.ibm.com> <201205221734.q4MHY0FQ014975@glazunov.sibelius.xs4all.nl> <4FBF0153.4060108@linux.vnet.ibm.com> X-URL: http://www.redhat.com Date: Thu, 31 May 2012 20:56:00 -0000 In-Reply-To: <4FBF0153.4060108@linux.vnet.ibm.com> (Edjunior Barbosa Machado's message of "Fri, 25 May 2012 00:49:39 -0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-05/txt/msg01106.txt.bz2 On Friday, May 25 2012, Edjunior Barbosa Machado wrote: > On 05/22/2012 02:34 PM, Mark Kettenis wrote: > > 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). Thanks for the patch. > Please consider the new version of the patch below. > gdb/ > 2012-25-05 Edjunior Machado > > * ppc-linux-nat.c (have_ptrace_booke_interface): disable ptrace booke > interface for powerpc server processors if not available in > kernel. I guess you could rewrite this to: * ppc-linux-nat.c (have_ptrace_booke_interface): Disable ptrace BookE interface for PowerPC server processors if not available in the Linux 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) I'd rather use an explicit check like this: if (booke_debug_info.features != 0) Also, I guess you could put a comment above this check and insert a brief explanation like you did in the top of this message, WDYT? >From what I remember when I hacked this interface, the patch is good (and somewhat trivial to me) :-). Thanks, -- Sergio