From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23226 invoked by alias); 17 Apr 2004 07:32:24 -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 23218 invoked from network); 17 Apr 2004 07:32:22 -0000 Received: from unknown (HELO pippin.tausq.org) (64.81.244.94) by sources.redhat.com with SMTP; 17 Apr 2004 07:32:22 -0000 Received: by pippin.tausq.org (Postfix, from userid 1000) id 461D9CD29F; Sat, 17 Apr 2004 01:05:36 -0700 (PDT) Date: Sat, 17 Apr 2004 07:32:00 -0000 From: Randolph Chung To: gdb-patches@sources.redhat.com Subject: [patch] Fix unwind handling for hppa Message-ID: <20040417080536.GB17842@tausq.org> Reply-To: Randolph Chung Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-GPG: for GPG key, see http://www.tausq.org/gpg.txt User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-04/txt/msg00385.txt.bz2 Frame unwinding on hppa was broken when the frame unwind started at a location before the current frame is created (as noted by the comment below). This patch fixes it and brings the failure count on hppa2.0w-hp-hpux11 down from 1000 to 668, and on hppa-linux from 2700+ to 1214. still some ways to go :) Many thanks to Dan for patiently answering my questions. ok to commit? hppa2.0w-hp-hpux11 results: === gdb Summary === # of expected passes 9348 # of unexpected failures 668 # of unexpected successes 6 # of expected failures 62 # of known failures 21 # of unresolved testcases 12 # of untested testcases 5 # of unsupported tests 15 hppa-unknown-linux results: === gdb Summary === # of expected passes 8663 # of unexpected failures 1214 # of expected failures 46 # of known failures 35 # of unresolved testcases 80 # of untested testcases 9 # of unsupported tests 3 thanks, randolph -- Randolph Chung Debian GNU/Linux Developer, hppa/ia64 ports http://www.tausq.org/ 2004-04-16 Randolph Chung * hppa-tdep.c (hppa_frame_cache): Handle the case when frame unwind starts at a pc before the frame is created. --- gdb/gdb/hppa-tdep.c.orig 2004-04-14 21:49:24.000000000 -0700 +++ gdb/gdb/hppa-tdep.c 2004-04-16 20:19:32.161667784 -0700 @@ -2207,17 +2207,31 @@ the current function (and is thus equivalent to the "saved" stack pointer. */ CORE_ADDR this_sp = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM); - /* FIXME: cagney/2004-02-22: This assumes that the frame has been - created. If it hasn't everything will be out-of-wack. */ - if (u->Save_SP && trad_frame_addr_p (cache->saved_regs, HPPA_SP_REGNUM)) - /* Both we're expecting the SP to be saved and the SP has been - saved. The entry SP value is saved at this frame's SP - address. */ - cache->base = read_memory_integer (this_sp, TARGET_PTR_BIT / 8); + + if (frame_relative_level (next_frame) >= 0 || + frame_pc_unwind (next_frame) >= + hppa_skip_prologue (frame_func_unwind (next_frame))) + { + if (u->Save_SP && trad_frame_addr_p (cache->saved_regs, HPPA_SP_REGNUM)) + { + /* Both we're expecting the SP to be saved and the SP has been + saved. The entry SP value is saved at this frame's SP + address. */ + cache->base = read_memory_integer (this_sp, TARGET_PTR_BIT / 8); + } + else + { + /* The prologue has been slowly allocating stack space. Adjust + the SP back. */ + cache->base = this_sp - frame_size; + } + } else - /* The prologue has been slowly allocating stack space. Adjust - the SP back. */ - cache->base = this_sp - frame_size; + { + /* This frame has not yet been created. */ + cache->base = this_sp; + } + trad_frame_set_value (cache->saved_regs, HPPA_SP_REGNUM, cache->base); }