Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Fix for PR gdb/10757
Date: Tue, 27 Oct 2009 00:41:00 -0000	[thread overview]
Message-ID: <8ac60eac0910261741y3db8faekb7aef4305d6c2e4d@mail.gmail.com> (raw)
In-Reply-To: <200910262135.00507.pedro@codesourcery.com>

On Mon, Oct 26, 2009 at 2:35 PM, Pedro Alves <pedro@codesourcery.com> 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 ...;
    atomic_increment(&thread_creation_in_progress);
    ... create new thread, put it on thread list ...
    atomic_decrement(&thread_creation_in_progress);
    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


  reply	other threads:[~2009-10-27  0:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15 19:10 Paul Pluzhnikov
2009-10-17 23:26 ` Paul Pluzhnikov
2009-10-25 17:15   ` Paul Pluzhnikov
2009-10-25 23:54   ` Pedro Alves
2009-10-26 21:25     ` Paul Pluzhnikov
2009-10-26 21:34       ` Pedro Alves
2009-10-27  0:41         ` Paul Pluzhnikov [this message]
2009-10-27  9:43           ` Pedro Alves
2009-10-27 16:58             ` Paul Pluzhnikov
2009-10-27 21:38       ` Paul Pluzhnikov
2009-10-27 21:52         ` Pedro Alves
2009-10-28 17:04           ` Paul Pluzhnikov
2009-10-25 23:59 Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ac60eac0910261741y3db8faekb7aef4305d6c2e4d@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox