This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug threads/19461] strange "info thread" behavior in non-stop


https://sourceware.org/bugzilla/show_bug.cgi?id=19461

--- Comment #7 from Pedro Alves <palves at redhat dot com> ---
Alright, seems like a pretty basic problem:

Here in infrun.c:

          /* In non-stop mode, also resume the other branch.  */
          if (!detach_fork && (non_stop
                               || (sched_multi && target_is_non_stop_p ())))
            {
              if (follow_child)
                switch_to_thread (parent);
              else
                switch_to_thread (child);

              ecs->event_thread = inferior_thread ();
              ecs->ptid = inferior_ptid;
              keep_going (ecs);
            }

we resume the child, but never mark it "running".  Stopping gdb a bit below, in
the "return" line, after resuming the parent, and injecting an "info threads",
we see:

(top-gdb) p info_threads_command (NULL, 0)
  Id   Target Id         Frame 
* 1.1  Thread 0x7ffff7fc1740 (LWP 31875) "fork-plus-threa" (running)
  2.1  process 31879 "fork-plus-threa" Selected thread is running.
(gdb) 

This seems to fix it:

~~~
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 33981d2..60a90f1 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5209,6 +5209,7 @@ Cannot fill $_exitsignal with the correct signal
number.\n"));

              ecs->event_thread = inferior_thread ();
              ecs->ptid = inferior_ptid;
+             set_running (ecs->ptid, 1);
              keep_going (ecs);
            }

~~~

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]