From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 825 invoked by alias); 14 Jul 2007 00:17:57 -0000 Received: (qmail 817 invoked by uid 22791); 14 Jul 2007 00:17:56 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 14 Jul 2007 00:17:53 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l6E0HqdR004086 for ; Fri, 13 Jul 2007 20:17:52 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l6E0HpSV012453 for ; Fri, 13 Jul 2007 20:17:51 -0400 Received: from ironwood.lan (vpn-15-55.rdu.redhat.com [10.11.15.55]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l6E0HpV8015532 for ; Fri, 13 Jul 2007 20:17:51 -0400 Date: Sat, 14 Jul 2007 00:17:00 -0000 From: Kevin Buettner To: gdb-patches@sources.redhat.com Subject: Re: [commit] mep-tdep.c: prologue analyzer update Message-ID: <20070713171750.632b6c58@ironwood.lan> In-Reply-To: References: <20070712170147.3586c1bd@ironwood.lan> X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.10.4; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2007-07/txt/msg00205.txt.bz2 > The comment might want to mention why we should only do this for > forward branches. :) Thanks for the feedback! I've updated the comment as follows... * mep-tdep.c (mep_analyze_prologue): Update comment for BRA instruction case. Index: mep-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mep-tdep.c,v retrieving revision 1.6 diff -u -p -r1.6 mep-tdep.c --- mep-tdep.c 13 Jul 2007 00:00:15 -0000 1.6 +++ mep-tdep.c 14 Jul 2007 00:14:16 -0000 @@ -1812,13 +1812,24 @@ mep_analyze_prologue (CORE_ADDR start_pc } else if (IS_BRA (insn) && BRA_DISP (insn) > 0) { - /* When a loop appears as the first statement as a function + /* When a loop appears as the first statement of a function body, gcc 4.x will use a BRA instruction to branch to the loop condition checking code. This BRA instruction is marked as part of the prologue. We therefore set next_pc to this branch target and also stop the prologue scan. The instructions at and beyond the branch target should - no longer be associated with the prologue. */ + no longer be associated with the prologue. + + Note that we only consider forward branches here. We + presume that a forward branch is being used to skip over + a loop body. + + A backwards branch is covered by the default case below. + If we were to encounter a backwards branch, that would + most likely mean that we've scanned through a loop body. + We definitely want to stop the prologue scan when this + happens and that is precisely what is done by the default + case below. */ next_pc = pc + BRA_DISP (insn); after_last_frame_setup_insn = next_pc; break;