]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
all-stop/synchronous RSP support thread-exit events
authorPedro Alves <pedro@palves.net>
Mon, 4 Apr 2022 20:12:03 +0000 (21:12 +0100)
committerPedro Alves <pedro@palves.net>
Mon, 18 Jul 2022 16:33:31 +0000 (17:33 +0100)
Currently, GDB does not understand the THREAD_EXITED stop reply in
remote all-stop mode.  There's no good reason for this, it just
happened that THREAD_EXITED was only ever reported in non-stop mode so
far.  This patch teaches GDB to parse that event in all-stop RSP too.
There is no need to add a qSupported feature for this, because the
server won't send a THREAD_EXITED event unless GDB explicitly asks for
it, with QThreadEvents, or with the GDB_TO_EXIT QThreadOptions option
added in the next patch.

Change-Id: Ide5d12391adf432779fe4c79526801c4a5630966

gdb/remote.c
gdbserver/server.cc

index 18c31c3e81120be4622e519307fe93a19726c992..090ea47aa38cf893815d62f4469ab2e570748156 100644 (file)
@@ -8187,7 +8187,8 @@ remote_target::process_stop_reply (struct stop_reply *stop_reply,
       && status->kind () != TARGET_WAITKIND_NO_RESUMED)
     {
       /* Expedited registers.  */
-      if (!stop_reply->regcache.empty ())
+      if (status->kind () != TARGET_WAITKIND_THREAD_EXITED
+         && !stop_reply->regcache.empty ())
        {
          struct regcache *regcache
            = get_thread_arch_regcache (this, ptid, stop_reply->arch);
@@ -8373,7 +8374,7 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status,
             again.  Keep waiting for events.  */
          rs->waiting_for_stop_reply = 1;
          break;
-       case 'N': case 'T': case 'S': case 'X': case 'W':
+       case 'N': case 'T': case 'S': case 'X': case 'W': case 'w':
          {
            /* There is a stop reply to handle.  */
            rs->waiting_for_stop_reply = 0;
index 3526e1d000e82668c7b34ade9b6e053e0442ac36..75a23e2c692915d862c38f05a4db79fa8a0aa161 100644 (file)
@@ -3060,6 +3060,7 @@ resume (struct thread_resume *actions, size_t num_actions)
 
       if (cs.last_status.kind () != TARGET_WAITKIND_EXITED
          && cs.last_status.kind () != TARGET_WAITKIND_SIGNALLED
+         && cs.last_status.kind () != TARGET_WAITKIND_THREAD_EXITED
          && cs.last_status.kind () != TARGET_WAITKIND_NO_RESUMED)
        current_thread->last_status = cs.last_status;