From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26295 invoked by alias); 4 Mar 2004 10:10:55 -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 26286 invoked from network); 4 Mar 2004 10:10:53 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.115.144) by sources.redhat.com with SMTP; 4 Mar 2004 10:10:53 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i24AAq0u003081 for ; Thu, 4 Mar 2004 11:10:52 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i24AAqEU003179 for ; Thu, 4 Mar 2004 11:10:52 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i24AAqc2003176; Thu, 4 Mar 2004 11:10:52 +0100 (CET) Date: Thu, 04 Mar 2004 10:10:00 -0000 Message-Id: <200403041010.i24AAqc2003176@elgar.kettenis.dyndns.org> From: Mark Kettenis To: gdb-patches@sources.redhat.com Subject: [PATCH] Fix SPARC backtraces X-SW-Source: 2004-03.o/txt/msg00069.txt As discussed before on the list, this makes sure we do the full frame analysis even if %fp is zero. This makes us do proper backtraces if a frameless function was called from the outermost frame. Committed to mainline, Mark Index: ChangeLog from Mark Kettenis * sparc-tdep.c (sparc_frame_cache): Don't bail out if %fp is zero. Reorganize code a bit. Index: sparc-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/sparc-tdep.c,v retrieving revision 1.149 diff -u -p -r1.149 sparc-tdep.c --- sparc-tdep.c 7 Feb 2004 20:40:35 -0000 1.149 +++ sparc-tdep.c 4 Mar 2004 10:03:28 -0000 @@ -615,14 +615,6 @@ sparc_frame_cache (struct frame_info *ne cache = sparc_alloc_frame_cache (); *this_cache = cache; - /* In priciple, for normal frames, %fp (%i6) holds the frame - pointer, which holds the base address for the current stack - frame. */ - - cache->base = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); - if (cache->base == 0) - return cache; - cache->pc = frame_func_unwind (next_frame); if (cache->pc != 0) { @@ -632,10 +624,18 @@ sparc_frame_cache (struct frame_info *ne if (cache->frameless_p) { - /* We didn't find a valid frame, which means that CACHE->base - currently holds the frame pointer for our calling frame. */ - cache->base = frame_unwind_register_unsigned (next_frame, - SPARC_SP_REGNUM); + /* This function is frameless, so %fp (%i6) holds the frame + pointer for our calling frame. Use %sp (%o6) as this frame's + base address. */ + cache->base = + frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + } + else + { + /* For normal frames, %fp (%i6) holds the frame pointer, the + base address for the current stack frame. */ + cache->base = + frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); } return cache; From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26295 invoked by alias); 4 Mar 2004 10:10:55 -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 26286 invoked from network); 4 Mar 2004 10:10:53 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.115.144) by sources.redhat.com with SMTP; 4 Mar 2004 10:10:53 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i24AAq0u003081 for ; Thu, 4 Mar 2004 11:10:52 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i24AAqEU003179 for ; Thu, 4 Mar 2004 11:10:52 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i24AAqc2003176; Thu, 4 Mar 2004 11:10:52 +0100 (CET) Date: Fri, 19 Mar 2004 00:09:00 -0000 Message-ID: <200403041010.i24AAqc2003176@elgar.kettenis.dyndns.org> From: Mark Kettenis To: gdb-patches@sources.redhat.com Subject: [PATCH] Fix SPARC backtraces X-SW-Source: 2004-03/txt/msg00069.txt.bz2 Message-ID: <20040319000900.dUogzvfoS2KfK4vXSFD4k1BiOb2Y6f8olw5jY2PbeOs@z> As discussed before on the list, this makes sure we do the full frame analysis even if %fp is zero. This makes us do proper backtraces if a frameless function was called from the outermost frame. Committed to mainline, Mark Index: ChangeLog from Mark Kettenis * sparc-tdep.c (sparc_frame_cache): Don't bail out if %fp is zero. Reorganize code a bit. Index: sparc-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/sparc-tdep.c,v retrieving revision 1.149 diff -u -p -r1.149 sparc-tdep.c --- sparc-tdep.c 7 Feb 2004 20:40:35 -0000 1.149 +++ sparc-tdep.c 4 Mar 2004 10:03:28 -0000 @@ -615,14 +615,6 @@ sparc_frame_cache (struct frame_info *ne cache = sparc_alloc_frame_cache (); *this_cache = cache; - /* In priciple, for normal frames, %fp (%i6) holds the frame - pointer, which holds the base address for the current stack - frame. */ - - cache->base = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); - if (cache->base == 0) - return cache; - cache->pc = frame_func_unwind (next_frame); if (cache->pc != 0) { @@ -632,10 +624,18 @@ sparc_frame_cache (struct frame_info *ne if (cache->frameless_p) { - /* We didn't find a valid frame, which means that CACHE->base - currently holds the frame pointer for our calling frame. */ - cache->base = frame_unwind_register_unsigned (next_frame, - SPARC_SP_REGNUM); + /* This function is frameless, so %fp (%i6) holds the frame + pointer for our calling frame. Use %sp (%o6) as this frame's + base address. */ + cache->base = + frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + } + else + { + /* For normal frames, %fp (%i6) holds the frame pointer, the + base address for the current stack frame. */ + cache->base = + frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); } return cache;