aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2020-01-10 20:05:45 +0000
committerPedro Alves <palves@redhat.com>2020-01-10 20:05:45 +0000
commitddf5db90a175756b3a5c39ee87d549d9f9d09d28 (patch)
tree1765dd0813ece91a0b5fdc37a997e3685b7ade8f
parent5018ce90c1205d79f29adf954b0fd5e613d08430 (diff)
downloadgdb-ddf5db90a175756b3a5c39ee87d549d9f9d09d28.zip
gdb-ddf5db90a175756b3a5c39ee87d549d9f9d09d28.tar.gz
gdb-ddf5db90a175756b3a5c39ee87d549d9f9d09d28.tar.bz2
Don't check target is running in remote_target::mourn_inferior
I believe the tail end of remote_target::mourn_inferior is broken, and it's been broken for too long to even bother trying to fix. Most probably nobody needs it. If the code is reached and we find the target is running, we'd need to resync the thread list, at least, since generic_mourn_inferior got rid of all the threads in the inferior, otherwise, we'd hit an assertion on the next call to inferior_thread(), for example. A "correct" fix would probably involve restarting the whole remote_target::start_remote requence, exactly as if we had completely disconnected and reconnected from scratch. Note that regular stub debugging usually uses plain target remote, but this code is only reachable in target extended-mode: - The !remote_multi_process_p check means that it's only reacheable if the stub does not support multi-process. I.e., there can only ever be one live process. - remote_target::mourn_inferior has this at the top: /* In 'target remote' mode with one inferior, we close the connection. */ if (!rs->extended && number_of_live_inferiors () <= 1) { unpush_target (this); /* remote_close takes care of doing most of the clean up. */ generic_mourn_inferior (); return; } Which means that if we only had one live inferior (which for our case, must be true), we'll have closed the connection already, unless we're in extended-remote mode. gdb/ChangeLog: 2020-01-10 Pedro Alves <palves@redhat.com> * remote.c (remote_target::mourn_inferior): No longer check whether the target is running.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/remote.c20
2 files changed, 5 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6e97bd4..ff1bc14 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2020-01-10 Pedro Alves <palves@redhat.com>
+ * remote.c (remote_target::mourn_inferior): No longer check
+ whether the target is running.
+
+2020-01-10 Pedro Alves <palves@redhat.com>
+
* corelow.c (core_target::has_execution): Change parameter type to
inferior pointer.
* inferior.c (number_of_live_inferiors): Use
diff --git a/gdb/remote.c b/gdb/remote.c
index 539b27e..51fa5da 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -9843,26 +9843,6 @@ remote_target::mourn_inferior ()
/* Call common code to mark the inferior as not running. */
generic_mourn_inferior ();
-
- if (!have_inferiors ())
- {
- if (!remote_multi_process_p (rs))
- {
- /* Check whether the target is running now - some remote stubs
- automatically restart after kill. */
- putpkt ("?");
- getpkt (&rs->buf, 0);
-
- if (rs->buf[0] == 'S' || rs->buf[0] == 'T')
- {
- /* 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 = magic_null_ptid;
- }
- }
- }
}
bool