From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2848 invoked by alias); 23 Feb 2009 00:17:02 -0000 Received: (qmail 2840 invoked by uid 22791); 23 Feb 2009 00:17:01 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Feb 2009 00:16:55 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 50AFE2BAB5F; Sun, 22 Feb 2009 19:16:56 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id a2HzlX4rq8B8; Sun, 22 Feb 2009 19:16:56 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 1D1C82BAB5E; Sun, 22 Feb 2009 19:16:55 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 6C907E7ACD; Sun, 22 Feb 2009 16:16:51 -0800 (PST) Date: Mon, 23 Feb 2009 00:51:00 -0000 From: Joel Brobecker To: Nick Roberts Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] PR backtrace/9786 Message-ID: <20090223001651.GA26056@adacore.com> References: <18849.13514.379735.375860@kahikatea.snap.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18849.13514.379735.375860@kahikatea.snap.net.nz> User-Agent: Mutt/1.4.2.2i 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: 2009-02/txt/msg00422.txt.bz2 The problem was reported as follow: Doing an "info frame" right after connecting to a remote target started through the gdbserver causes a failed assertion: (gdb) target remote localhost:4444 Remote debugging using localhost:4444 0xb7fda810 in ?? () from /lib/ld-linux.so.2 (gdb) info frame Stack level 0, frame at 0x0: eip = 0xb7fda810; saved eip findvar.c:299: internal-error: value_of_register_lazy: Assertion `frame_id_p (get_frame_id (frame))' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) The problem occurs when trying to print the frame's return address (saved eip ...). Of course, since the program has just been spawned but hasn't started running yet, there is no return address... The fix suggested by Nick is the following: > @@ -976,7 +977,12 @@ frame_info (char *addr_exp, int from_tty > puts_filtered ("; "); > wrap_here (" "); > printf_filtered ("saved %s ", pc_regname); > - fputs_filtered (paddress (frame_pc_unwind (fi)), gdb_stdout); > + value = frame_unwind_register_value (fi, gdbarch_pc_regnum (gdbarch)); > + if (VALUE_LVAL (value) == lval_register > + && !(frame_id_p (VALUE_FRAME_ID (value)))) > + printf_filtered ("none"); > + else > + fputs_filtered (paddress (frame_pc_unwind (fi)), gdb_stdout); > printf_filtered ("\n"); I wonder if it wouldn't be better to do a "get_prev_frame" and check that this frame is valid, and if valid, then get the PC from this prev_frame. What do others think? -- Joel