Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] New python function gdb.lookup_objfile.
Date: Tue, 09 Dec 2014 16:22:00 -0000	[thread overview]
Message-ID: <83vblkx07z.fsf@gnu.org> (raw)
In-Reply-To: <yjt2sigp4kd3.fsf@ruffy.mtv.corp.google.com>

> From: Doug Evans <dje@google.com>
> Date: Mon, 08 Dec 2014 18:39:36 -0800
> 
> This patch implements a new python function gdb.lookup_objfile.
> It provides the ability to look up an objfile given a file name
> or build id.
> 
> While one could call gdb.objfiles() and then scan over that,
> it requires construction of the list, and with *lots* of objfiles
> it is a bit cumbersome.
> 
> Regression tested on amd64-linux.
> 
> 2014-12-08  Doug Evans  <dje@google.com>
> 
> 	* NEWS: Mention gdb.lookup_objfile.
> 	* python/python.c (GdbMethods): Add lookup_objfile.
> 	* python/python-internal.h (gdbpy_lookup_objfile): Declare.
> 	* python/py-objfile.c: #include "symtab.h".
> 	(objfpy_build_id_ok, objfpy_build_id_matches): New functions.
> 	(objfpy_lookup_objfile_by_name): New function.
> 	(objfpy_lookup_objfile_by_build_id): New function.
> 	(gdbpy_lookup_objfile): New function.
> 
> 	doc/
> 	* python.texi (Objfiles In Python): Document gdb.lookup_objfile.
> 
> 	testsuite/
> 	* lib/gdb-python.exp (get_python_valueof): New function.
> 	* gdb.python/py-objfile.exp: Add tests for gdb.lookup_objfile.
> 
> diff --git a/gdb/NEWS b/gdb/NEWS
> index 6a2cb9b..93e06d4 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -28,6 +28,7 @@
>    ** A new event "gdb.clear_objfiles" has been added, triggered when
>       selecting a new file to debug.
>    ** You can now add attributes to gdb.Objfile and gdb.Progspace objects.
> +  ** New function gdb.lookup_objfile.

OK for NEWS.

> +@findex gdb.lookup_objfile
> +@defun gdb.lookup_objfile (name @r{[}, by_build_id{]})
> +Look up @var{name}, which is a file name, in the list of objfiles
> +for the current program space (@pxref{Progspaces In Python}).

  "Look up @var{name}, a file name or a build ID, in the list of
  objfiles for the current program space."

> +If the objfile is not found then a Python @code{ValueError} exception
> +is thrown.

"... throw the Python ValueError exception" is better, because it
avoids the passive tense.

> +If @var{by_build_id} is provided and is @code{True} then @var{name}
> +is the build ID of the objfile.

I would add "Otherwise, @var{name} is a file name."

The documentation changes are OK with those fixed.

Thanks.


      parent reply	other threads:[~2014-12-09 16:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09  2:39 Doug Evans
2014-12-09 10:50 ` Phil Muldoon
2014-12-09 17:23   ` Doug Evans
2014-12-09 21:22   ` Doug Evans
2014-12-09 16:22 ` Eli Zaretskii [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=83vblkx07z.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /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