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 1A3643858416 for ; Fri, 15 Mar 2024 12:39:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A3643858416 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 1A3643858416 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=1710506397; cv=none; b=xtEDV1vE0YbZ2NwWGBniipHhkD7q6JkNWKlGTjSCsHNcVDMDaYIdyv9SxZkmXlyMcCUL7VkeFM86P7KFNKfaJrU43+lx9fFWPXwFs/lTCAbr62OPwG0bqCM87aFG1sm4aCD48nILlzEVyzg6hz3XrxkVuaG6RcN9WGqtl9rZIMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710506397; c=relaxed/simple; bh=ILA0zqG1R3TlnohmNu4KQWviDOwiCFBd5VwnphoPf6s=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=FirNsDpX8GJJqGaVnKVj2XS6wvuiJSHIIPc1J0r71o3zc14S91w0h9EMaPOmYD8eARb++u2kuTCu6RhEHMOdMAUsaVTrBriOQ300LSGvmqqm4mnbscGSYVv8zfM5EsJzddr7kqD8Amm75C9zFS1Y3iQZNKBrVqvDrkmRy8UJba8= 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 1rl6qp-0000FH-Jl; Fri, 15 Mar 2024 08:39:55 -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=BmgkV/g3zNFfVHKTePXlXIsOXKUvcrZsMjPRcmfpuj8=; b=X8qWrxg7F9nG G/c2PJ80zykui1xEP91WOyp7TbuB2D1ebluerOXju3yUwEXAS4xl2ba0T23sZWsqiSeoLHWd6R3rI Va29FbnPAwATQjeMGJfsZmJMbl4RAYieblBWC7WemEciE5NmQEe3WyOfsOYzj64B65V8a/JZvALE3 PtOJlCi78kFOm0u0LkhV9FSi05t52G8ZWg6daIiNrJ0rlOrMIRFXg1JJMQu4NGfRHyN6yFQ2W3DMQ Dn0wtonyDEMI2uNiQ8NR5/DpdXenvsmOYZss4Lf/2FNPUMBwCOY2EIVvwWg+OGYLolDvpkiyEiTmO wwd9KgXbcUa3STbx5lydIQ==; Date: Fri, 15 Mar 2024 14:39:52 +0200 Message-Id: <86cyrv8y93.fsf@gnu.org> From: Eli Zaretskii To: Andrew Burgess Cc: gdb-patches@sourceware.org In-Reply-To: <856ee4315d2d615388efe8352b29379feefa4054.1710503245.git.aburgess@redhat.com> (message from Andrew Burgess on Fri, 15 Mar 2024 11:47:45 +0000) Subject: Re: [PATCH] gdb/python: test exception case for gdb.solib_name References: <856ee4315d2d615388efe8352b29379feefa4054.1710503245.git.aburgess@redhat.com> X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: Fri, 15 Mar 2024 11:47:45 +0000 > > I noticed that gdb.solib_name() and Progspace.solib_name() were not > documented as being able to throw an exception, but in some cases it > is possible to get an exception from these functions. An exception > can occur when the address argument can't be converted to an unsigned > integer. > > This commit extends the documentation to mention the exception case, > and I've added a couple of tests to cover this case. Thanks. > --- a/gdb/doc/python.texi > +++ b/gdb/doc/python.texi > @@ -521,7 +521,11 @@ > > @defun gdb.solib_name (address) > Return the name of the shared library holding the given @var{address} > -as a string, or @code{None}. This is identical to > +as a string, or @code{None} if there is no library containing > +@var{address}. If @var{address} can't be converted to a unsigned ^^^^^^^^^^ "an unsigned" > +integer address then an exception will be raised. Btw, what does it mean for ADDRESS to not be convertible to an unsigned integer address? Does it mean ADDRESS is not an integral number or something? Maybe we should say that explicitly. > @defun Progspace.solib_name (address) > Return the name of the shared library holding the given @var{address} > -as a string, or @code{None}. > +as a string, or @code{None} if there is no library containing > +@var{address}. If @var{address} can't be converted to a unsigned > +integer address then an exception will be raised. Same here. Reviewed-By: Eli Zaretskii