From: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: gdb-patches@sourceware.org,
Mark Kettenis <mark.kettenis@xs4all.nl>,
"K.Prasad" <prasad@linux.vnet.ibm.com>
Subject: Re: [PATCH] disable ptrace BookE interface for PowerPC server processors
Date: Thu, 31 May 2012 22:09:00 -0000 [thread overview]
Message-ID: <4FC7EC00.3030205@linux.vnet.ibm.com> (raw)
In-Reply-To: <m3r4u0135e.fsf@redhat.com>
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 <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.
>
> 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 <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 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;
prev parent reply other threads:[~2012-05-31 22:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-22 15:24 Edjunior Barbosa Machado
2012-05-22 17:34 ` Mark Kettenis
2012-05-25 3:50 ` Edjunior Barbosa Machado
2012-05-29 18:54 ` Mark Kettenis
2012-05-30 4:17 ` Edjunior Barbosa Machado
2012-05-30 15:31 ` Mark Kettenis
2012-05-31 20:56 ` Sergio Durigan Junior
2012-05-31 22:09 ` Edjunior Barbosa Machado [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FC7EC00.3030205@linux.vnet.ibm.com \
--to=emachado@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
--cc=prasad@linux.vnet.ibm.com \
--cc=sergiodj@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox