Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/8] Add new gdbarch method, unconditional_branch_address
Date: Tue, 22 Sep 2015 18:03:00 -0000	[thread overview]
Message-ID: <20150922110328.5c7ba08e@pinnacle.lan> (raw)
In-Reply-To: <861tdqbfma.fsf@gmail.com>

On Tue, 22 Sep 2015 17:09:17 +0100
Yao Qi <qiyaoltc@gmail.com> wrote:

> Kevin Buettner <kevinb@redhat.com> writes:
> 
> > Add new gdbarch method, unconditional_branch_address.
> >
> > gdb/ChangeLog:
> >
> >     	* gdbarch.sh (unconditional_branch_address): New gdbarch method.
> >     	* gdbarch.h, gdbarch.c: Regenerate.
> >     	* arch-utils.h (default_unconditional_branch_address): Declare.
> >     	* arch-utils.c (default_unconditional_branch_address): New function.
> 
> Did you consider using existing gdbarch method
> adjust_breakpoint_address when you wrote the patch?  Can we use
> adjust_breakpoint_address here rather than adding a new gdbarch method?

Hi Yao,

The adjust_breakpoint_address method is not suitable for this patch
set.  It was originally added for the FR-V architecture.  FR-V is a
VLIW architecture which places limits on where a breakpoint may be
placed within a bundle.  For FR-V, this method ensures that a breakpoint
is placed at the beginning of the VLIW bundle.  I see now that it has
also been used for MIPS to avoid placing breakpoints on branch delay
slots and also for ARM to avoid placing breakpoints within IT
(if-then) blocks.  In each of these cases, the breakpoint is moved
because, if is not, the breakpoint might not be hit.

The gdbarch method that I'm introducing in this patch set needs to
limit itself to checking to see if the instruction at a given address
is an unconditional branch; if it is, it will return true and also
provide the branch destination address via an output parameter.  An
existing gdbarch method that might be suitable (with some
modification) for this purpose is insn_is_jump, which is presently
used by the btrace code.

The insn_is_jump method is a predicate only; at the moment, it does
not provide the branch destination.  It could be changed to do so,
but I think it makes sense to limit use of the insn_is_{jump,ret,call}
methods to btrace.  This is the justification that I provided in
another reply to this thread:

    I decided that the work I'm doing here should have it's own
    method.  If GCC should someday emit DWARF which sets is_stmt to 0
    for the branch instruction at the beginning of a while loop, this
    work might not be needed any longer.  It'll be easier to rip it
    out and clean things up again if I don't modify gdbarch methods
    that were added for other purposes.

Kevin


  reply	other threads:[~2015-09-22 18:03 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19  6:53 [PATCH 0/8] Break at each iteration for breakpoints placed on a while statement Kevin Buettner
2015-08-19  6:58 ` [PATCH 1/8] Add new test, gdb.base/loop-break.exp Kevin Buettner
2015-08-25 12:10   ` Pedro Alves
2015-09-18  0:50     ` Kevin Buettner
2016-02-01 20:00       ` Kevin Buettner
2016-02-15 16:51         ` Kevin Buettner
2016-02-29 16:17         ` Kevin Buettner
2015-09-22  0:11   ` Kevin Buettner
2015-08-19  7:00 ` [PATCH 2/8] Add new gdbarch method, unconditional_branch_address Kevin Buettner
2015-08-25 12:13   ` Pedro Alves
2015-09-18  1:14     ` Kevin Buettner
2015-09-18 12:02   ` Andrew Burgess
2015-09-18 12:06     ` Andrew Burgess
2015-09-18 12:26       ` Kevin Buettner
2015-09-18 12:24     ` Kevin Buettner
2015-09-22 16:09   ` Yao Qi
2015-09-22 18:03     ` Kevin Buettner [this message]
2015-08-19  7:03 ` [PATCH 3/8] Break at each iteration for breakpoints placed on a while statement Kevin Buettner
2015-08-25 12:10   ` Pedro Alves
2015-09-18  1:57     ` Kevin Buettner
2015-09-30 12:17       ` Pedro Alves
2015-10-01  1:13         ` Kevin Buettner
2015-10-01  4:09         ` Doug Evans
2015-08-19  7:06 ` [PATCH 4/8] Implement unconditional_branch_address method for x86-64 and i386 Kevin Buettner
2015-09-18  2:03   ` Kevin Buettner
2015-08-19  7:08 ` [PATCH 5/8] Implement unconditional_branch_address method for arm and thumb Kevin Buettner
2015-08-19  7:11 ` [PATCH 6/8] Implement unconditional_branch_address method for powerpc / rs6000 Kevin Buettner
2015-08-19  7:13 ` [PATCH 7/8] Implement unconditional_branch_address method for rl78 Kevin Buettner
2015-08-19  7:15 ` [PATCH 8/8] Implement unconditional_branch_address method for rx Kevin Buettner
2016-01-18 16:48 ` [PATCH 0/8] Break at each iteration for breakpoints placed on a while statement Kevin Buettner
2016-04-04 15:56 ` Yao Qi
2016-04-14 16:31   ` Luis Machado
2016-04-15 11:59     ` Yao Qi
2016-04-15 19:48       ` Kevin Buettner
2016-04-15 22:34         ` Pedro Alves
2016-04-19 16:24           ` Kevin Buettner

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=20150922110328.5c7ba08e@pinnacle.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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