diff options
author | Pedro Alves <palves@redhat.com> | 2018-07-11 23:31:44 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2018-07-11 23:33:19 +0100 |
commit | 4c7333b308f5178813745f40e641231efb1cb763 (patch) | |
tree | 854c93f7e99c5604739a97b105fd9445028ef020 /gdb/remote.c | |
parent | 31445d1036f7fc41de2724cb016913c9b1461bb1 (diff) | |
download | gdb-4c7333b308f5178813745f40e641231efb1cb763.zip gdb-4c7333b308f5178813745f40e641231efb1cb763.tar.gz gdb-4c7333b308f5178813745f40e641231efb1cb763.tar.bz2 |
GDB: Work around D;PID handling bug in older GDBservers (PR gdb/23377)
This commit adds a GDB workaround for the GDBserver bug exposed by
commit f2ffa92bbce9 ("gdb: Eliminate the 'stop_pc' global"), so that
newer GDBs can continue working with older GDBservers.
gdb/ChangeLog:
2018-07-11 Pedro Alves <palves@redhat.com>
PR gdb/23377
* remote.c (remote_target::remote_detach_pid): Call
set_current_process.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 297c198..a81d67e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -5661,6 +5661,14 @@ remote_target::remote_detach_pid (int pid) { struct remote_state *rs = get_remote_state (); + /* This should not be necessary, but the handling for D;PID in + GDBserver versions prior to 8.2 incorrectly assumes that the + selected process points to the same process we're detaching, + leading to misbehavior (and possibly GDBserver crashing) when it + does not. Since it's easy and cheap, work around it by forcing + GDBserver to select GDB's current process. */ + set_general_process (); + if (remote_multi_process_p (rs)) xsnprintf (rs->buf, get_remote_packet_size (), "D;%x", pid); else |