From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23493 invoked by alias); 11 Jan 2007 16:45:46 -0000 Received: (qmail 23462 invoked by uid 22791); 11 Jan 2007 16:45:44 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Thu, 11 Jan 2007 16:45:36 +0000 Received: from drow by nevyn.them.org with local (Exim 4.63) (envelope-from ) id 1H533V-0005My-V9; Thu, 11 Jan 2007 11:45:34 -0500 Date: Thu, 11 Jan 2007 16:45:00 -0000 From: Daniel Jacobowitz To: Andreas Schwab Cc: gdb-patches@sourceware.org Subject: Re: [rfc, frame] Always check for unsaved PC Message-ID: <20070111164533.GA20499@nevyn.them.org> Mail-Followup-To: Andreas Schwab , gdb-patches@sourceware.org References: <20060819161139.GC25238@nevyn.them.org> <200608201427.k7KERnD0001824@elgar.sibelius.xs4all.nl> <20061110201548.GA1115@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) 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-01/txt/msg00301.txt.bz2 On Thu, Jan 11, 2007 at 05:34:22PM +0100, Andreas Schwab wrote: > This is broken. You can't use PC_REGNUM unconditionally without checking > whether that register actually exists. The ia64 does not have such a > register. I assume it causes trouble there. Sorry. Does this help (untested)? -- Daniel Jacobowitz CodeSourcery 2007-01-11 Daniel Jacobowitz * frame.c (get_prev_frame_1): Check PC_REGNUM before using it. Index: frame.c =================================================================== RCS file: /cvs/src/src/gdb/frame.c,v retrieving revision 1.218 diff -u -p -r1.218 frame.c --- frame.c 9 Jan 2007 20:19:15 -0000 1.218 +++ frame.c 11 Jan 2007 16:44:40 -0000 @@ -1221,10 +1221,17 @@ get_prev_frame_1 (struct frame_info *thi have different frame IDs, the new frame will be bogus; two functions can't share a register save slot for the PC. This can happen when the prologue analyzer finds a stack adjustment, but - no PC save. This check does assume that the "PC register" is - roughly a traditional PC, even if the gdbarch_unwind_pc method - frobs it. */ + no PC save. + + This check does assume that the "PC register" is roughly a + traditional PC, even if the gdbarch_unwind_pc method adjusts + it (we do not rely on the value, only on the unwound PC being + dependent on this value). A potential improvement would be + to have the frame prev_pc method and the gdbarch unwind_pc + method set the same lval and location information as + frame_register_unwind. */ if (this_frame->level > 0 + && PC_REGNUM >= 0 && get_frame_type (this_frame) == NORMAL_FRAME && get_frame_type (this_frame->next) == NORMAL_FRAME) {