From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91355 invoked by alias); 16 Sep 2018 13:01:11 -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 58676 invoked by uid 89); 16 Sep 2018 13:00:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=describe, Hx-languages-length:1821, stand, wish 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; Sun, 16 Sep 2018 13:00:50 +0000 Received: by simark.ca (Postfix, from userid 112) id 3C14D1E5A4; Sun, 16 Sep 2018 09:00:40 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1537102840; bh=1Wp4+5HvyNmktLkyM1yDUy1pGkTJKWu4RS5ol2NCXbk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XBNLR/SukISv2Jvk8Gn5e6WdvpDj/dyvD4o+Zc4aiK0tF5UxdLuYrvFO6ZlcPB4TA rYGPrejoBnEvp8WgfG2QJTmzabb8qGbHAVWXWqtoxR3gb5+8l/c8AfHJw4SyTksxv5 j9sr/y4fK87YpRHS/29Ol3apz4Q5TRZj1bjU5QjA= Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 87C071E197; Sun, 16 Sep 2018 09:00:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1537102839; bh=1Wp4+5HvyNmktLkyM1yDUy1pGkTJKWu4RS5ol2NCXbk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rFh4XbsJAfQ7133u4+9g0gbK1wXiqFQidYw21rYc4/wX4hh3LtPdrGbpRGywrhIjB UflZ2VwJr+JPMQ/i+8fSTHcsE6t2gdLZ9HwpBUu8CyYhWpIc886N3osJIx3Zl5uKyD G2/6wBlLLRqpPK9pVNFm2f3/+Tbw3ivF981QpSdU= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 16 Sep 2018 13:01:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v3] Add more methods to gdb.Progspace In-Reply-To: <87mushpq0r.fsf@tromey.com> References: <20180913221627.13772-1-tom@tromey.com> <87mushpq0r.fsf@tromey.com> Message-ID: <676093dae8c864822f535ac554412f63@simark.ca> X-Sender: simark@simark.ca User-Agent: Roundcube Webmail/1.3.6 X-SW-Source: 2018-09/txt/msg00539.txt.bz2 On 2018-09-16 08:48, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> LGTM, I just noted some minor comments. > Simon> I wish there was more consistency in how the methods are > documented (in the > Simon> progspace_object_methods array), but that should be another > patch. > > Send more details and let's agree on some kind of standard here. > I think these doc strings are mostly an afterthought at the moment, but > there's no reason they should be. In these: + { "solib_name", pspy_solib_name, METH_VARARGS, + "solib_name (Long) -> String.\n\ +Return the name of the shared library holding a given address, or None." }, + { "block_for_pc", pspy_block_for_pc, METH_VARARGS, + "Return the block containing the given pc value, or None." }, + { "find_pc_line", pspy_find_pc_line, METH_VARARGS, + "find_pc_line (pc) -> Symtab_and_line.\n\ +Return the gdb.Symtab_and_line object corresponding to the pc value." }, + { "is_valid", pspy_is_valid, METH_NOARGS, + "is_valid () -> Boolean.\n\ +Return true if this program space is valid, false if not." }, Two things stand out: - Some of them have this "Prototype -> Return type" form, some don't. - solib_name uses Long to describe the parameter while find_pc_line uses pc. They should be the same, since they both take a pc. I like the -> notation, and that's what cpython uses, for example if you do "help(str.find)". cpython seems to describe parameter using their names, so from the above, "pc" would be the right one. I think that makes sense, since 1. long doesn't exist in Python 3 (and it should be long, not Long) 2. we could accept different types for pc, either an int or a gdb.Value for example 3. It's not always clear just by the type what the parameter means. Simon