From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7747 invoked by alias); 13 Feb 2003 23:27:16 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 7740 invoked from network); 13 Feb 2003 23:27:16 -0000 Received: from unknown (HELO mx1.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 13 Feb 2003 23:27:16 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h1DNRGf28094 for ; Thu, 13 Feb 2003 18:27:16 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h1DNRFa24426; Thu, 13 Feb 2003 18:27:15 -0500 Received: from localhost.localdomain (vpnuser1.stuttgart.redhat.com [172.16.4.1]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h1DNRD907015; Thu, 13 Feb 2003 18:27:13 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h1DNR6308199; Thu, 13 Feb 2003 16:27:06 -0700 Date: Thu, 13 Feb 2003 23:27:00 -0000 From: Kevin Buettner Message-Id: <1030213232706.ZM8198@localhost.localdomain> In-Reply-To: Kevin Buettner "Re: frame_register_unwind(): "frame != NULL" assertion failure" (Feb 13, 2:48pm) References: <1030213212349.ZM2427@localhost.localdomain> <20030213212904.GA14115@nevyn.them.org> <1030213213526.ZM2489@localhost.localdomain> <1030213214819.ZM2541@localhost.localdomain> To: Andrew Cagney Subject: Re: frame_register_unwind(): "frame != NULL" assertion failure Cc: gdb@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-02/txt/msg00220.txt.bz2 Here's one possible "fix" for the assertion failure. I've come to the conclusion that the real culprit is get_next_frame(), but, unfortunately, the rest of gdb is not yet ready for it to return the sentinel frame. (See the comment in the patch for more info.) So, until it is, I propose that we use this hack... * frame.c (create_sentinel_frame): Make static. Add forward declaration. (frame_register_unwind): Add hack for converting NULL frames into a sentinel frame. Index: frame.c =================================================================== RCS file: /cvs/src/src/gdb/frame.c,v retrieving revision 1.66 diff -u -p -r1.66 frame.c --- frame.c 2 Feb 2003 20:31:43 -0000 1.66 +++ frame.c 13 Feb 2003 23:20:22 -0000 @@ -39,6 +39,8 @@ #include "command.h" #include "gdbcmd.h" +static struct frame_info * create_sentinel_frame (struct regcache *regcache); + /* Flag to indicate whether backtraces should stop at main. */ static int backtrace_below_main; @@ -180,6 +182,15 @@ frame_register_unwind (struct frame_info gdb_assert (realnump != NULL); /* gdb_assert (bufferp != NULL); */ + /* Note: kevinb/2003-02-13: This is a hack. The problem is that + get_next_frame() can return NULL when it really ought to be + returning the sentinel frame. So, when we detect frame == NULL, + just use the sentinel frame instead. + FIXME: Remove this hack once get_next_frame() has been fixed + to never return NULL. */ + if (frame == NULL) + frame = create_sentinel_frame (current_regcache); + /* NOTE: cagney/2002-11-27: A program trying to unwind a NULL frame is broken. There is always a frame. If there, for some reason, isn't, there is some pretty busted code as it should have @@ -429,7 +440,7 @@ frame_map_regnum_to_name (int regnum) /* Create a sentinel frame. */ -struct frame_info * +static struct frame_info * create_sentinel_frame (struct regcache *regcache) { struct frame_info *frame = FRAME_OBSTACK_ZALLOC (struct frame_info);