From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17076 invoked by alias); 11 Nov 2004 19:18:42 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17009 invoked from network); 11 Nov 2004 19:18:25 -0000 Received: from unknown (HELO sj-iport-2.cisco.com) (171.71.176.71) by sourceware.org with SMTP; 11 Nov 2004 19:18:25 -0000 Received: from sj-core-5.cisco.com (171.71.177.238) by sj-iport-2.cisco.com with ESMTP; 11 Nov 2004 11:30:27 -0800 Received: from msnyder8600 (dhcp-128-107-165-92.cisco.com [128.107.165.92]) by sj-core-5.cisco.com (8.12.10/8.12.6) with SMTP id iABJIKcp023186; Thu, 11 Nov 2004 11:18:21 -0800 (PST) Message-ID: <002601c4c823$36a06b70$5ca56b80@msnyder8600> From: "Michael Snyder" To: "Kevin Buettner" Cc: , "Wendy Peikes" References: <00c901c4c78b$5e1591f0$5ca56b80@msnyder8600> <20041111100404.715526e8@saguaro> Subject: Re: [RFA] Tweak in skip_prologue for rs6000 Date: Thu, 11 Nov 2004 19:18:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-SW-Source: 2004-11/txt/msg00236.txt.bz2 "Kevin Buettner" wrote: > On Wed, 10 Nov 2004 17:11:21 -0800 > "Michael Snyder" wrote: > >> If I'm right, this will prevent saving lr_offset twice. It looks like the >> existing code intends to invalidate lr_reg, but setting it to zero is not >> an invalid value. > > Yes, I agree with your analysis. Setting lr_reg to 0 will cause a > match whenever doing a st[dw]{,u} r0, NUM(r1). While this is okay > if the zero value comes from the mflr case, it is definitely not okay > in the lr_reg invalidation code. > >> Probably the same is true for cr_reg and cr_offset... > > Yes, it appears so. Would you mind making the same fix for these? > Consider such a patch to be preapproved. OK, committed. Revised version attached below. Thanks Kevin. Oh, and thanks to Wendy Peikes of Cisco for her help in tracking this down. 2004-11-10 msnyder * rs6000-tdep.c (skip_prologue): After saving lr_offset, must invalidate lr_reg (so we don't try to save it again). Ditto for cr_offset and cr_reg. Index: rs6000-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v retrieving revision 1.230 diff -p -r1.230 rs6000-tdep.c *** rs6000-tdep.c 13 Oct 2004 16:38:22 -0000 1.230 --- rs6000-tdep.c 11 Nov 2004 19:14:29 -0000 *************** skip_prologue (CORE_ADDR pc, CORE_ADDR l *** 981,987 **** continue; } ! else if (lr_reg != -1 && /* std Rx, NUM(r1) || stdu Rx, NUM(r1) */ (((op & 0xffff0000) == (lr_reg | 0xf8010000)) || /* stw Rx, NUM(r1) */ --- 981,987 ---- continue; } ! else if (lr_reg >= 0 && /* std Rx, NUM(r1) || stdu Rx, NUM(r1) */ (((op & 0xffff0000) == (lr_reg | 0xf8010000)) || /* stw Rx, NUM(r1) */ *************** skip_prologue (CORE_ADDR pc, CORE_ADDR l *** 991,997 **** { /* where Rx == lr */ fdata->lr_offset = offset; fdata->nosavedpc = 0; ! lr_reg = 0; if ((op & 0xfc000003) == 0xf8000000 || /* std */ (op & 0xfc000000) == 0x90000000) /* stw */ { --- 991,999 ---- { /* where Rx == lr */ fdata->lr_offset = offset; fdata->nosavedpc = 0; ! /* Invalidate lr_reg, but don't set it to -1. ! That would mean that it had never been set. */ ! lr_reg = -2; if ((op & 0xfc000003) == 0xf8000000 || /* std */ (op & 0xfc000000) == 0x90000000) /* stw */ { *************** skip_prologue (CORE_ADDR pc, CORE_ADDR l *** 1001,1007 **** continue; } ! else if (cr_reg != -1 && /* std Rx, NUM(r1) || stdu Rx, NUM(r1) */ (((op & 0xffff0000) == (cr_reg | 0xf8010000)) || /* stw Rx, NUM(r1) */ --- 1003,1009 ---- continue; } ! else if (cr_reg >= 0 && /* std Rx, NUM(r1) || stdu Rx, NUM(r1) */ (((op & 0xffff0000) == (cr_reg | 0xf8010000)) || /* stw Rx, NUM(r1) */ *************** skip_prologue (CORE_ADDR pc, CORE_ADDR l *** 1010,1016 **** ((op & 0xffff0000) == (cr_reg | 0x94010000)))) { /* where Rx == cr */ fdata->cr_offset = offset; ! cr_reg = 0; if ((op & 0xfc000003) == 0xf8000000 || (op & 0xfc000000) == 0x90000000) { --- 1012,1020 ---- ((op & 0xffff0000) == (cr_reg | 0x94010000)))) { /* where Rx == cr */ fdata->cr_offset = offset; ! /* Invalidate cr_reg, but don't set it to -1. ! That would mean that it had never been set. */ ! cr_reg = -2; if ((op & 0xfc000003) == 0xf8000000 || (op & 0xfc000000) == 0x90000000) {