From: Pedro Alves <palves@redhat.com>
To: Anton Blanchard <anton@samba.org>
Cc: Joel Brobecker <brobecker@adacore.com>,
gdb-patches@sourceware.org, emachado@linux.vnet.ibm.com,
luis_gustavo@mentor.com, ulrich.weigand@de.ibm.com
Subject: Re: [PATCH 2/4] Support up to 3 conditional branches in an atomic sequence
Date: Fri, 28 Mar 2014 17:22:00 -0000 [thread overview]
Message-ID: <5335AFE4.2000704@redhat.com> (raw)
In-Reply-To: <5335AD94.4030701@redhat.com>
On 03/28/2014 05:12 PM, Pedro Alves wrote:
>>> --- a/gdb/rs6000-tdep.c
>>> +++ b/gdb/rs6000-tdep.c
>>> @@ -1088,7 +1088,7 @@ ppc_deal_with_atomic_sequence (struct frame_info *frame)
>>> struct address_space *aspace = get_frame_address_space (frame);
>>> enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
>>> CORE_ADDR pc = get_frame_pc (frame);
>>> - CORE_ADDR breaks[2] = {-1, -1};
>>> + CORE_ADDR breaks[MAX_SINGLE_STEP_BREAKPOINTS];
>
> If we ever bump MAX_SINGLE_STEP_BREAKPOINTS further,
> you'd still only want 4 here.
>
> I think it'd be better if this was:
>
> /* 3 conditional branches + 1 terminating branch. */
> CORE_ADDR breaks[4];
>
> Followed by:
>
> gdb_static_assert (MAX_SINGLE_STEP_BREAKPOINTS >= ARRAY_SIZE (breaks));
>
> This way clearly documents that we need to support 4 sss breakpoints.
> As it is, nothing in your patch leaves any indication in the source to
> that effect, so the poor soul trying to revamp software single-step
> breakpoints could miss this.
Sorry, I wrote this before realizing that there could even be more
condition branches in the region and writing the "is there a hard limit",
and then pushed send too soon. So assuming there's no limit and we're
just trying to be practical in what we support, there's really no harm
in leaving this as:
CORE_ADDR breaks[MAX_SINGLE_STEP_BREAKPOINTS];
but I still think a comment (+ the assert would be nice) is
missing. Something like:
/* The ppc64 Linux kernel has regions with 3 conditional branches.
(plus 1 for the terminating branch). */
gdb_static_assert (MAX_SINGLE_STEP_BREAKPOINTS >= 4);
?
BTW, shouldn't GDB warn or even error out if too many
conditional branches are found? I think that'd be better
than silently getting stuck forever.
--
Pedro Alves
next prev parent reply other threads:[~2014-03-28 17:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 3:41 [PATCH 1/4] Fix ppc64 single step over atomic sequence testcase Anton Blanchard
2014-03-28 3:42 ` [PATCH 3/4] Add multiple branches to ppc64 single step through " Anton Blanchard
2014-03-28 13:14 ` Joel Brobecker
2014-03-28 3:42 ` [PATCH 4/4] Add lbarx/stbcx., lharx/sthcx. and lqarx/stqcx. single stepping Anton Blanchard
2014-03-28 13:17 ` Joel Brobecker
2014-03-28 3:42 ` [PATCH 2/4] Support up to 3 conditional branches in an atomic sequence Anton Blanchard
2014-03-28 13:12 ` Joel Brobecker
2014-03-28 17:13 ` Pedro Alves
2014-03-28 17:22 ` Pedro Alves [this message]
2014-03-28 17:32 ` Joel Brobecker
2014-03-28 17:58 ` Pedro Alves
2014-03-28 18:10 ` Joel Brobecker
2014-03-28 13:05 ` [PATCH 1/4] Fix ppc64 single step over atomic sequence testcase Joel Brobecker
2014-03-31 2:55 ` Anton Blanchard
2014-03-28 13:13 ` Ulrich Weigand
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=5335AFE4.2000704@redhat.com \
--to=palves@redhat.com \
--cc=anton@samba.org \
--cc=brobecker@adacore.com \
--cc=emachado@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=luis_gustavo@mentor.com \
--cc=ulrich.weigand@de.ibm.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