From: Daniel Jacobowitz <drow@false.org>
To: Petr Koloros <pko@sysgo.com>
Cc: GDB Mailing list <gdb@sourceware.org>
Subject: Re: Restart remote application
Date: Wed, 08 Aug 2007 14:24:00 -0000 [thread overview]
Message-ID: <20070808142429.GA32455@caradoc.them.org> (raw)
In-Reply-To: <20070808132955.GB10087@pko.sysgo.cz>
On Wed, Aug 08, 2007 at 03:29:56PM +0200, Petr Koloros wrote:
> 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.
The extended protocol doesn't work very well. I have a sketch for
improvements to running more than one remote application, and some
code, which I hope I'll be working on for the next release of GDB
after 6.7. However, what you're describing here normally works.
Here's some bits of that code plus another related fix I noticed;
does it help for you?
--
Daniel Jacobowitz
CodeSourcery
2007-08-08 Daniel Jacobowitz <dan@codesourcery.com>
* remote.c (remote_wait, remote_async_wait): Stop if we receive
an error.
(extended_remote_mourn): Mourn the target and reset inferior_ptid.
* linux-low.c (linux_kill): Clear the inferior list.
(linux_detach): Clear the process list.
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.265
diff -u -p -r1.265 remote.c
--- remote.c 3 Jul 2007 15:58:42 -0000 1.265
+++ remote.c 8 Aug 2007 14:21:59 -0000
@@ -3219,8 +3219,12 @@ remote_wait (ptid_t ptid, struct target_
switch (buf[0])
{
case 'E': /* Error of some sort. */
+ /* We're out of sync with the target now. Did it continue or not?
+ Not is more likely, so report a stop. */
warning (_("Remote failure reply: %s"), buf);
- continue;
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_0;
+ goto got_status;
case 'F': /* File-I/O request. */
remote_fileio_request (buf);
continue;
@@ -3432,8 +3436,12 @@ remote_async_wait (ptid_t ptid, struct t
switch (buf[0])
{
case 'E': /* Error of some sort. */
+ /* We're out of sync with the target now. Did it continue or not?
+ Not is more likely, so report a stop. */
warning (_("Remote failure reply: %s"), buf);
- continue;
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_0;
+ goto got_status;
case 'F': /* File-I/O request. */
remote_fileio_request (buf);
continue;
@@ -5135,14 +5143,16 @@ remote_async_mourn (void)
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.
+ /* Unlike "target remote", we do not want to unpush the target; then
+ the next time the user says "run", we won't be connected. */
- FIXME: What is the right thing to do here? */
-#if 0
- remote_mourn_1 (&extended_remote_ops);
-#endif
+ /* Call common code to mark the inferior as not running. */
+ generic_mourn_inferior ();
+
+ /* Assume that the target has been restarted. Set inferior_ptid
+ so that bits of core GDB realizes there's something here, e.g.,
+ so that the user can say "kill" again. */
+ inferior_ptid = pid_to_ptid (MAGIC_NULL_PID);
}
/* Worker function for remote_mourn. */
Index: gdbserver/linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.59
diff -u -p -r1.59 linux-low.c
--- gdbserver/linux-low.c 2 Jul 2007 15:35:36 -0000 1.59
+++ gdbserver/linux-low.c 8 Aug 2007 14:21:59 -0000
@@ -280,6 +280,10 @@ linux_kill (void)
/* Make sure it died. The loop is most likely unnecessary. */
wstat = linux_wait_for_event (thread);
} while (WIFSTOPPED (wstat));
+
+ clear_inferiors ();
+ free (all_processes.head);
+ all_processes.head = all_processes.tail = NULL;
}
static void
@@ -318,6 +322,8 @@ linux_detach (void)
delete_all_breakpoints ();
for_each_inferior (&all_threads, linux_detach_one_process);
clear_inferiors ();
+ free (all_processes.head);
+ all_processes.head = all_processes.tail = NULL;
return 0;
}
next prev parent reply other threads:[~2007-08-08 14:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-08 13:30 Petr Koloros
2007-08-08 14:24 ` Daniel Jacobowitz [this message]
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=20070808142429.GA32455@caradoc.them.org \
--to=drow@false.org \
--cc=gdb@sourceware.org \
--cc=pko@sysgo.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