From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26261 invoked by alias); 16 Jan 2008 21:36:45 -0000 Received: (qmail 26251 invoked by uid 22791); 16 Jan 2008 21:36:45 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 16 Jan 2008 21:36:14 +0000 Received: (qmail 19120 invoked from network); 16 Jan 2008 21:36:12 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 16 Jan 2008 21:36:12 -0000 To: Eli Zaretskii Cc: Mark Kettenis , uweigand@de.ibm.com, brobecker@adacore.com, msnyder@specifix.com, gdb-patches@sourceware.org Subject: Re: [RFC/RFA?] Should break FILE:LINENO skip prologue? References: <200801152140.m0FLeMha003566@d12av02.megacenter.de.ibm.com> <200801161034.m0GAYfpk000326@brahms.sibelius.xs4all.nl> From: Jim Blandy Date: Wed, 16 Jan 2008 21:36:00 -0000 In-Reply-To: (Eli Zaretskii's message of "Wed, 16 Jan 2008 20:56:53 +0200") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes 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: 2008-01/txt/msg00417.txt.bz2 Eli Zaretskii writes: >> Date: Wed, 16 Jan 2008 11:34:41 +0100 (CET) >> From: Mark Kettenis >> CC: uweigand@de.ibm.com, brobecker@adacore.com, msnyder@specifix.com, >> gdb-patches@sourceware.org >> >> > Btw, the manual does not say *EXPRESSION, it says *ADDRESS. >> >> That's fine as long as the manual says that ADDRESS is parsed as an >> expression in the current language. > > It doesn't. It says it "may be any expression", which is vague, even > inaccurate. > >> > Anyway, if "break *FILENAME:FUNCTION" does not need to work, then how >> > does one set a breakpoint on the entry point of FILENAME:FUNCTION, >> > after the suggested change that makes "break FUNCTION" behave >> > differently than "break *FUNCTION"? >> >> Joel's change does not change how "break FUNCTION" works at all. It >> changes what "break LINE" does in the case where LINE doesn't >> correspond to an actual line of source code, and makes it more similar >> to what "break FUNCTION" does, which is putting the breakpoint on the >> first line of actual code in a function. > > My question was about putting the breakpoint on the beginning of the > prolog of a function in another file, not about "break FUNCTION" or > "break LINE". You didn't answer my question: how does one put a > breakpoint on that address. For a function in the current file, or > one whose name identifies it unambiguously, "break *FUNCTION" is the > solution. But what about the case where FUNCTION alone is not enough > to unambiguously specify a function? GDB allows 'FILENAME'::FUNCTION in C expressions: $ cat u.mk CC = gcc CFLAGS = -g3 u: u1.o u2.o $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ clean: rm -f u u1.o u2.o $ cat u1.c #include void e (void); static void s (void) { puts ("u1.c: s"); } int main (int argc, char **argv) { s (); e (); return 0; } $ cat u2.c #include static void s (void) { puts ("u2.c: s"); } void e (void) { puts ("u2.c: e"); s (); } $ make -f u.mk gcc -g3 -c -o u1.o u1.c gcc -g3 -c -o u2.o u2.c gcc u1.o u2.o -o u $ ~/gdb/pub/nat/gdb/gdb u GNU gdb 6.7.50.20080111-cvs Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... (gdb) print 'u1.c'::s $1 = {void (void)} 0x8048384 (gdb) print 'u2.c'::s $2 = {void (void)} 0x80483c4 (gdb) break *'u1.c'::s Breakpoint 1 at 0x8048384: file u1.c, line 7. (gdb) break *'u2.c'::s Breakpoint 2 at 0x80483c4: file u2.c, line 5. (gdb)