From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 25EF43858C35 for ; Wed, 18 Oct 2023 12:08:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 25EF43858C35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 25EF43858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697630897; cv=none; b=WcUWxXi9c3rq7apN90TZNQK6I+X+LV/MkNSjeNpRQ2WgFuKsJXmRjh1Q2hNcK+WdtYyXc+lbaN9m/OC/DOhPHFV7/3k8HO/j4dCh6abGSb1DGWdVS1Kevto4Lbe1D4z/acr7pRsRmCVVUreOd4C5m6JYdwZwWIvoC5zRmgxWFXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697630897; c=relaxed/simple; bh=Q8YFNblNhefjs3r7iRywd5RQZIoy/ApAohNriuiN27E=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=AvpBJmgUAXQ5m4fRb6BBURVuJPPzFxbgr1VD0SdAv6Trsy/XVPJXO6f+zngHM39gLe5qM67oZywJiJHFC+P68x4AdrvDXRfescGGfijEBxqdLXSl0UW3NF56eQiddXnc++KzB7FtXSLvmKZXAqm+AcyvYHgBM9PRe8INFBGkQ5A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt5LT-0004Av-H1; Wed, 18 Oct 2023 08:08:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=983QgHSp7A4pTsJJMhL8tZsBQQ1uj7IbhUDzvQ5aU5s=; b=E57riteL6d9c tDpaMflzxlORcsAr1C1zVF/8vvw971lfarfwakD4dDlk78xu8nwbXoDuiFFza3ALjXxClBqNEvk6+ BuUr3KgWvMfXwiYVL7QX5tfvyReAM0KAdCLx/IgyWQ1YbgTkppETA9llI8j6X+9EwBkFGz3sud1VQ 0k0xppO2hNnA8RLb4a/BqoU0hFqYieC/yxQB1BrjSBqT1jDN5z1+aRGHEvPuAXM08q3+VGRhNQuaE x7ICkTtq1CBFzxD0wQKFK+tJZMPkgLqBpZyZ5tViUjXPGloJwEjHjhhI5+MdyBj1YjBTajN/l7Nn5 2t+PGFUmNuMgQw+ffXiA+A==; Date: Wed, 18 Oct 2023 15:08:04 +0300 Message-Id: <837cnknnff.fsf@gnu.org> From: Eli Zaretskii To: Andrew Burgess Cc: gdb-patches@sourceware.org In-Reply-To: (message from Andrew Burgess on Wed, 18 Oct 2023 11:53:23 +0100) Subject: Re: [PATCH 5/5] gdb: implement missing debug handler hook for Python References: X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > From: Andrew Burgess > Cc: Andrew Burgess > Date: Wed, 18 Oct 2023 11:53:23 +0100 > > gdb/NEWS | 26 + > gdb/data-directory/Makefile.in | 2 + > gdb/doc/python.texi | 136 +++++ > gdb/python/lib/gdb/__init__.py | 41 ++ > gdb/python/lib/gdb/command/missing_debug.py | 226 +++++++++ > gdb/python/lib/gdb/missing_debug.py | 169 +++++++ > gdb/python/py-progspace.c | 51 ++ > gdb/python/python.c | 83 ++- > gdb/testsuite/gdb.python/py-missing-debug.c | 22 + > gdb/testsuite/gdb.python/py-missing-debug.exp | 473 ++++++++++++++++++ > gdb/testsuite/gdb.python/py-missing-debug.py | 120 +++++ > 11 files changed, 1348 insertions(+), 1 deletion(-) > create mode 100644 gdb/python/lib/gdb/command/missing_debug.py > create mode 100644 gdb/python/lib/gdb/missing_debug.py > create mode 100644 gdb/testsuite/gdb.python/py-missing-debug.c > create mode 100644 gdb/testsuite/gdb.python/py-missing-debug.exp > create mode 100644 gdb/testsuite/gdb.python/py-missing-debug.py Thanks. > diff --git a/gdb/NEWS b/gdb/NEWS > index 81264c0cfb3..509586b9589 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -6,11 +6,37 @@ > * GDB index now contains information about the main function. This speeds up > startup when it is being used for some large binaries. > > +* New Commands > + > +info missing-debug-handler > + List all the registered missing debug handlers. > + > +enable missing-debug-handler LOCUS HANDLER > +disable missing-debug-handler LOCUS HANDLER > + Enable or disable a missing debug handler with a name matching the > + regular expression HANDLER, in LOCUS. > + > + LOCUS can be 'global' to operate on global missing debug handler, > + 'progspace' to operate on handlers within the current program space, > + or can be a regular expression which is matched against the filename > + of the primary executable in each program space. > + > * Python API > > ** New function gdb.notify_mi(NAME, DATA), that emits custom > GDB/MI async notification. > > + ** New module gdb.missing_debug that facilitates dealing with > + objfiles that are missing any debug information. > + > + ** New function gdb.missing_debug.register_handler that can register > + an instance of a sub-class of gdb.missing_debug.MissingDebugInfo > + as a handler for objfiles that are missing debug information. > + > + ** New class gdb.missing_debug.MissingDebugInfo which can be > + sub-classed to create handlers for objfiles with missing debug > + information. > + > *** Changes in GDB 14 > > * GDB now supports the AArch64 Scalable Matrix Extension 2 (SME2), which This part is OK. > +If @value{GDBN} fails to locate any debug information for a particular > +objfile, there is an opportunity for a Python extension to step in. A > +Python extension can potentially locate the missing debug information > +using some platform, or project, specific steps, and inform > +@value{GDBN} of its location. Or a Python extension might provide > +some platform, or project specific advice to the user about how to > +obtain the missing debug information. I suggest to use "platform- or project-specific steps" here. That is, use a dash instead of a comma. > +A missing debug information Python extension consists of a handler > +object which has the @code{name} and @code{enabled} attributes, and > +implements the @code{__call__} method. When @value{GDBN} encounters > +an objfile for which it is unable to find any debug information the > +@code{__call__} method is invoked. The last sentence uses passive tense unnecessarily. Suggest to reword: When @value{GDBN} encounters an objfile for which it is unable to find any debug information, it invokes the @code{__call__} method. > +The @code{MissingDebugHandler} is a base class from which user created Suggest to use "user-created", with a dash (here and elsewhere). > +@defun MissingDebugHandler.__init__ (name) > +The @var{name} is a string used to reference this unwinder within some ^^^^^^^^ "unwinder"? Reviewed-By: Eli Zaretskii