From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 83232393A400 for ; Sun, 9 May 2021 00:36:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 83232393A400 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 1490ZuEb017341 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 8 May 2021 20:36:01 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 1490ZuEb017341 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (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 6461E1E813; Sat, 8 May 2021 20:35:56 -0400 (EDT) Subject: Re: [PATCH 3/4] gdb/py: add some debugging to py-breakpoint.c To: Andrew Burgess , gdb-patches@sourceware.org References: From: Simon Marchi Message-ID: Date: Sat, 8 May 2021 20:35:56 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sun, 9 May 2021 00:35:56 +0000 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 00:36:03 -0000 On 2021-05-08 1:07 p.m., Andrew Burgess wrote: > Adds some new debugging to python/py-breakpoint.c. > > gdb/ChangeLog: > > * python/py-breakpoint.c (pybp_debug): New static global. > (show_pybp_debug): New function. > (pybp_debug_printf): Define. > (PYBP_SCOPED_DEBUG_ENTER_EXIT): Define. > (gdbpy_breakpoint_created): Add some debugging. > (gdbpy_breakpoint_deleted): Likewise. > (gdbpy_breakpoint_modified): Likewise. > (_initialize_py_breakpoint): New function. > > gdb/doc/ChangeLog: > > * python.texinfo (Python Commands): Document 'set debug > py-breakpoint' and 'show debug py-breakpoint'. > --- > gdb/ChangeLog | 11 +++++++ > gdb/doc/ChangeLog | 5 ++++ > gdb/doc/python.texi | 11 +++++++ > gdb/python/py-breakpoint.c | 59 ++++++++++++++++++++++++++++++++++++-- > 4 files changed, 83 insertions(+), 3 deletions(-) > > diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi > index 482d328de44..6d45e98a8af 100644 > --- a/gdb/doc/python.texi > +++ b/gdb/doc/python.texi > @@ -153,6 +153,17 @@ > the @code{script-extension} setting. @xref{Extending GDB, ,Extending GDB}. > @end table > > +The following commands are intended to help debug @value{GDBN} itself: > + > +@table @code > +@kindex set debug py-breakpoint > +@kindex show debug py-breakpoint > +@item set debug py-breakpoint on@r{|}off > +@itemx show debug py-breakpoint > +When @samp{on} @value{GDBN} prints debug messages related to the > +Python breakpoint API. This is @samp{off} by default. > +@end table > + > @node Python API > @subsection Python API > @cindex python api > diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c > index b4140713613..8bae0f830f9 100644 > --- a/gdb/python/py-breakpoint.c > +++ b/gdb/python/py-breakpoint.c > @@ -34,6 +34,29 @@ > #include "py-event.h" > #include "linespec.h" > > +/* Debugging of Python breakpoints. */ > + > +static bool pybp_debug; > + > +/* Implementation of "show debug py-unwind". */ py-unwind -> py-breakpoint > + > +static void > +show_pybp_debug (struct ui_file *file, int from_tty, > + struct cmd_list_element *c, const char *value) > +{ > + fprintf_filtered (file, _("Python breakpoint debugging is %s.\n"), value); > +} > + > +/* Print an "py-breakpoint" debug statement. */ > + > +#define pybp_debug_printf(fmt, ...) \ > + debug_prefixed_printf_cond (pybp_debug, "py_breakpoint",fmt, ##__VA_ARGS__) Same space missing. OK, ok, I'll push a patch to fix this once I'm done reviewing. > + > +/* Print "py-breakpoint" enter/exit debug statements. */ > + > +#define PYBP_SCOPED_DEBUG_ENTER_EXIT \ > + scoped_debug_enter_exit (pybp_debug, "py_breakpoint") Same comment as the previous patch, I would suggest "py-breakpoint". Otherwise, LGTM. Simon