Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/3] python: Add Progspace.objfiles method
Date: Thu, 13 Sep 2018 02:38:00 -0000	[thread overview]
Message-ID: <83o9d2ktph.fsf@gnu.org> (raw)
In-Reply-To: <20180912193617.16523-2-simon.marchi@ericsson.com> (message from	Simon Marchi on Wed, 12 Sep 2018 15:36:16 -0400)

> From: Simon Marchi <simon.marchi@ericsson.com>
> CC: Simon Marchi <simon.marchi@ericsson.com>
> Date: Wed, 12 Sep 2018 15:36:16 -0400
> 
> This patch adds an objfiles method, which returns a sequence of the
> objfiles associated to that program space.  I chose a method rather than
> a property for symmetry with gdb.objfiles().
> 
> Question:
> 
> When we try to access a property of an Inferior object that has
> become invalid, for example, we raise an exception ("Inferior no longer
> exists.").  When doing the same with a Progspace object, we return None
> (the only case for now is its filename property).  For
> Progspace.objfiles(), I made it return None too, but perhaps it should
> throw an exception instead?  Especially that None is not iterable, so
> trying to do:
> 
>   for obj in pspace.objfiles():
>     ...
> 
> will fail horribly if we return None...  so should I introduce a macro
> similar to INFPY_REQUIRE_VALID?
> 
> gdb/ChangeLog:
> 
> 	* python/py-progspace.c (pspy_get_objfiles): New function.
> 	(progspace_object_methods): New.
> 	(pspace_object_type): Add tp_methods callback.
> 	* python/python-internal.h (build_objfiles_list): New
> 	declaration.
> 	* python/python.c (build_objfiles_list): New function.
> 	(gdbpy_objfiles): Implement using build_objfiles_list.
> 	* NEWS: Mention the Progspace.objfiles method.
> 
> gdb/doc/ChangeLog:
> 
> 	* python.texi (Program Spaces In Python): Document the
> 	Progspace.objfiles method.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* gdb.python/py-progspace.exp: Test the Progspace.objfiles
> 	method.

OK for the documentation parts.

Thanks.


  parent reply	other threads:[~2018-09-13  2:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12 19:37 [PATCH 1/3] python: Add Inferior.progspace property Simon Marchi
2018-09-12 19:36 ` [PATCH 3/3] python: Fix erroneous doc about gdb.objfiles() Simon Marchi
2018-09-12 21:46   ` Tom Tromey
2018-09-13  2:37   ` Eli Zaretskii
2018-09-13  2:42     ` Simon Marchi
2018-09-12 19:37 ` [PATCH 2/3] python: Add Progspace.objfiles method Simon Marchi
2018-09-12 22:01   ` Tom Tromey
2018-09-12 22:58     ` Simon Marchi
2018-09-13  4:50       ` Tom Tromey
2018-09-13  2:38   ` Eli Zaretskii [this message]
2018-09-12 21:42 ` [PATCH 1/3] python: Add Inferior.progspace property Tom Tromey
2018-09-12 22:22   ` Simon Marchi
2018-09-13  4:38     ` Tom Tromey
2018-09-13 22:16       ` Tom Tromey
2018-09-12 21:43 ` Tom Tromey
2018-09-13  2:37 ` Eli Zaretskii

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=83o9d2ktph.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.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