From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12512 invoked by alias); 13 Jul 2007 00:01:58 -0000 Received: (qmail 12496 invoked by uid 22791); 13 Jul 2007 00:01:54 -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; Fri, 13 Jul 2007 00:01:51 +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 l6D01n6j012659 for ; Thu, 12 Jul 2007 20:01:49 -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 l6D01nFI004276 for ; Thu, 12 Jul 2007 20:01:49 -0400 Received: from ironwood.lan (vpn-14-36.rdu.redhat.com [10.11.14.36]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l6D01m8G008835 for ; Thu, 12 Jul 2007 20:01:48 -0400 Date: Fri, 13 Jul 2007 00:01:00 -0000 From: Kevin Buettner To: gdb-patches@sources.redhat.com Subject: [commit] mep-tdep.c: prologue analyzer update Message-ID: <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/msg00199.txt.bz2 I've just committed the patch below. It fixes a gdb.base/break.exp failure when using a gcc-4.x based compiler. (See the comment in the patch for a full explanation.) * mep-tdep.c (IS_BRA, BRA_DISP): New macros. (mep_analyze_prologue): Add case for BRA instruction. Index: mep-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mep-tdep.c,v retrieving revision 1.5 diff -u -p -r1.5 mep-tdep.c --- mep-tdep.c 16 Jun 2007 17:16:25 -0000 1.5 +++ mep-tdep.c 12 Jul 2007 23:52:31 -0000 @@ -1578,6 +1578,10 @@ mep_get_insn (CORE_ADDR pc, long *insn) #define MOV_TARGET(i) (FIELD (i, 24, 4)) #define MOV_SOURCE(i) (FIELD (i, 20, 4)) +/* BRA disp12.align2 1011_dddd_dddd_ddd0 xxxx_xxxx_xxxx_xxxx */ +#define IS_BRA(i) (((i) & 0xf0010000) == 0xb0000000) +#define BRA_DISP(i) (SFIELD (i, 17, 11) << 1) + /* This structure holds the results of a prologue analysis. */ struct mep_prologue @@ -1806,6 +1810,19 @@ mep_analyze_prologue (CORE_ADDR start_pc reg[rn] = pv_area_fetch (stack, addr, 4); } + else if (IS_BRA (insn) && BRA_DISP (insn) > 0) + { + /* When a loop appears as the first statement as 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. */ + next_pc = pc + BRA_DISP (insn); + after_last_frame_setup_insn = next_pc; + break; + } else /* We've hit some instruction we don't know how to simulate. Strictly speaking, we should set every value we're