Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Michael Snyder <msnyder@vmware.com>
Subject: Re: [RFA] Add optional argument to "info threads" command
Date: Mon, 24 Nov 2008 16:33:00 -0000	[thread overview]
Message-ID: <200811240308.49485.pedro@codesourcery.com> (raw)
In-Reply-To: <4928BC24.5020600@vmware.com>

On Sunday 23 November 2008 02:12:52, Michael Snyder wrote:
> I've long been frustrated because I could not ask for
> info about just one or more threads.
> 
> This patch makes use of command parsing code in breakpoint.c
> to give "info threads" the same optional arguments as "info
> breakpoints", ie. a list of one or more threads of interest,
> or a range of threads (eg. "5-9").
> 
> 
> OK?

I'd like to point out that if you're debugging a multi-threaded
application with lots of threads (the case where you'd want to use
the range of threads feature), your implementation will, for
each id in the specified range:

 1. call prune_threads.

    This is a bunch of T (thread alive) packets in the remote target,
    one for each thread in the thread list -- not for each in
    range, really *for all* threads.

 2. call target_find_new_threads.

    A bunch of qfThreadInfo packets.  One for *each remote thread*, not
    just the ones specified in the range.

 3. do a make_cleanup_restore_current_thread and restore
    the selected thread and frame once for each thread in the
    range.  This triggers about the double amount of registers
    and memory reads than necessary.

 4. also, there's a chance you'll hit the same warning in
    restore_selected_frame once for each id in the range.

If you consider remote targets, and thinking that this new
feature would be most useful if you have many threads,
points 1-3 above can be heavy against not so fast links.  I
suggest abstracting out the bits in print_thread_info that do the
actual printing from the bits that prune dead threads, find
new threads, and restore the original selected frame.

-- 
Pedro Alves


  parent reply	other threads:[~2008-11-24  3:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-24 12:44 Michael Snyder
2008-11-24 15:19 ` teawater
2008-11-24 16:33 ` Pedro Alves [this message]
2008-11-24 21:22   ` Michael Snyder
2008-11-24 22:10     ` Pedro Alves
2008-11-24 23:03       ` Pedro Alves
2008-11-25  8:48       ` Michael Snyder
2008-11-25 16:06         ` Pedro Alves
2008-11-24 23:22 ` Eli Zaretskii

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=200811240308.49485.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.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