From: Luis Machado <lgustavo@codesourcery.com>
To: John Baldwin <jhb@FreeBSD.org>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2] PR threads/20743: Don't attempt to suspend or resume exited threads.
Date: Wed, 12 Apr 2017 18:12:00 -0000 [thread overview]
Message-ID: <62fcaaa0-35e3-2bed-fb5e-336a5c5ffbf4@codesourcery.com> (raw)
In-Reply-To: <20170404173258.6512-1-jhb@FreeBSD.org>
On 04/04/2017 12:32 PM, John Baldwin wrote:
> When resuming a native FreeBSD process, ignore exited threads when
> suspending/resuming individual threads prior to continuing the process.
>
> gdb/ChangeLog:
>
> PR threads/20743
> * fbsd-nat.c (resume_one_thread_cb): Remove.
> (resume_all_threads_cb): Remove.
> (fbsd_resume): Use ALL_NON_EXITED_THREADS instead of
> iterate_over_threads.
...
> @@ -711,13 +679,37 @@ fbsd_resume (struct target_ops *ops,
> if (ptid_lwp_p (ptid))
> {
> /* If ptid is a specific LWP, suspend all other LWPs in the process. */
> - iterate_over_threads (resume_one_thread_cb, &ptid);
> + struct thread_info *tp;
> + int request;
> +
> + ALL_NON_EXITED_THREADS (tp)
> + {
> + if (ptid_get_pid (tp->ptid) != ptid_get_pid (ptid))
> + continue;
> +
> + if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (ptid))
> + request = PT_RESUME;
> + else
> + request = PT_SUSPEND;
> +
> + if (ptrace (request, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
> + perror_with_name (("ptrace"));
> + }
Identation of the ALL_NON_EXITED_THREADS block is off. I'd check the
identation of the entire block to make sure it is sane.
A question i have is why did we have to remove the original functions.
Couldn't we have checked the non-exited-ness of the threads inside the
callback?
Another bit... Since we're changing this code, might as well improve the
perror message so it is more meaningful?
> }
> else
> {
> /* If ptid is a wildcard, resume all matching threads (they won't run
> until the process is continued however). */
> - iterate_over_threads (resume_all_threads_cb, &ptid);
> + struct thread_info *tp;
> +
> + ALL_NON_EXITED_THREADS (tp)
> + {
> + if (!ptid_match (tp->ptid, ptid))
> + continue;
> +
> + if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
> + perror_with_name (("ptrace"));
> + }
Identation is off too.
Same as above for the error message.
Otherwise i have no further comments. I assume you ran gdb's testsuite
against this change and verified the results are sane?
Other folks can chime in.
next prev parent reply other threads:[~2017-04-12 18:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 17:33 John Baldwin
2017-04-11 18:43 ` John Baldwin
2017-04-12 18:12 ` Luis Machado [this message]
2017-04-14 22:40 ` John Baldwin
2017-04-15 1:01 ` Luis Machado
2017-04-17 18:27 ` John Baldwin
2017-04-17 18:32 ` Luis Machado
2017-04-18 14:27 ` Simon Marchi
2017-04-18 14:29 ` Simon Marchi
2017-04-18 14:58 ` Pedro Alves
2017-04-18 16:53 ` John Baldwin
2017-04-18 11:33 ` Pedro Alves
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=62fcaaa0-35e3-2bed-fb5e-336a5c5ffbf4@codesourcery.com \
--to=lgustavo@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=jhb@FreeBSD.org \
/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