From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1135 invoked by alias); 24 Feb 2012 11:06:40 -0000 Received: (qmail 1126 invoked by uid 22791); 24 Feb 2012 11:06:39 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Feb 2012 11:06:23 +0000 Received: from nat-dem.mentorg.com ([195.212.93.2] helo=eu2-mail.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1S0syj-0005Nm-JC from Thomas_Schwinge@mentor.com ; Fri, 24 Feb 2012 03:06:21 -0800 Received: from feldtkeller.schwinge.homeip.net ([172.30.64.161]) by eu2-mail.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 24 Feb 2012 12:06:20 +0100 From: Thomas Schwinge To: Kevin Buettner Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] [SH] Prologue skipping if there is none In-Reply-To: <20120220162029.2082b6a1@mesquite.lan> References: <87pqdgciho.fsf@schwinge.name> <20120215075413.1313f7fa@mesquite.lan> <20120215165907.33f2e9a6@mesquite.lan> <8739aad9il.fsf@schwinge.name> <20120216182544.36b41a1b@mesquite.lan> <87mx8da3b9.fsf@schwinge.name> <20120220162029.2082b6a1@mesquite.lan> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Fri, 24 Feb 2012 11:09:00 -0000 Message-ID: <87wr7c7aop.fsf@schwinge.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" 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: 2012-02/txt/msg00537.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 3883 Hi Kevin! On Mon, 20 Feb 2012 16:20:29 -0700, Kevin Buettner wrot= e: > On Mon, 20 Feb 2012 17:15:54 +0100 > Thomas Schwinge wrote: >=20 > > So, we do seem to agree that something like the patch I posted initially > > (and as it is incorporated in a similar fashion in your patch, too) does > > already move us forward; is it reasonable that we commit that one now, > > and then continue to look on how to further improve the situation based > > on your patch? This will let us point out more easily which are the > > additional cases your patch improves/regresses on. (I'd offer to port > > your patch over to the new baseline, if you want me to.) >=20 > Yeah, as a first step, I think it makes sense for you to commit > the patch that you came up with. Thanks; here is the patch I committed in the end: 2012-02-24 Thomas Schwinge * sh-tdep.c (sh_skip_prologue): Use skip_prologue_using_sal. (after_prologue): Remove. Index: gdb/sh-tdep.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/sh-tdep.c,v retrieving revision 1.237 diff -u -p -r1.237 sh-tdep.c --- gdb/sh-tdep.c 17 Feb 2012 08:39:57 -0000 1.237 +++ gdb/sh-tdep.c 24 Feb 2012 10:59:08 -0000 @@ -712,55 +712,29 @@ sh_analyze_prologue (struct gdbarch *gdb } =20 /* Skip any prologue before the guts of a function. */ - -/* Skip the prologue using the debug information. If this fails we'll - fall back on the 'guess' method below. */ static CORE_ADDR -after_prologue (CORE_ADDR pc) +sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) { - struct symtab_and_line sal; - CORE_ADDR func_addr, func_end; - - /* If we can not find the symbol in the partial symbol table, then - there is no hope we can determine the function's start address - with this code. */ - if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end)) - return 0; - - /* Get the line associated with FUNC_ADDR. */ - sal =3D find_pc_line (func_addr, 0); - - /* There are only two cases to consider. First, the end of the source l= ine - is within the function bounds. In that case we return the end of the - source line. Second is the end of the source line extends beyond the - bounds of the current function. We need to use the slow code to - examine instructions in that case. */ - if (sal.end < func_end) - return sal.end; - else - return 0; -} - -static CORE_ADDR -sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) -{ - CORE_ADDR pc; + CORE_ADDR post_prologue_pc, func_addr; struct sh_frame_cache cache; =20 /* See if we can determine the end of the prologue via the symbol table. If so, then return either PC, or the PC after the prologue, whichever is greater. */ - pc =3D after_prologue (start_pc); + if (find_pc_partial_function (pc, NULL, &func_addr, NULL)) + { + post_prologue_pc =3D skip_prologue_using_sal (gdbarch, func_addr); + if (post_prologue_pc !=3D 0) + return max (pc, post_prologue_pc); + } =20 - /* If after_prologue returned a useful address, then use it. Else - fall back on the instruction skipping code. */ - if (pc) - return max (pc, start_pc); + /* Can't determine prologue from the symbol table, need to examine + instructions. */ =20 cache.sp_offset =3D -4; - pc =3D sh_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache, 0= ); - if (!cache.uses_fp) - return start_pc; + post_prologue_pc =3D sh_analyze_prologue (gdbarch, pc, (CORE_ADDR) -1, &= cache, 0); + if (cache.uses_fp) + pc =3D post_prologue_pc; =20 return pc; } Working on your patch is the next step. Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 489 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJPR28mAAoJENuKOtuXzphJG+AH/3LWR/OAqj//NcDF0IJXxgDc 3tbQRZTRUhAzwG2zf/NQ5R/d1s0HhuGTckyFoWLbUgGK3U1dX2OxK5EmAIpYEjRt kT1bvx5ukCiZ7EEyhBFkEuEv468ODwCNXXnqtZDyQUf3KvYaHTT4ViL9LUMDO/cu J8PqGiGFDieJAqAjfa/ZI0zx8PvSu6K3mMqVrCbxXOMOiBdEYEYE+SjyLQ4d1zq1 pgL2abpmC5SmVsjkoN9xv3zXRJmK1anX8FsLMI0nwUX7XjcWQQkoKbRYIL6SdJAg Tc4Zwit4Pw1v3tK/CdH+7XLzpNEyCrV2MxmOaBUndgpoi3ndmNgZ1UFAjjdONl4= =lu39 -----END PGP SIGNATURE----- --=-=-=--