From: Petr Koloros <pko@sysgo.com>
To: GDB Mailing list <gdb@sourceware.org>
Subject: Restart remote application
Date: Wed, 08 Aug 2007 13:30:00 -0000 [thread overview]
Message-ID: <20070808132955.GB10087@pko.sysgo.cz> (raw)
Hi all,
I'm having problems with restarting the remote application. Some time ago it
was advised to use extended protocol and 'run' command but it doesn't work.
(gdb) set debug remote 1
(gdb) target extended-remote 192.168.14.2:5555
.. a lot of packets ..
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Sending packet: $k#6b...Ack
Starting program: /usr/bin/top
Sending packet: $R0#82...Ack
Sending packet: $?#3f...Sending packet: $?#3f...Sending packet:
$?#3f...Sending packet: $?#3f...Timed out.
Timed out.
Timed out.
There is no answer from the gdbserver any more because it is in the endless
loop:
recv(4, "$k#6b", 8192, 0) = 5
send(4, "+", 1, 0) = 1
--- SIGIO (I/O possible) @ 0 (0) ---
write(2, "Killing inferior\n", 17) = 17
ptrace(PTRACE_KILL, 2706, 0, 0) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
waitpid(2706, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGKILL}], WNOHANG) = 2706
'k' command from the remote protocol causes the debugged application to be
killed.
write(2, "GDBserver restarting\n", 21) = 21
rt_sigaction(SIGTTOU, {SIG_DFL}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGTTIN, {SIG_DFL}, {SIG_IGN}, 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0xb7dc8b08) = 2709
write(2, "Process /usr/bin/top created; pi"..., 41) = 41
--- SIGCHLD (Child exited) @ 0 (0) ---
rt_sigaction(SIGTTOU, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTTIN, {SIG_IGN}, {SIG_DFL}, 8) = 0
ioctl(2, TIOCGPGRP, [2706]) = 0
ioctl(2, TIOCSPGRP, [2709]) = 0
rt_sigaction(SIGIO, {0x804c080, [IO], SA_RESTART}, {SIG_IGN}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [IO], NULL, 8) = 0
waitpid(-1, [{WIFSTOPPED(s) && WSTOPSIG(s) == SIGTRAP}], WNOHANG) = 2709
ptrace(PTRACE_GETREGS, 2709, 0, 0x8059650) = 0
ptrace(PTRACE_GETFPXREGS, 2709, 0, 0x8059698) = 0
ptrace(PTRACE_GETFPREGS, 2709, 0, 0x80598a0) = 0
ptrace(PTRACE_PEEKTEXT, 2709, 0xb7fe080c, [0]) = 0
rt_sigaction(SIGIO, {SIG_IGN}, {0x804c080, [IO], SA_RESTART}, 8) = 0
Then a 'restart' command arrives in the remote protocol
recv(4, "$R0#82", 8192, 0) = 6
send(4, "+", 1, 0) = 1
--- SIGIO (I/O possible) @ 0 (0) ---
ptrace(PTRACE_KILL, 2709, 0, 0) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
waitpid(2709, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGKILL}], WNOHANG) = 2709
.. and because the pid was not cleaned up by extended_remote_mourn:
static void
extended_remote_mourn (void)
{
/* We do _not_ want to mourn the target like this; this will
remove the extended remote target from the target stack,
and the next time the user says "run" it'll fail.
FIXME: What is the right thing to do here? */
#if 0
remote_mourn_1 (&extended_remote_ops);
#endif
}
ptrace(PTRACE_KILL, 2706, 0, 0) = -1 ESRCH (No such process)
waitpid(2706, 0xbf877128, WNOHANG) = -1 ECHILD (No child processes)
waitpid(2706, 0xbf877128, WNOHANG|__WCLONE) = -1 ECHILD (No child processes)
.. it just kills it again and wait for the status which never comes:
nanosleep({0, 1000000}, NULL) = 0
waitpid(2706, 0xbf877128, WNOHANG) = -1 ECHILD (No child processes)
waitpid(2706, 0xbf877128, WNOHANG|__WCLONE) = -1 ECHILD (No child processes)
nanosleep({0, 1000000}, NULL) = 0
waitpid(2706, 0xbf877128, WNOHANG) = -1 ECHILD (No child processes)
waitpid(2706, 0xbf877128, WNOHANG|__WCLONE) = -1 ECHILD (No child processes)
.. endless loop.
It worked in the past I believe and it doesn't now. Is there some other way
please?
Thanks for your help,
Petr Koloros
next reply other threads:[~2007-08-08 13:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-08 13:30 Petr Koloros [this message]
2007-08-08 14:24 ` Daniel Jacobowitz
2007-08-09 9:32 ` Petr Koloros
2007-08-09 11:20 ` Daniel Jacobowitz
2007-08-09 12:26 ` Petr Koloros
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=20070808132955.GB10087@pko.sysgo.cz \
--to=pko@sysgo.com \
--cc=gdb@sourceware.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