From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8326 invoked by alias); 24 Jul 2012 14:36:51 -0000 Received: (qmail 8114 invoked by uid 22791); 24 Jul 2012 14:36:49 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Jul 2012 14:36:26 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6OEaM4q028025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 24 Jul 2012 10:36:23 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6OEaKVT019066; Tue, 24 Jul 2012 10:36:21 -0400 Message-ID: <500EB2E4.6050009@redhat.com> Date: Tue, 24 Jul 2012 14:36:00 -0000 From: Phil Muldoon MIME-Version: 1.0 To: markus.t.metzger@intel.com CC: gdb-patches@sourceware.org, markus.t.metzger@gmail.com, jan.kratochvil@redhat.com, palves@redhat.com, tromey@redhat.com Subject: Re: [PATCH 1/1] gdb, python: update threads in Inferior.threads () References: <1343117514-24895-1-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1343117514-24895-1-git-send-email-markus.t.metzger@intel.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-07/txt/msg00484.txt.bz2 On 07/24/2012 09:11 AM, markus.t.metzger@intel.com wrote: > From: Markus Metzger > > 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 > > 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 * 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