From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v3] Add more methods to gdb.Progspace
Date: Sun, 16 Sep 2018 03:10:00 -0000 [thread overview]
Message-ID: <ab9fcadb-548f-7bb0-b3ff-b422c99c033a@simark.ca> (raw)
In-Reply-To: <20180913221627.13772-1-tom@tromey.com>
LGTM, I just noted some minor comments.
I wish there was more consistency in how the methods are documented (in the
progspace_object_methods array), but that should be another patch.
On 2018-09-13 6:16 p.m., Tom Tromey wrote:
> diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
> index aca6ec858cf..34f42c0effe 100644
> --- a/gdb/doc/python.texi
> +++ b/gdb/doc/python.texi
> @@ -328,7 +328,9 @@ Return the @code{gdb.Symtab_and_line} object corresponding to the
> @var{pc} value. @xref{Symbol Tables In Python}. If an invalid
> value of @var{pc} is passed as an argument, then the @code{symtab} and
> @code{line} attributes of the returned @code{gdb.Symtab_and_line} object
> -will be @code{None} and 0 respectively.
> +will be @code{None} and 0 respectively. This is identical to
> +@code{current_progspace().find_pc_line(pc)} and is included for
Perhaps this should say gdb.current_progspace().find_pc_line(pc) ?
> +/* Implementation of solib_name (Long) -> String.
> + Returns the name of the shared library holding a given address, or None. */
> +
> +static PyObject *
> +pspy_solib_name (PyObject *o, PyObject *args)
> +{
> + char *soname;
> + PyObject *str_obj;
> + gdb_py_longest pc;
> + pspace_object *self = (pspace_object *) o;
> +
> + PSPY_REQUIRE_VALID (self);
> +
> + if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
> + return NULL;
> +
> + soname = solib_name_from_address (self->pspace, pc);
> + if (soname)
> + str_obj = host_string_to_python_string (soname);
> + else
> + {
> + str_obj = Py_None;
> + Py_INCREF (Py_None);
> + }
I know this is pre-existing code, but it could use Py_RETURN_NONE, then
we can get rid of the str_obj variable.
Simon
next prev parent reply other threads:[~2018-09-16 3:10 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 [this message]
2018-09-16 12:49 ` Tom Tromey
2018-09-16 13:01 ` Simon Marchi
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=ab9fcadb-548f-7bb0-b3ff-b422c99c033a@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