From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70083 invoked by alias); 18 Sep 2015 12:24:24 -0000 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 Received: (qmail 70049 invoked by uid 89); 18 Sep 2015 12:24:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Sep 2015 12:24:19 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id C28518EA43 for ; Fri, 18 Sep 2015 12:24:17 +0000 (UTC) Received: from pinnacle.lan (ovpn-113-104.phx2.redhat.com [10.3.113.104]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8ICOHnY019290 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO) for ; Fri, 18 Sep 2015 08:24:17 -0400 Date: Fri, 18 Sep 2015 12:24:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: Re: [PATCH 2/8] Add new gdbarch method, unconditional_branch_address Message-ID: <20150918052415.27cf1f88@pinnacle.lan> In-Reply-To: <20150918120157.GB10919@embecosm.com> References: <20150818235334.1afb0c85@pinnacle.lan> <20150819000002.06f6a2cf@pinnacle.lan> <20150918120157.GB10919@embecosm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00457.txt.bz2 On Fri, 18 Sep 2015 13:01:57 +0100 Andrew Burgess wrote: > * Kevin Buettner [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); > > Personally I'm not a fan of overloading the return values on these > functions, especially when the return value is an address, on some > targets 0 is a valid address. I know there are lots of other places > where we use 0 as a special address in gdb, so this would be just one > more... but... > > 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? Pedro had a similar observation. The new patch that I posted does this. (Though it uses int instead of bool.) Kevin