LynxOS: Resume the same thread when receiving a thread create/exit event.
authorJoel Brobecker <brobecker@gnat.com>
Mon, 7 Jan 2013 11:39:00 +0000 (11:39 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Mon, 7 Jan 2013 11:39:00 +0000 (11:39 +0000)
Before this patch, the ptid passed to lynx_resume was completely
ignored, and we used the current_inferior. This resulted in trying
to resume the inferior execution using the wrong ptid after having
received a thread create/exit event, because the inferior_ptid
was still set to the ptid prior to receiving the signal.

gdb/gdbserver/ChangeLog:

        * lynx-low.c (lynx_resume): Use the resume_info parameter
        to determine the ptid for the lynx_ptrace call, unless
        it is equal to minus_one_ptid, in which case we use the
        ptid of the current_inferior.
        (lynx_wait_1): After having received a thread create/exit
        event, resume the inferior's execution using the signaling
        thread's ptid, rather than the old ptid.

gdb/gdbserver/ChangeLog
gdb/gdbserver/lynx-low.c

index 4aeb3f9d47422aa3f4940e1cc2fa0df78ae29aa0..8f85b92a0a5919d7b2e2abacd4ff403889e5b4fc 100644 (file)
@@ -1,3 +1,13 @@
+2013-01-07  Joel Brobecker  <brobecker@adacore.com>
+
+       * lynx-low.c (lynx_resume): Use the resume_info parameter
+       to determine the ptid for the lynx_ptrace call, unless
+       it is equal to minus_one_ptid, in which case we use the
+       ptid of the current_inferior.
+       (lynx_wait_1): After having received a thread create/exit
+       event, resume the inferior's execution using the signaling
+       thread's ptid, rather than the old ptid.
+
 2013-01-07  Joel Brobecker  <brobecker@adacore.com>
 
        * lynx-low.c (lynx_resume): Delete variable ret.
index 9aa0140f1731f3c72bc56c5016c84e8ea8336590..4aba379f1ad4a5cac7fce709a23390dd3dbe0649 100644 (file)
@@ -349,14 +349,17 @@ lynx_attach (unsigned long pid)
 static void
 lynx_resume (struct thread_resume *resume_info, size_t n)
 {
-  ptid_t inferior_ptid = thread_to_gdb_id (current_inferior);
   /* FIXME: Assume for now that n == 1.  */
+  ptid_t ptid = resume_info[0].thread;
   const int request = (resume_info[0].kind == resume_step
                        ? PTRACE_SINGLESTEP : PTRACE_CONT);
   const int signal = resume_info[0].sig;
 
+  if (ptid_equal (ptid, minus_one_ptid))
+    ptid = thread_to_gdb_id (current_inferior);
+
   regcache_invalidate ();
-  lynx_ptrace (request, inferior_ptid, 1, signal, 0);
+  lynx_ptrace (request, ptid, 1, signal, 0);
 }
 
 /* Resume the execution of the given PTID.  */
@@ -497,12 +500,12 @@ retry:
          case SIGNEWTHREAD:
            /* We just added the new thread above.  No need to do anything
               further.  Just resume the execution again.  */
-           lynx_continue (ptid);
+           lynx_continue (new_ptid);
            goto retry;
 
          case SIGTHREADEXIT:
            remove_thread (find_thread_ptid (new_ptid));
-           lynx_continue (ptid);
+           lynx_continue (new_ptid);
            goto retry;
        }
     }
This page took 0.033137 seconds and 4 git commands to generate.