From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30441 invoked by alias); 19 Jul 2012 18:45:43 -0000 Received: (qmail 30429 invoked by uid 22791); 19 Jul 2012 18:45:40 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,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; Thu, 19 Jul 2012 18:45:27 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6JIjPGl022302 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 19 Jul 2012 14:45:25 -0400 Received: from host2.jankratochvil.net (ovpn-116-30.ams2.redhat.com [10.36.116.30]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6JIjLHO018197 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 19 Jul 2012 14:45:23 -0400 Date: Thu, 19 Jul 2012 18:45:00 -0000 From: Jan Kratochvil To: "Metzger, Markus T" Cc: "gdb-patches@sourceware.org" , "markus.t.metzger@gmail.com" , "Pedro Alves (palves@redhat.com)" Subject: Re: [PATCH 1/1] gdb, python: update threads in Inferior.threads () Message-ID: <20120719184517.GB15108@host2.jankratochvil.net> References: <1341568171-27211-1-git-send-email-markus.t.metzger@intel.com> <20120718135413.GA10378@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00369.txt.bz2 On Thu, 19 Jul 2012 17:26:17 +0200, Metzger, Markus T wrote: > > So far update_thread_list is called only before (in) the commands which really > > need the thread list. The problem is that infpy_threads can be called from > > a script repeatedly which may be pretty inefficient to call update_thread_list > > each time. > > So it is the right place - just not a good one. > > Those scripts will now do "info threads" to achieve the same effect. Not sure if we understand each other. If I do GDB script: while 1 info threads end Then it is needlessly inefficient, stopped inferior cannot change threads list while this loop will re-scan the threads each time. But I do not think that is a problem, 'info threads' is usually executed only after inferior has run for a bit. Contrary to it I can imagine Python script doing gdb.selected_inferior().threads() a lot of times without running the inferior. Maybe this GDB scripting vs. Python scripting difference is not significant. > > The right would be to: > > (1) Support update_thread_list per-inferior, not just for all inferiors at > > once. For example infpy_threads is interested only in specific inferior. > > (2) Cache the current thread list in struct inferior, clearing it from > > begin of target_resume according to PTID (which depends for example on > > 'set schedule-multiple', see user_visible_resume_ptid), therefore either > > the specific inferior only or all inferiors. > > Shouldn't this rather be an event? I do not understand here. Even is Python specific, caching of threads list would be good to have even in non-Python GDB. Thanks, Jan