From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21051 invoked by alias); 11 Oct 2011 10:11:16 -0000 Received: (qmail 21042 invoked by uid 22791); 11 Oct 2011 10:11:14 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 Oct 2011 10:10:54 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RDZIT-00075E-K3 from pedro_alves@mentor.com ; Tue, 11 Oct 2011 03:10:53 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 11 Oct 2011 11:10:51 +0100 From: Pedro Alves To: gdb@sourceware.org Subject: Re: some questions about ranged breakpoints Date: Tue, 11 Oct 2011 10:11:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.1; x86_64; ; ) Cc: Tom Tromey References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201110111110.49848.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-10/txt/msg00053.txt.bz2 On Monday 10 October 2011 21:03:47, Tom Tromey wrote: > While implementing the ambiguous linespec proposal, I've tripped across > an oddity involving ranged breakpoints. I don't think I have access to > a machine that implements these, so I thought I'd ask here. You can always hack the backend to report support. > update_breakpoint_locations has: > > /* Ranged breakpoints have only one start location and one end location. */ > gdb_assert (sals_end.nelts == 0 || (sals.nelts == 1 && sals_end.nelts == 1)); > > But breakpoint_re_set_default has: > > expanded_end = expand_line_sal_maybe (sals_end.sals[0]); > > expand_line_sal_maybe can return a symtabs_and_lines that has multiple > results. This will crash gdb. > > I think you could construct a case using a function which is inlined. > Then set a breakpoint like "break-range foo.h:7, +5". > If breakpoint re-setting discovers multiple locations for the function > (e.g., the inferior loads a .so that has inlined it), then it should > crash. > > What should actually happen here? I think we should remove the assertion, and have each location map to a hardware accelerated ranged breakpoint, instead of assuming there can be only one. This isn't much different from creating a regular (non-range) hardware breakpoint that ends up mapping to more than one location. > I think the simplest approach would be to make such breakpoints not be > resettable. Failing that I suppose they could deactivate if resetting > introduces ambiguity. Any other ideas? Any preferences? > > Also if someone has a use-case for ranged breakpoints I would like to > know what it is. I couldn't think of a situation where I'd use them. Maybe Thiago's original submission casts some more light. I think this is more useful for systems programming than regular app development. E.g., it could be used toe.g., break if anything calls into anywhere within the shared library mapped at "FOO, +BAR", or if anything does a wild jump into this memory mapped area, cause I can't figure out where the wild pointer is. -- Pedro Alves