From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9701 invoked by alias); 8 Dec 2003 16:48:00 -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 9693 invoked from network); 8 Dec 2003 16:47:58 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 8 Dec 2003 16:47:58 -0000 Received: from drow by nevyn.them.org with local (Exim 4.24 #1 (Debian)) id 1ATOY7-0007d5-Da; Mon, 08 Dec 2003 11:47:55 -0500 Date: Mon, 08 Dec 2003 16:48:00 -0000 From: Daniel Jacobowitz To: fnf@ninemoons.com Cc: gdb-patches@sources.redhat.com Subject: Re: [PATCH] - Accept optional printed address at function breakpoints Message-ID: <20031208164754.GA29159@nevyn.them.org> Mail-Followup-To: fnf@ninemoons.com, gdb-patches@sources.redhat.com References: <200312081625.hB8GP6vB017846@fred.ninemoons.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200312081625.hB8GP6vB017846@fred.ninemoons.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-12/txt/msg00254.txt.bz2 On Mon, Dec 08, 2003 at 09:25:06AM -0700, Fred Fish wrote: > I decided to investigate the following failure in funcargs.exp: > > FAIL: gdb.base/funcargs.exp: continue to call6k > > The problem can reproduced using: > > void foo () > { > } > > void bar () > { > static int dummy = 0; > } > > main () > { > foo (); > bar (); > } > > Using x86 native gdb: > > $ gcc -g -o x x.c What GCC version? > (1) Both functions stop at the same relative position in each of > foo() and bar(). Gdb is smart enough to break at the first > instruction after the prologue. > > (2) The breakpoint message for bar() does NOT include an address, > while the one for foo() does contain an address. This is a debug info bug. Your patch is not correct; when you say "break LINE" or "break FUNCTION" and there is debug info, it's GDB's established behavior to stop at the beginning of a line. By not allowing the address we verify that GDB is stopping at the beginning of a line as expected. > 00000000 : > foo(): > /build/sourceware/gdb/T-i686-pc-linux-gnu/gdb/x.c:2 > 0: 55 push %ebp > 1: 89 e5 mov %esp,%ebp > 3: 5d pop %ebp > 4: c3 ret This doesn't tell you anything. Objdump -S will coalesce identical line notes. You need to look at the debug info. For instance: 08048334 : void foo () { 8048334: 55 push %ebp 8048335: 89 e5 mov %esp,%ebp 8048337: 5d pop %ebp 8048338: c3 ret 08048339 : } void bar () { 8048339: 55 push %ebp 804833a: 89 e5 mov %esp,%ebp static int dummy = 0; } 804833c: 5d pop %ebp 804833d: c3 ret Line Number Statements: Extended opcode 2: set Address to 0x8048334 Special opcode 6: advance Address by 0 to 0x8048334 and Line by 1 to 2 Special opcode 47: advance Address by 3 to 0x8048337 and Line by 0 to 2 Special opcode 36: advance Address by 2 to 0x8048339 and Line by 3 to 5 Special opcode 49: advance Address by 3 to 0x804833c and Line by 2 to 7 Special opcode 35: advance Address by 2 to 0x804833e and Line by 2 to 9 Special opcode 230: advance Address by 16 to 0x804834e and Line by 1 to 10 Special opcode 76: advance Address by 5 to 0x8048353 and Line by 1 to 11 Special opcode 76: advance Address by 5 to 0x8048358 and Line by 1 to 12 Advance PC by 2 to 804835a Extended opcode 1: End of Sequence Notice the special opcode 47 which advances address, but not line? GDB recognizes that and uses it to find the end of the prologue. If you haven't got one of those, something is wrong. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer