bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

can't debug code after pthread_create


From: jizy
Subject: can't debug code after pthread_create
Date: Sat, 3 Feb 2001 18:21:41 +0800

    When a thread created by pthread_create ends, GDB prints "Program exited 
normally." and considers the whole program is ends, that is, the code after 
pthread_create can't debug using GDB.

    My environment is RedHat Linux 7.0 & GDB 5.0 . My program is :

//////////////////////// main.cpp /////////////////////////
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>

void *ThreadProc( void * )
{
 return NULL;
}

int main(int argc, char *argv[])
{
 pthread_t tThread;
 pthread_create( &tThread, NULL, ThreadProc, NULL );
 
 sleep(3);
 
 return 0;
}

//////////////////////// ends //////////////////////////////

Compile : gcc -lpthread -othread main.cpp

Debug : gdb thread

(gdb) : break sleep
(gdb) : run

then GDB printed "...Program exited normally.", I type "info stack" & "info 
thread", GDB says there is no stack & thread.


    That's all.

                                                        Sincerely, 
                                                            jizy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]