aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2013-03-22 19:07:03 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2013-03-22 19:07:03 +0000
commit78a095c39e77cb462996a5d7c0438b768b09c7f0 (patch)
tree30e3ba546e919d7f8773d9b2f2c8a8b08a601e2f
parentc842b54b418996378be8764e325c3357f4f127fa (diff)
downloadgdb-78a095c39e77cb462996a5d7c0438b768b09c7f0.zip
gdb-78a095c39e77cb462996a5d7c0438b768b09c7f0.tar.gz
gdb-78a095c39e77cb462996a5d7c0438b768b09c7f0.tar.bz2
gdb/
* remote.c (remote_unpush_target): New function. (remote_open_1): Remove two pop_target calls, update one comment, add comment to target_preopen call. Replace pop_target call by remote_unpush_target call. (interrupt_query, readchar, getpkt_or_notif_sane_1): Replace pop_target calls by remote_unpush_target calls.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/remote.c40
2 files changed, 27 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 13d0611..26dafe9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2013-03-22 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * remote.c (remote_unpush_target): New function.
+ (remote_open_1): Remove two pop_target calls, update one comment, add
+ comment to target_preopen call. Replace pop_target call by
+ remote_unpush_target call.
+ (interrupt_query, readchar, getpkt_or_notif_sane_1): Replace
+ pop_target calls by remote_unpush_target calls.
+
2013-03-22 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_child_follow_fork): Don't call
diff --git a/gdb/remote.c b/gdb/remote.c
index d0a2ee9..f3206bc 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4188,6 +4188,14 @@ remote_query_supported (void)
}
}
+/* Remove any of the remote.c targets from target stack. Upper targets depend
+ on it so remove them first. */
+
+static void
+remote_unpush_target (void)
+{
+ pop_all_targets_above (process_stratum - 1);
+}
static void
remote_open_1 (char *name, int from_tty,
@@ -4205,30 +4213,18 @@ remote_open_1 (char *name, int from_tty,
wait_forever_enabled_p = 1;
/* If we're connected to a running target, target_preopen will kill it.
- But if we're connected to a target system with no running process,
- then we will still be connected when it returns. Ask this question
- first, before target_preopen has a chance to kill anything. */
+ Ask this question first, before target_preopen has a chance to kill
+ anything. */
if (remote_desc != NULL && !have_inferiors ())
{
- if (!from_tty
- || query (_("Already connected to a remote target. Disconnect? ")))
- pop_target ();
- else
+ if (from_tty
+ && !query (_("Already connected to a remote target. Disconnect? ")))
error (_("Still connected."));
}
+ /* Here the possibly existing remote target gets unpushed. */
target_preopen (from_tty);
- unpush_target (target);
-
- /* This time without a query. If we were connected to an
- extended-remote target and target_preopen killed the running
- process, we may still be connected. If we are starting "target
- remote" now, the extended-remote target will not have been
- removed by unpush_target. */
- if (remote_desc != NULL && !have_inferiors ())
- pop_target ();
-
/* Make sure we send the passed signals list the next time we resume. */
xfree (last_pass_packet);
last_pass_packet = NULL;
@@ -4348,7 +4344,7 @@ remote_open_1 (char *name, int from_tty,
/* Pop the partially set up target - unless something else did
already before throwing the exception. */
if (remote_desc != NULL)
- pop_target ();
+ remote_unpush_target ();
if (target_async_permitted)
wait_forever_enabled_p = 1;
throw_exception (ex);
@@ -5096,7 +5092,7 @@ interrupt_query (void)
if (query (_("Interrupted while waiting for the program.\n\
Give up (and stop debugging it)? ")))
{
- pop_target ();
+ remote_unpush_target ();
deprecated_throw_reason (RETURN_QUIT);
}
}
@@ -7051,11 +7047,11 @@ readchar (int timeout)
switch ((enum serial_rc) ch)
{
case SERIAL_EOF:
- pop_target ();
+ remote_unpush_target ();
error (_("Remote connection closed"));
/* no return */
case SERIAL_ERROR:
- pop_target ();
+ remote_unpush_target ();
perror_with_name (_("Remote communication error. "
"Target disconnected."));
/* no return */
@@ -7579,7 +7575,7 @@ getpkt_or_notif_sane_1 (char **buf, long *sizeof_buf, int forever,
if (forever) /* Watchdog went off? Kill the target. */
{
QUIT;
- pop_target ();
+ remote_unpush_target ();
error (_("Watchdog timeout has expired. Target detached."));
}
if (remote_debug)