From: Pedro Alves <pedro@codesourcery.com>
To: Vladimir Prus <vladimir@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Implement 'detach pid'.
Date: Fri, 14 Nov 2008 05:12:00 -0000 [thread overview]
Message-ID: <200811132249.18018.pedro@codesourcery.com> (raw)
In-Reply-To: <200811140058.49275.vladimir@codesourcery.com>
On Thursday 13 November 2008 21:58:49, Vladimir Prus wrote:
> /* Iterator function to call a user-provided callback function
> - once for each known thread. */
> + once for each known thread. Returns 0 to continue iteration,
> + and 1 to stop -- which causes iterate_over_threads to return
> + the current thread_info. */
To be honest, this sounds a bit confusing to me: the iterator function,
which is what was being described in the first sentence isn't the
same subject of the second sentence, "returns 0 ..." is now talking
about the callback.
> typedef int (*thread_callback_func) (struct thread_info *, void *);
> extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
Notice that a few gdbthread.h exported functions are also
documented in thread.c. In this case:
/*
* Thread iterator function.
*
* Calls a callback function once for each thread, so long as
* the callback function returns false. If the callback function
* returns true, the iteration will end and the current thread
* will be returned. This can be useful for implementing a
* search for a thread with arbitrary attributes, or for applying
* some operation to every thread.
*
*/
If we're moving the descriptions around, please, let's do
that as a separate patch.
> +void
> +mi_cmd_target_detach (char *command, char **argv, int argc)
> +{
> + if (argc != 0 && argc != 1)
> + error ("Usage: -target-detach [thread-group]");
> +
> + if (argc == 1)
> + {
> + struct thread_info *tp;
> + char *end = argv[0];
> + int pid = strtol (argv[0], &end, 10);
> + if (*end != '\0')
> + error (_("Cannot parse thread group id '%s'"), argv[0]);
> +
> + /* Pick any thread in the desired process. Current
> + target_detach deteches from the parent of inferior_ptid. */
^ detaches.
> + tp = iterate_over_threads (find_thread_of_process, &pid);
> + if (!tp)
> + error (_("Thread group is empty"));
Yep, something like that.
I take that it's OK then to not revert back to the
previous thread?
Thanks!
--
Pedro Alves
next prev parent reply other threads:[~2008-11-13 22:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-12 21:17 Vladimir Prus
2008-11-13 12:52 ` Pedro Alves
2008-11-14 1:55 ` Vladimir Prus
2008-11-14 5:12 ` Pedro Alves [this message]
2008-11-14 12:57 ` Vladimir Prus
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=200811132249.18018.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=vladimir@codesourcery.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