This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/1] gdb, python: update threads in Inferior.threads ()
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: markus dot t dot metzger at intel dot com
- Cc: gdb-patches at sourceware dot org, markus dot t dot metzger at gmail dot com, jan dot kratochvil at redhat dot com, palves at redhat dot com, tromey at redhat dot com
- Date: Tue, 24 Jul 2012 15:36:20 +0100
- Subject: Re: [PATCH 1/1] gdb, python: update threads in Inferior.threads ()
- References: <1343117514-24895-1-git-send-email-markus.t.metzger@intel.com>
On 07/24/2012 09:11 AM, markus.t.metzger@intel.com wrote:
> From: Markus Metzger <markus.t.metzger@intel.com>
>
> When querying an inferior's threads in Python in a remote debugging
> configuration, only the already known threads are returned.
Thanks.
> Update the thread list in infpy_threads () before creating the Python objects.
>
> 2012-07-24 Markus Metzger <markus.t.metzger@intel.com>
>
> gdb/python/
> * py-inferior.c (infpy_threads): Call update_thread_list ().>
ChangeLog paths are relative, so in these entries you do not need the
"gdb" section. Also the path and entry should be appended to be on
the same line. E.g.:
2012-07-24 Markus Metzger <markus.t.metzger@intel.com>
* python/py-inferior.c (infpy_threads): Call update_thread_list ().
> gdb/testsuite/gdb.python/
> * py-threads.c: New file.
> * py-threads.exp: New file.
>
The testsuite has its own ChangeLog located in testsuite/, so these
entries need to go there. Also, the paths are relative too, so no
"gdb/testsuite" in those entries.
> diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
> index 2b229be..22adf8c 100644
> --- a/gdb/python/py-inferior.c
> +++ b/gdb/python/py-inferior.c
> @@ -300,6 +300,11 @@ infpy_threads (PyObject *self, PyObject *args)
> struct threadlist_entry *entry;
> inferior_object *inf_obj = (inferior_object *) self;
> PyObject *tuple;
> + volatile struct gdb_exception except;
> +
> + TRY_CATCH (except, RETURN_MASK_ALL)
> + update_thread_list ();
> + GDB_PY_HANDLE_EXCEPTION (except);
>
> INFPY_REQUIRE_VALID (inf_obj);
If the inferior is no longer around, then updating the thread list is
invalid. update_thread_list and the associated thread exception code
should be hoisted below the inferior validity check performed in
INFPY_REQUIRE_VALID.
> diff --git a/gdb/testsuite/gdb.python/py-threads.c b/gdb/testsuite/gdb.python/py-threads.c
> new file mode 100644
> diff --git a/gdb/testsuite/gdb.python/py-threads.exp b/gdb/testsuite/gdb.python/py-threads.exp
> new file mode 100644
py-inferior has its own series of test cases in py-inferior.exp, with the test
inferior being py-inferior.c. I would prefer it if we could keep
these tests as one unit. Could you try merging the two testcases?
Thanks
Phil