🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1178

pthread_exit from initial thread makes GDB hang

#1178
From: Ben Pfaff
Date: Tue, 18 Dec 2007 17:11
34 lines
2535 bytes
Under Debian GNU/Linux "unstable", with a Debian
2.6.22-1-686-bigmem kernel, the following program hangs GDB 6.7.1
(as packaged for Debian under Debian version number 6.7.1-1) if
one types control-C to break out to the debugger:

    #include <pthread.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>

    void *my_thread(void *foo) 
    {
        for (;;) {
            sleep(1);
            putchar('.');
            fflush(stdout);
        }
    }

    int main(void) 
    {
        pthread_t pth;
        pthread_create(&pth, NULL, my_thread, NULL);
        pthread_detach(pthread_self());
        pthread_exit(0);
    }

If the final two statements in main are changed to
        for (;;)
          pause();
then GDB can break out as expected.
-- 
Ben Pfaff 
http://benpfaff.org
Technical Details
Message-ID: <mailman.5167.1198006224.18990.bug-gdb@gnu.org>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f5053,32a6226bdeea4060,start
X-Google-Attributes: gidf5053,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail
From: Ben Pfaff <blp@cs.stanford.edu>
Newsgroups: gnu.gdb.bug
Subject: pthread_exit from initial thread makes GDB hang
Date: Tue, 18 Dec 2007 09:11:11 -0800
Lines: 37
Sender: news <news@ger.gmane.org>
Approved: bug-gdb@gnu.org
Message-ID: <mailman.5167.1198006224.18990.bug-gdb@gnu.org>
Reply-To: blp@cs.stanford.edu
NNTP-Posting-Host: lists.gnu.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.Stanford.EDU 1198006225 25146 199.232.76.165 (18 Dec 2007 19:30:25 GMT)
X-Complaints-To: news@news.stanford.edu
To: bug-gdb@gnu.org
Envelope-to: bug-gdb@gnu.org
X-Injected-Via-Gmane: http://gmane.org/
X-Gmane-NNTP-Posting-Host: 76.14.48.172
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)
Cancel-Lock: sha1:62PljefOL8KLM3siYytJlFDqVD8=
X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4)
X-Mailman-Approved-At: Tue, 18 Dec 2007 14:30:23 -0500
X-BeenThere: bug-gdb@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Bug reports for GDB, the GNU debugger" <bug-gdb.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/bug-gdb>
List-Post: <mailto:bug-gdb@gnu.org>
List-Help: <mailto:bug-gdb-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=subscribe>