On 8/2/05, Olaf Hering <olh(a)suse.de> wrote:
Do you have a simple testcase to demonstrate the problem?
The sample from this bug report works quite well. This is another bug
that I ran into, but it demonstrates gdb's confusion quite well.
I am porting over a significant codebase from AIX and not having
backtrace is a major pain. I am also using XLC, but the problem seems
to not constricted to XLC, since i compiled this with g++.
Here's a capture from a session which includes a listing of the program.
$ cat pthread2.cpp
printf("**** Success, created thread exiting\n");
int priority = 0;
struct sched_param schedParam;
schedParam.sched_priority = priority;
if (pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) != 0)
else if (pthread_attr_setschedpolicy(&attr, SCHED_OTHER) != 0)
else if (pthread_attr_setschedparam(&attr, &schedParam) != 0)
printf("Will create thread with priority %d\n", priority);
status = pthread_create(&threadId, &attr, myThread, 0);
printf("Thread creation returned %d\n", status);
printf("Main thread exiting\n");
$ g++ -g -lpthread -o run pthread2.cpp
$ gdb run
GNU gdb 6.3
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 "ppc-suse-linux"...Using host libthread_db
(gdb) break myThread
Breakpoint 1 at 0x100006ac: file pthread2.cpp, line 10.
Starting program: /home/sr9690/test/srvcoretest/run
[Thread debugging using libthread_db enabled]
[New Thread 1074001984 (LWP 12491)]
Will create thread with priority 0
[New Thread 1078197024 (LWP 12494)]
Thread creation returned 0
[Switching to Thread 1078197024 (LWP 12494)]
Breakpoint 1, myThread (arg=0x0) at pthread2.cpp:10
10 printf("**** Success, created thread exiting\n");
#0 myThread (arg=0x0) at pthread2.cpp:10
#1 0x0ffe3048 in start_thread () from /lib/tls/libpthread.so.0
#2 0x0fda9dd8 in clone () from /lib/tls/libc.so.6
#3 0x0fda9dd8 in clone () from /lib/tls/libc.so.6
Previous frame identical to this frame (corrupt stack?)
Thanks for your help