From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18227 invoked by alias); 6 May 2009 16:51:56 -0000 Received: (qmail 18213 invoked by uid 22791); 6 May 2009 16:51:54 -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; Wed, 06 May 2009 16:51:49 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E02692BAC4D; Wed, 6 May 2009 12:51:46 -0400 (EDT) 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 sO6jB-o+LU5b; Wed, 6 May 2009 12:51:46 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id A657F2BAB40; Wed, 6 May 2009 12:51:46 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id BDA50F5900; Wed, 6 May 2009 09:51:43 -0700 (PDT) Date: Wed, 06 May 2009 16:51:00 -0000 From: Joel Brobecker To: Jan Kratochvil Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [patch] Fix internal error on breaking at a multi-locations caller Message-ID: <20090506165143.GM10734@adacore.com> References: <20090309220736.GA27259@host0.dyn.jankratochvil.net> <20090428203235.GG31821@adacore.com> <20090501091942.GA8465@host0.dyn.jankratochvil.net> <20090501154759.GF10734@adacore.com> <20090501173212.GA31331@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090501173212.GA31331@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.18 (2008-05-17) 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-05/txt/msg00121.txt.bz2 Hi Jan, > gdb/ > 2009-05-01 Joel Brobecker > Jan Kratochvil > > Fix internal error on breaking at a multi-locations caller source line. > * breakpoint.c (parse_breakpoint_sals): Set EXPLICIT_PC for the `break' > command with no parameters. The code part is OK, but I was a little confused by the comment. I think this is because you're talking about your specific scenario whereas I'm ready to bet that the issue can appear without doing an "up" before. My suggestion is to keep it general, but saying something like: "break" without arguments is equivalent to "break *PC" where PC is the default_breakpoint_address. So make sure to set sal.explicit_pc to prevent GDB from trying to expand the list of sals to include all other instances with the same symtab and line. > +# PC should not be at the boundary of source lines to make the original bug > +# exploitable. > + > +set test "p/x \$pc" > +set pc {} > +gdb_test_multiple $test $test { > + -re "\\$\[0-9\]+ = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" { > + set pc $expect_out(1,string) > + pass $test > + } > +} > + > +set test "info line" > +set end {} > +gdb_test_multiple $test $test { > + -re "Line \[0-9\]+ of .* starts at address 0x\[0-9a-f\]+.* and ends at (0x\[0-9a-f\]+).*\\.\r\n$gdb_prompt $" { > + set end $expect_out(1,string) > + pass $test > + } > +} > + > +set test "caller line has trailing code" > +if {$pc != $end} { > + pass $test > +} else { > + fail $test > +} I don't think this is right - the fail here is conditional on the code generated by the compiler on the given platform. If the return address points at the beginning of the next line of code, then our testcase won't allow us to test the issue. But there's no real failure demonstrated at this point. My feeling on this is that we should just do the testing you do after without worrying whether the break address is at the beginning of a line or not. So I'd just ditch the above, and keep the rest of the testcase as is. -- Joel