From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8731 invoked by alias); 3 May 2011 10:22:19 -0000 Received: (qmail 8723 invoked by uid 22791); 3 May 2011 10:22:18 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 May 2011 10:22:04 +0000 Received: (qmail 903 invoked from network); 3 May 2011 10:22:03 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 3 May 2011 10:22:03 -0000 From: Pedro Alves To: gdb@sourceware.org Subject: Re: Breakpoint duplication over new inferiors Date: Tue, 03 May 2011 10:22:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-28-generic; KDE/4.6.2; x86_64; ; ) Cc: Kevin Pouget References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201105031122.08202.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00015.txt.bz2 On Tuesday 03 May 2011 10:30:28, Kevin Pouget wrote: > Hello, > > I'd like to understand how breakpoints are supposed to be duplicated > when a new inferior is started/attached (in my cases)/forked. > > Namely, with a code like: > > > > 1 int main() { > > 2 if (fork()) { > > 3 send (0,0,0); > > 4 } else { > > 5 recv(0,0,0) ; > > 6 } > > 7 } > > and > > > > (gdb) b main > > Breakpoint 1 at 0x400558: file fork.c, line 2. > > (gdb) b send > > Breakpoint 2 at 0x400448 > > (gdb) set detach-on-fork off > > (gdb) run > > ... > > (gdb) info breakpoint > > Num Type Disp Enb Address What > > 1 breakpoint keep y > > breakpoint already hit 1 time > > 1.1 y 0x0000000000400558 in main at fork.c:2 inf 2 > > 1.2 y 0x0000000000400558 in main at fork.c:2 inf 1 > > 2 breakpoint keep y 0x0000003cbd0e1a60 inf 1 > > it seems that `libc' breakpoints are not correctly duplicated. > According to my investigation, the difference occurs in > > breakpoint.c:addr_string_to_sals -- sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, NULL); > > which doesn't return two locations, but only one ... > is it a bug? any idea what to do to solve it? This is currently done by expand_line_sal_maybe -> expand_line_sal, not by decode_line_1 returning multiple sals. Looks like it isn't working on breakpoints set on symbols for which there is no debug info. (the matching is currently done by file/lineno currently, IIRC, for lack of better mechanism). -- Pedro Alves