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 97D823858D37 for ; Sat, 16 Sep 2023 10:55:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 97D823858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.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 1qhSxa-0008VR-S9; Sat, 16 Sep 2023 06:55:34 -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=xM/YrSDA04h9pG05vnZHIC6h9Dfthxos9taguVMZQ38=; b=DmvjIyEYh/Nx tc6OtukF/iPX9af5lww+8XjMc8iEJMDDwNyVS4wtgxmEIhw9WWGGociWniMdj6Sgnq0ThuRvtAy/k 3+2g79La+0fd7UJ22JjnIKF/ctYRJX7vKuaO1aXAPAI5pS3dEdDVYcWvqXd6vU8lckV5r9lZsjxVb 5ldf5GM3g5szbpJty7xUbBd/YFxgkViQUe9BFu6uE/JXER3KeqAn4FAzGLxCY2FFmAPAxqYecRznJ usx8tpRkK40bKhyBJ7mnE7RZmcOwlrj+ZM2hprRceUvrCPRrnFxf6OgYI61JGcjqr/iWepg/JoD5e KZQ74IWISwqd63sFIFNGEQ==; Date: Sat, 16 Sep 2023 13:55:29 +0300 Message-Id: <83bke2idzy.fsf@gnu.org> From: Eli Zaretskii To: Andrew Burgess Cc: gdb-patches@sourceware.org In-Reply-To: <4c77a079079814ae5d476b5fc61b2e25539bd37f.1694858967.git.aburgess@redhat.com> (message from Andrew Burgess via Gdb-patches on Sat, 16 Sep 2023 11:18:04 +0100) Subject: Re: [PATCH 3/9] gdb/python: new Progspace.executable_filename attribute References: <4c77a079079814ae5d476b5fc61b2e25539bd37f.1694858967.git.aburgess@redhat.com> X-Spam-Status: No, score=-5.4 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: > Date: Sat, 16 Sep 2023 11:18:04 +0100 > From: Andrew Burgess via Gdb-patches > > Add a new Progspace.executable_filename attribute that contains the > path to the executable for this program space, or None if no > executable is set. > > The path within this attribute will be set by the "exec-file" and/or > "file" commands. > > Accessing this attribute for an invalid program space will raise an > exception. > > This new attribute is similar too, but not the same as the existing > gdb.Progspace.filename attribute. If I could change the past, I'd > change the 'filename' attribute to 'symbol_filename', which is what it > actually represents. The old attribute will be set by the > 'symbol-file' command, while the new attribute is set by the > 'exec-file' command. Obviously the 'file' command sets both of these > attributes. > --- > gdb/NEWS | 6 ++ > gdb/doc/python.texi | 15 ++++ > gdb/python/py-progspace.c | 21 +++++ > gdb/testsuite/gdb.python/py-exec-file.c | 22 +++++ > gdb/testsuite/gdb.python/py-exec-file.exp | 100 ++++++++++++++++++++++ > 5 files changed, 164 insertions(+) > create mode 100644 gdb/testsuite/gdb.python/py-exec-file.c > create mode 100644 gdb/testsuite/gdb.python/py-exec-file.exp Thanks. > diff --git a/gdb/NEWS b/gdb/NEWS > index f2f5dabb287..93bc9c6a2c0 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -291,6 +291,12 @@ info main > Progspace.filename is not None), otherwise, this attribute is > itself None. > > + ** New attribute Progspace.executable_filename. This attribute > + holds a string containing a path set by the "exec-file" or "file" > + commands, or None if no executable file is set. This isn't the > + exact string passed by the user to these commands; the path will > + have been partially resolved to an absolute path. GNU Coding Standards frown on using "path" for anything but PATH-style directory lists. So please use "file name" here. > diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi > index 03299cc3cf7..206cf6b4e18 100644 > --- a/gdb/doc/python.texi > +++ b/gdb/doc/python.texi > @@ -5059,6 +5059,21 @@ > access this attribute will raise a @code{RuntimeError} exception. > @end defvar > > +@defvar Progspace.executable_filename > +The file name, as a string, of the executable file in use by this > +program space. The executable file is the file that @value{GDBN} will > +invoke in order to start an inferior when using a native target. The > +file name within this attribute is updated by the @kbd{exec-file} and > +@kbd{file} commands. > + > +If no executable is currently set within this @code{Progspace} then > +this attribute contains @code{None}. > + > +If the @code{Progspace} is invalid, i.e.@:, when > +@code{Progspace.is_valid()} returns @code{False}, then attempting to > +access this attribute will raise a @code{RuntimeError} exception. > +@end defvar This part is OK. Reviewed-By: Eli Zaretskii