From: Yao Qi <qiyaoltc@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v4 3/3] Fix failure to detach if process exits while detaching on Linux
Date: Fri, 17 Jun 2016 15:07:00 -0000 [thread overview]
Message-ID: <86k2hnsvk0.fsf@gmail.com> (raw)
In-Reply-To: <1466119968-15171-4-git-send-email-palves@redhat.com> (Pedro Alves's message of "Fri, 17 Jun 2016 00:32:48 +0100")
Pedro Alves <palves@redhat.com> writes:
> +# If testing single-process, simply detach from the process.
> +#
> +# If testing multi-process, first detach from the child, then detach
> +# from the parent and confirm that the parent exits, thus unsuring
s/unsuring/ensuring/ ?
> +# we've detached from the child successfully, as the parent hangs in
> +# its waitpid call otherwise.
> +#
> +# If connected with "target remote", make sure gdbserver exits.
> +#
> +# CMD indicates what to do with the parent after detaching the child.
> +# Can be either "detach" to detach, or "continue", to continue to
> +# exit. If "continue", then CONTINUE_RE is the regexp to expect.
> +# Defaults to normal exit output.
> +#
> +proc do_detach {multi_process cmd {continue_re ""}} {
> + global decimal
> + global server_spawn_id
> +
> + if {$continue_re == ""} {
> + set continue_re "exited normally.*"
> + }
> +
> + set is_remote [expr {[target_info exists gdb_protocol]
> + && [target_info gdb_protocol] == "remote"}]
> +
> + if {$multi_process} {
> + gdb_test "detach" "Detaching from .*, process $decimal" \
> + "detach child"
> +
> + gdb_test "inferior 1" "\[Switching to inferior $decimal\].*" \
> + "switch to parent"
> +
> + if {$cmd == "detach"} {
> + # Make sure that detach works and that the parent process
> + # exits cleanly.
> + detach_and_expect_exit "detach parent"
> + } elseif {$cmd == "continue"} {
> + # Make sure that continuing works and that the parent process
> + # exits cleanly.
> + gdb_test "continue" $continue_re
> + } else {
> + perror "unhandled command: $mode: $cmd"
no variable "mode".
> + }
> + } else {
> + if $is_remote {
> + set extra "\r\nEnding remote debugging\."
> + } else {
> + set extra ""
> + }
> + if {$cmd == "detach"} {
> + gdb_test "detach" "Detaching from .*, process $decimal$extra"
> + } elseif {$cmd == "continue"} {
> + gdb_test "continue" $continue_re
> + } else {
> + perror "unhandled command: $mode: $cmd"
> + }
> + }
> +
--
Yao (齐尧)
next prev parent reply other threads:[~2016-06-17 15:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-16 23:33 [PATCH v4 0/3] " Pedro Alves
2016-06-16 23:32 ` [PATCH v4 1/3] Factor out "Detaching from program" message printing Pedro Alves
2016-06-17 11:31 ` Yao Qi
2016-06-16 23:33 ` [PATCH v4 2/3] Forget watchpoint locations when inferior exits or is killed/detached Pedro Alves
2016-06-17 11:56 ` Yao Qi
2016-06-24 19:10 ` Pedro Alves
2016-07-01 10:49 ` Pedro Alves
2016-06-16 23:33 ` [PATCH v4 3/3] Fix failure to detach if process exits while detaching on Linux Pedro Alves
2016-06-17 13:03 ` Antoine Tremblay
2016-06-24 19:30 ` Pedro Alves
2016-06-17 15:07 ` Yao Qi [this message]
2016-06-24 19:28 ` 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=86k2hnsvk0.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).