This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/8] Add new gdbarch method, unconditional_branch_address
- From: Kevin Buettner <kevinb at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 18 Sep 2015 05:26:01 -0700
- Subject: Re: [PATCH 2/8] Add new gdbarch method, unconditional_branch_address
- Authentication-results: sourceware.org; auth=none
- References: <20150818235334 dot 1afb0c85 at pinnacle dot lan> <20150819000002 dot 06f6a2cf at pinnacle dot lan> <20150918120157 dot GB10919 at embecosm dot com> <20150918120606 dot GC10919 at embecosm dot com>
On Fri, 18 Sep 2015 13:06:06 +0100
Andrew Burgess <andrew.burgess@embecosm.com> wrote:
> * Andrew Burgess <andrew.burgess@embecosm.com> [2015-09-18 13:01:57 +0100]:
>
> > * Kevin Buettner <kevinb@redhat.com> [2015-08-19 00:00:02 -0700]:
> >
> > > diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
> > > index c1e2c1a..1770960 100644
> > > --- a/gdb/gdbarch.h
> > > +++ b/gdb/gdbarch.h
> > > @@ -924,7 +924,7 @@ extern void set_gdbarch_max_insn_length (struct gdbarch *gdbarch, ULONGEST max_i
> > > If your architecture doesn't need to adjust instructions before
> > > single-stepping them, consider using simple_displaced_step_copy_insn
> > > here.
> > > -
> > > +
> > > If the instruction cannot execute out of line, return NULL. The
> > > core falls back to stepping past the instruction in-line instead in
> > > that case. */
> > > @@ -1478,6 +1478,16 @@ typedef int (gdbarch_addressable_memory_unit_size_ftype) (struct gdbarch *gdbarc
> > > extern int gdbarch_addressable_memory_unit_size (struct gdbarch *gdbarch);
> > > extern void set_gdbarch_addressable_memory_unit_size (struct gdbarch *gdbarch, gdbarch_addressable_memory_unit_size_ftype *addressable_memory_unit_size);
> > >
> > > +/* Examine instruction at PC. If instruction at PC is an unconditional
> > > + branch, return the address to which control is transferred when the
> > > + branch is taken. Return 0 when this method is not implemented by
> > > + architecture, PC refers to an invalid address, or instruction at PC
> > > + is not an unconditional branch. */
> > > +
> > > +typedef CORE_ADDR (gdbarch_unconditional_branch_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc);
> > > +extern CORE_ADDR gdbarch_unconditional_branch_address (struct gdbarch *gdbarch, CORE_ADDR pc);
> > > +extern void set_gdbarch_unconditional_branch_address (struct gdbarch *gdbarch, gdbarch_unconditional_branch_address_ftype *unconditional_branch_address);
>
> <snip>
>
> > How would you feel about changing the function so that it returned a
> > bool and placed the address into a CORE_ADDRESS passed by pointer?
>
> Or I could actually spot your revised patch and see you've already
> done this :-/
Oops. I'm guilty of this too. (I should have looked ahead to see this email.)
Kevin