bug-gdb
[Top][All Lists]
Advanced

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

a problem about gdb (can you help me)


From: anny
Subject: a problem about gdb (can you help me)
Date: Thu, 1 Aug 2002 11:51:56 +0800

Hi,

I'm not sure whether this is a bug of gdb 5.0.
I made a very simple multi-threaded program in RedHat 7.1 and
tried to debug it with gdb 5.0 that is distributed on May 2000.
When I run the program in gdb 5.0,it shows "Program exits with code 01" in the middle of execution of the program.
Following is my multi-threaded program.
It creates pthreas. 
test.c
#include <pthread.h>

void* runProc();

int main()
{
  pthread_t threadID;
  pthread_create(&threadID,NULL,runProc,NULL);
  printf("main-threadID: %d\n",threadID);
 }
  
void* runProc()
{
  pthread_t threadID;
  pthread_create(&threadID,NULL,runProc,NULL);
  printf("runProc-threadID: %d\n",threadID);
  return NULL;
}
compile : gcc -o test test.c -lpthread

Following is the result of debugging my program with gdb 5.0:

gdb test
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2000 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 "i686-pc-linux"...
(gdb) run
Starting program: /root/test
[New Thread 1024 (LWP 3122)]
[New Thread 2049 (LWP 3123)]
Delayed SIGSTOP caught for LWP 3123.

[New Thread 1026 (LWP 3124)]
Delayed SIGSTOP caught for LWP 3124.
Received Real-time signal 0 in LWP 3122 while waiting for SIGSTOP.
[New Thread 2051 (LWP 3125)]
Using pending wait status for LWP 3122.
main-threadID; 1026
Delayed SIGSTOP caught for LWP 3125.
LWP 3123 exited.
LWP 3125 exited.
LWP 3124 exited.
Program exited with code 01.
(gdb) quit
 
 
                                   2002/8/1   anny
 


  ** PID[31946],THR[1026]: digit=0
0[New Thread 2051 (LWP 31947)]
00
  ** PID[31947],THR[2051]: digit=1
01[New Thread 3076 (LWP 31948)]
011
  ** PID[31948],THR[3076]: digit=2
12
Program exited normally.
(gdb) 12222
(gdb) info threads
No stack.
(gdb) bt
No stack.
(gdb) quit
address@hidden testgdb]$
==END====================================================================

Only three pthreads are created and my program dies without creating fourth
and fifth pthreads.

But debugging my program with a gdb that comes with RedHat 7.1 works nicely.
Following is the result of debugging my program with gdb in RedHat 7.1.

==BEGIN==================================================================
address@hidden testgdb]$ gdb mthrtest1
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 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 "i386-redhat-linux"...
(gdb) run
Starting program: /home/htlim/testgdb/mthrtest1
[New Thread 1024 (LWP 31951)]

  ** main thread:PID[31951],THR[1024]
[New Thread 2049 (LWP 31952)]
Delayed SIGSTOP caught for LWP 31952.
[New Thread 1026 (LWP 31953)]
Delayed SIGSTOP caught for LWP 31953.

  ** PID[31953],THR[1026]: digit=0
[New Thread 2051 (LWP 31954)]
Delayed SIGSTOP caught for LWP 31954.
0
  ** PID[31954],THR[2051]: digit=1
[New Thread 3076 (LWP 31955)]
Delayed SIGSTOP caught for LWP 31955.
10
  ** PID[31955],THR[3076]: digit=2
[New Thread 4101 (LWP 31956)]
Delayed SIGSTOP caught for LWP 31956.
210
  ** PID[31956],THR[4101]: digit=3
[New Thread 5126 (LWP 31957)]
Delayed SIGSTOP caught for LWP 31957.
3210
  ** PID[31957],THR[5126]: digit=4
01234LWP 31953 exited.
  ** THR[1026] terminated
1234LWP 31954 exited.
  ** THR[2051] terminated
234LWP 31955 exited.
  ** THR[3076] terminated
34LWP 31956 exited.
  ** THR[4101] terminated
4LWP 31957 exited.
  ** THR[5126] terminated

**** Test program terminates ****
LWP 31952 exited.

Program exited normally.
(gdb) quit
address@hidden testgdb]$
==END====================================================================

reply via email to

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