This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/3] python: Add Progspace.objfiles method


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]