Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"markus.t.metzger@gmail.com" <markus.t.metzger@gmail.com>,
	"Pedro Alves (palves@redhat.com)" <palves@redhat.com>
Subject: RE: [PATCH 1/1] gdb, python: update threads in Inferior.threads ()
Date: Fri, 20 Jul 2012 07:57:00 -0000	[thread overview]
Message-ID: <A78C989F6D9628469189715575E55B2307AC2EB2@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <20120719184517.GB15108@host2.jankratochvil.net>


[-- Attachment #1.1: Type: text/plain, Size: 2577 bytes --]

> -----Original Message-----
> From: Jan Kratochvil [mailto:jan.kratochvil@redhat.com]
> Sent: Thursday, July 19, 2012 8:45 PM
> 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 ()
> 
> 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.

I expected python scripts to store the thread list and only query it when the script doesn't know whether the thread list changed.
Of course, if you repeatedly issue a command instead of reusing the previously computed result, you pay for it.

Currently, python scripts would do gdb.execute ("info threads", False, True) before inferior.threads () to work around the problem.
This would be even worse.


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

I am wondering whether gdbserver should notify gdb about new threads via an event. This would obsolete update_thread_list ().

Regards,
Markus.


[-- Attachment #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 7228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 350 bytes --]

Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer, Christian Lamprechter
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052

  reply	other threads:[~2012-07-20  7:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-06  9:50 markus.t.metzger
2012-07-06 18:12 ` Tom Tromey
2012-07-19 15:27   ` Metzger, Markus T
2012-07-18 13:54 ` Jan Kratochvil
2012-07-19 15:27   ` Metzger, Markus T
2012-07-19 18:45     ` Jan Kratochvil
2012-07-20  7:57       ` Metzger, Markus T [this message]
2012-07-19 15:30 markus.t.metzger
2012-07-19 18:41 ` Jan Kratochvil
     [not found]   ` <2832024D-3061-4A13-BBF5-656C504C295D@gmail.com>
2012-07-24  8:08     ` Metzger, Markus T
2012-07-25 16:13       ` Tom Tromey
2012-07-26  5:51         ` Metzger, Markus T
2012-07-25 16:16   ` Tom Tromey
2012-07-24  8:12 markus.t.metzger
2012-07-24 14:36 ` Phil Muldoon
2012-07-25  8:27 markus.t.metzger
2012-07-25 16:15 ` Tom Tromey
2012-07-26  7:51   ` Metzger, Markus T
2012-07-26  8:43     ` Jan Kratochvil
2012-07-26  8:49       ` Metzger, Markus T
2012-07-26 12:20 markus.t.metzger

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=A78C989F6D9628469189715575E55B2307AC2EB2@IRSMSX102.ger.corp.intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=markus.t.metzger@gmail.com \
    --cc=palves@redhat.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