This is the mail archive of the 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: [patch] Fix for PR gdb/10757

On Mon, Oct 26, 2009 at 2:35 PM, Pedro Alves <> wrote:

> On Monday 26 October 2009 21:25:39, Paul Pluzhnikov wrote:
>> I wonder if it *could* take some lock that would make all other threads

> the problem with that is that gdb can stop all threads while one
> of them is holding the lock --- you'd have to consider
> the possibility of gdb deadlocking.

I was thinking along the lines of

  static __volatile__ int thread_iteration_in_progress;
  static __volatile__ int thread_creation_in_progress;

  __pthread_create_2_1 (...)
    while (thread_iteration_in_progress) nanoslep ...;
    ... create new thread, put it on thread list ...
    return ...

and in

   td_ta_thr_iter ()
     set thread_iteration_in_progress in the inferior to 1
     while (thread_creation_in_progress in inferior > 0)
        nanosleep ...

     iterate over the thread lists ...

     set thread_iteration_in_progress in inferior to 0

I think some variant of this could work, but I have no hopes this will
actually get into glibc.

Paul Pluzhnikov

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