This is the mail archive of the gdb-testers@sourceware.org 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]

gdb fails when breakpoint hit in NPTL thread


Utilizing snapshot GDB-6.3.50.20051007 with a statically compiled bin
linked with pthread doesn't work. I've tested with a stable release 6.3
with the same results. Machine base is dual x86_64 opteron 246's
utilizing GlibC 2.3.5 and GCC 3.4.4 Thread model: posix

The following works fine when linked dynamically.

test-scenario

pthreadtest.c:
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
#include <unistd.h>

void*
myThread(void* arg)
{
   printf("Success, created thread exiting\n");
   return (0);
}

int
main(int argc,
    char** argv)
{

int priority =  10;
int status;
pthread_t threadId;

printf("Will create thread with priority %d\n", priority);
status = pthread_create(&threadId, NULL, myThread, 0);
printf("Thread creation returned %d\n", status);
sleep(2);

printf("Main thread exiting\n");

   return (0);
}

gcc -static -o pthreadtest pthreadtest.c -lpthread

root@unstable:~/scratch/mutex-test> gdb pthreadtest
GNU gdb 6.3.50.20051007
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "x86_64-unknown-linux-gnu"...Using host
libthread_db library "/lib64/libthread_db.so.1".

(gdb) b myThread
Breakpoint 1 at 0x4002c2
(gdb) run
Starting program: /root/scratch/mutex-test/pthreadtest
Will create thread with priority 10
Thread creation returned 0

Program terminated with signal SIGTRAP, Trace/breakpoint trap.
The program no longer exists.
(gdb)

Again, this works fine if linked dynamically. The program receives
SIGTRAP, cores and GDB just stops tracing for whatever reason.
Everything else seems to work as it should.


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