From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v3] Add more methods to gdb.Progspace
Date: Sun, 16 Sep 2018 13:01:00 -0000 [thread overview]
Message-ID: <676093dae8c864822f535ac554412f63@simark.ca> (raw)
In-Reply-To: <87mushpq0r.fsf@tromey.com>
On 2018-09-16 08:48, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simark@simark.ca> 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
prev parent reply other threads:[~2018-09-16 13:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 22:17 Tom Tromey
2018-09-14 5:57 ` Eli Zaretskii
2018-09-16 3:10 ` Simon Marchi
2018-09-16 12:49 ` Tom Tromey
2018-09-16 13:01 ` Simon Marchi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=676093dae8c864822f535ac554412f63@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox