From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14029 invoked by alias); 31 May 2012 22:09:59 -0000 Received: (qmail 14015 invoked by uid 22791); 31 May 2012 22:09:58 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e24smtp01.br.ibm.com (HELO e24smtp01.br.ibm.com) (32.104.18.85) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 31 May 2012 22:09:44 +0000 Received: from /spool/local by e24smtp01.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 31 May 2012 19:09:42 -0300 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp01.br.ibm.com (10.172.0.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 31 May 2012 19:09:17 -0300 Received: from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id E9EDF352004D for ; Thu, 31 May 2012 18:09:14 -0400 (EDT) Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q4VM6xP02879642 for ; Thu, 31 May 2012 19:06:59 -0300 Received: from d24av03.br.ibm.com (loopback [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q4VK9Um6009937 for ; Thu, 31 May 2012 17:09:30 -0300 Received: from [9.12.225.188] ([9.12.225.188]) by d24av03.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q4VK9ObI009708; Thu, 31 May 2012 17:09:26 -0300 Message-ID: <4FC7EC00.3030205@linux.vnet.ibm.com> Date: Thu, 31 May 2012 22:09:00 -0000 From: Edjunior Barbosa Machado User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Sergio Durigan Junior 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12053122-1524-0000-0000-00000294FBDB 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/msg01107.txt.bz2 On 05/31/2012 05:55 PM, Sergio Durigan Junior wrote: > On Friday, May 25 2012, Edjunior Barbosa Machado wrote: >> 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, > Thanks for the review, Sergio. Based on your reply and the feedback from Mark, I've just committed the following version of the patch. Thanks, -- Edjunior gdb/ 2012-05-31 Edjunior Machado * 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 b9e0c85..45cdd73 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -1421,17 +1421,20 @@ 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)); + /* Check whether ptrace BOOKE interface is functional and + provides any supported feature. */ + if (booke_debug_info.features != 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; + 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;