GDB: Work around D;PID handling bug in older GDBservers (PR gdb/23377)
authorPedro Alves <palves@redhat.com>
Wed, 11 Jul 2018 22:31:44 +0000 (23:31 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 11 Jul 2018 22:33:19 +0000 (23:33 +0100)
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.

gdb/ChangeLog
gdb/remote.c

index c82c37ed3879756c4d6aab3fc09d30dbc870d718..9b920c4bce6d21db603c59ac2326f595c1681e6d 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-11  Pedro Alves  <palves@redhat.com>
+
+       PR gdb/23377
+       * remote.c (remote_target::remote_detach_pid): Call
+       set_current_process.
+
 2018-07-11  Pedro Alves  <palves@redhat.com>
 
        * h8300-tdep.c (h8300_gdbarch_init): Remove
index 297c198ed69012892f0eec53f7efa24648a0886b..a81d67e5ede4ba1f9c639527d2eb80de60c7e055 100644 (file)
@@ -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
This page took 0.042016 seconds and 4 git commands to generate.