From owner-freebsd-hackers@FreeBSD.ORG Tue May 16 07:12:50 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1731016A407 for ; Tue, 16 May 2006 07:12:50 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D6C343D58 for ; Tue, 16 May 2006 07:12:47 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.3) with ESMTP id k4G7CfhT006973 for ; Tue, 16 May 2006 11:12:42 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.3/Submit) id k4G7Cf48006972 for freebsd-hackers@freebsd.org; Tue, 16 May 2006 11:12:41 +0400 (MSD) (envelope-from yar) Date: Tue, 16 May 2006 11:12:40 +0400 From: Yar Tikhiy To: freebsd-hackers@freebsd.org Message-ID: <20060516071240.GA6338@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i Subject: Stack frame problem in gdb X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 May 2006 07:12:50 -0000 Hi folks, Has our stock GDB lost the ability to set the current stack frame by its address? In 4.11-STABLE, the old recipe from the Developer's Handbook still works: frame Alas, it no longer works in RELENG_6 or CURRENT (tested on i386 and amd64.) A sample typescript is attached. It boils down to the following: The "frame" command accepts one argument at most in the new GDB, which is taken for the address of a frame if it's sufficiently large. Refusing now to read the instruction pointer value from the command line, GDB sets it to 0 -- a smart guess, damn it. Finally, GDB crashes on the bogus frame it made up. What do you think this is, a GDB bug or my misunderstanding? Thanks! -- Yar ######################################################################## %cat test.c main() { foo(1); } foo(a) int a; { return (a + bar(a)); } bar(x) int x; { return (x * x); } %gcc -g test.c %gdb a.out GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-marcel-freebsd"... (gdb) b bar Breakpoint 1 at 0x80484d7: file test.c, line 15. (gdb) r Starting program: /usr/home/yar/a.out Breakpoint 1, bar (x=1) at test.c:15 15 return (x * x); (gdb) bt #0 bar (x=1) at test.c:15 #1 0x080484c9 in foo (a=1) at test.c:9 #2 0x080484b2 in main () at test.c:3 (gdb) info f 1 Stack frame at 0xbfbfec30: eip = 0x80484c9 in foo (test.c:9); saved eip 0x80484b2 called by frame at 0xbfbfec60, caller of frame at 0xbfbfec10 source language c. Arglist at 0xbfbfec28, args: a=1 Locals at 0xbfbfec28, Previous frame's sp is 0xbfbfec30 Saved registers: ebp at 0xbfbfec28, eip at 0xbfbfec2c (gdb) frame 0xbfbfec30 0x80484c9 Too many args in frame specification (gdb) frame 0xbfbfec30 #0 0x00000000 in ?? () (gdb) info f Stack level 0, frame at 0xbfbfec30: eip = 0x0; saved eip /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/dwarf2-frame.c:613: internal-error: dwarf2_frame_cache: Assertion `fde != NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) ########################################################################