public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "ppluzhnikov at google dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug threads/10970] New: GDB hangs when main thread does pthread_exit
Date: Tue, 17 Nov 2009 05:35:00 -0000	[thread overview]
Message-ID: <20091117053515.10970.ppluzhnikov@google.com> (raw)

Test case:

--- cut ---
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>

void *
fn (void *p)
{
  int i;
  printf ("thread %p\n", (void *) pthread_self ());
  for (i = 0; i < 60; ++i)
    {
      printf ("i = %d\n", i);
      sleep (1);
    }
  printf ("thread %p done\n", (void *) pthread_self ());
  return NULL;
}

int main ()
{
  pthread_t tid;
  pthread_create (&tid, NULL, fn, NULL);
  pthread_exit (0);
}
--- cut ---

gcc -g -pthread hang.c -o hang
gdb-cvs -nx ./hang
NU gdb (GDB) 7.0.50.20091116-cvs
...
This GDB was configured as "x86_64-unknown-linux-gnu".
...
Reading symbols from /usr/local/google/tmp/hang...done.
(gdb) run
Starting program: /usr/local/google/tmp/hang 
[Thread debugging using libthread_db enabled]
[New Thread 0x40800950 (LWP 1540)]
thread 0x40800950
i = 0
i = 1
i = 2
i = 3
i = 4
       <<< hit Control-C here; the counter stops, but there is no GDB prompt.
   The only way to "recover" is "killall -9 gdb-cvs" in another window, at which
point inferior resumes (in the background):

i = 5
Killed
$ i = 6
i = 7
i = 8
...

-- 
           Summary: GDB hangs when main thread does pthread_exit
           Product: gdb
           Version: 6.8
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: threads
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: ppluzhnikov at google dot com
                CC: gdb-prs at sourceware dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10970

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


             reply	other threads:[~2009-11-17  5:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-17  5:35 ppluzhnikov at google dot com [this message]
2009-11-17  5:44 ` [Bug threads/10970] " ppluzhnikov at google dot com

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=20091117053515.10970.ppluzhnikov@google.com \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).