This is the mail archive of the gdb-patches@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]

Re: [commit/RFA] Avoid switch to invalid ptid during Ada task switch.


> I think that the wording that you added is fine, though I find it
> confusing to see that there's a new thread, [New Thread 10250], but
> that GDB is unable to switch to it.  I think it might be less
> confusing if the [New Thread...] message did not appear at all.  I'm
> guessing though that suppressing that message would not be easy, and
> probably not worthwhile, especially for a case that's not supposed to
> happen.

Thanks for the feedback.  About that new-thread message, I don't think
it's avoidable.  On some targets, we "discover" threads only on demand.
What I mean by that is that the kernel does not send a notification
of some kind when a new thread is created or destroyed. It's GDB that
has to actively go look for new threads (target_ops to_find_new_threads).
GDB does not do this update systematically every time we stop - it would
be very expensive. So GDB it only does so when it needs to access that
thread list. For instance, when the user requests the list of threads.

Using the same example I used in my first message, here is the output
I get if I use "info threads" rather than try to perform a task switch:

    (gdb) info threads
    [New Thread 7598]
      3 Thread 7598  0x00007f865d88e5a9 in pthread_cond_wait@@GLIBC_2.3.2 ()
       from /lib/libpthread.so.0
    * 2 Thread 7599  task_switch.break_me () at task_switch.adb:44
      1 Thread 7592  0x00007f865d88e5a9 in pthread_cond_wait@@GLIBC_2.3.2 ()
       from /lib/libpthread.so.0

And if I only now try to perform the task switch, I only get the new
error message:

    (gdb) task 1
    Unable to compute thread ID for task 1.
    Cannot switch to this task.

(no new-thread notification).

-- 
Joel


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