From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28269 invoked by alias); 9 Dec 2019 21:37:50 -0000 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 Received: (qmail 28261 invoked by uid 89); 9 Dec 2019 21:37:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=pushing, H*M:8dd3 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Dec 2019 21:37:49 +0000 Received: from [132.207.245.28] (Sansfil-Securise-Etudiants-Lassonde-245-28.polymtl.ca [132.207.245.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 853211E08E; Mon, 9 Dec 2019 16:37:47 -0500 (EST) Subject: Re: [PATCH v2] Fix scripted probe breakpoints To: George Barrett , gdb-patches@sourceware.org References: From: Simon Marchi Message-ID: Date: Mon, 09 Dec 2019 21:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-12/txt/msg00361.txt.bz2 On 2019-12-09 4:28 p.m., George Barrett wrote: > The documentation for make-breakpoint from the Guile API and the `spec' > variant of the gdb.Breakpoint constructor from the Python API state that > the format acceptable for location strings is the same as that accepted > by the break command. However, using the -probe qualifier at the > beginning of the location string causes a GDB internal error as it > attempts to decode a probe location in the wrong code path. Without this > functionality, there doesn't appear to be another way to set breakpoints > on probe points from Python or Guile scripts. > > This patch introduces a new helper function that returns a > breakpoint_ops instance appropriate for a parsed location and updates > the Guile and Python bindings to use said function, rather than the > current hard-coded use of bkpt_breakpoint_ops. Since this logic is > duplicated in the handling of the `break' and `trace' commands, those > are also updated to call into the new helper function. Thanks, that LGTM. I presume you don't have push access, so would you like me to push the patch on your behalf? I found some other really small nits, I'll fix them before pushing if I end up pushing for you. > +/* See breakpoint.h. */ > + > +const struct breakpoint_ops * > +breakpoint_ops_for_event_location (const struct event_location *location, > + bool is_tracepoint) > +{ > + if (location) I missed this last time, but also in GNU style we compare pointers and integers explicitly, so either one of these would be good: if (location != NULL) if (location != nullptr) > diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h > index a9d689d02a..071ae79d68 100644 > --- a/gdb/breakpoint.h > +++ b/gdb/breakpoint.h > @@ -1352,6 +1352,15 @@ extern void init_catchpoint (struct breakpoint *b, > extern void install_breakpoint (int internal, std::unique_ptr &&b, > int update_gll); > > +/* Returns the breakpoint ops appropriate for use with with LOCATION and > + according to IS_TRACEPOINT. Use this to ensure, for example, that you pass > + the correct ops to create_breakpoint for probe locations. If LOCATION is > + null, returns bkpt_breakpoint_ops (or tracepoint_breakpoint_ops, if I would change null to NULL or nullptr to match the language nomenclature. > + IS_TRACEPOINT is non-zero). */ non-zero -> true Simon