This is the mail archive of the gdb@sources.redhat.com 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]

Re: Did the fix for recycled thread ids uncover another bug?


On Monday 14 June 2004 16:22, Daniel Jacobowitz wrote:
> On Mon, Jun 14, 2004 at 04:17:47PM -0700, Paul Gilliam wrote:
> > I will post a follow-up with the details if someone tells me this is the
> > right mail-list.
>
> I already did...

I have done some more homework and found that the problem is with 6.1 and 
seems to be fixed in 6.1.0.90_2004-06-15-cvs (I just tried it).  This is all 
on the PowerPC.

So now I need to find a patch for 6.1 that will fix this.

I have attached four files: the first is the test case, tbug.c; two are 
transcripts from gdb 6.1 (with some back-porting) for ppc-32 and for ppc-64; 
the last is a transcript from gdb 6.1.0.90_2004-06-15-cvs for ppc-32..

'tbug' starts two threads, each using the same thread function which just 
waits a few seconds and returns.  Set a break-point in 'tf' (the thread 
function) and run.  In the 64-bit case, everything works as expected.  In the 
32 bit case, we get a message 'reading register pc (#64): No such process' 
and then we're hosed.

Thanks for any help,

-=# Paul Gilliam #=-
madcow:/home/public/test-tools/gdb # gdb tbug
GNU gdb 6.1
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
library
"/lib/tls/libthread_db.so.1".

(gdb) break main
Breakpoint 1 at 0x10000630: file tbug.c, line 31.
(gdb) run
Starting program: /home/public/test-tools/gdb/tbug
[Thread debugging using libthread_db enabled]
[New Thread 1074020384 (LWP 26705)]
[Switching to Thread 1074020384 (LWP 26705)]

Breakpoint 1, main (argc=1, argv=0xffffe464) at tbug.c:31
31        for (n = 0; n < N; ++n)
(gdb) cont
Continuing.
[New Thread 1078217504 (LWP 26708)]
tf(0): begin
[New Thread 1082411808 (LWP 26709)]
after create
tf(1): begin
tf(0): end
[Thread 1078217504 (LWP 26708) exited]
tf(1): end
[Thread 1082411808 (LWP 26709) exited]
after join

Program exited normally.
(gdb) clear main
Deleted breakpoint 1
(gdb) break tf
Breakpoint 2 at 0x10000594: file tbug.c, line 15.
(gdb) run
Starting program: /home/public/test-tools/gdb/tbug
[Thread debugging using libthread_db enabled]
[New Thread 1074020384 (LWP 26710)]
reading register pc (#64): No such process.
(gdb) cont
Continuing.
reading register pc (#64): No such process.
(gdb) cont
Continuing.
reading register pc (#64): No such process.
(gdb) cont
Continuing.
reading register pc (#64): No such process.
(gdb) quit
The program is running.  Exit anyway? (y or n) y

madcow:/home/public/test-tools/gdb # gdb64 tbug64
GNU gdb 6.1
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 "ppc64-suse-linux"...Using host libthread_db
library
"/lib64/tls/libthread_db.so.1".

(gdb) break main
Breakpoint 1 at 0x100007f8: file tbug.c, line 31.
(gdb) run
Starting program: /home/public/test-tools/gdb/tbug64
[Thread debugging using libthread_db enabled]
[New Thread 549757822848 (LWP 26734)]
[Switching to Thread 549757822848 (LWP 26734)]

Breakpoint 1, main (argc=1, argv=0x1fffffff2b8) at tbug.c:31
31        for (n = 0; n < N; ++n)
(gdb) cont
Continuing.
[New Thread 549762017472 (LWP 26737)]
tf(0): begin
[New Thread 549766211776 (LWP 26738)]
after create
tf(1): begin
tf(0): end
[Thread 549762017472 (LWP 26737) exited]
tf(1): end
[Thread 549766211776 (LWP 26738) exited]
after join

Program exited normally.
(gdb) clear main
Deleted breakpoint 1
(gdb) break tf
Breakpoint 2 at 0x1000074c: file tbug.c, line 15.
(gdb) run
Starting program: /home/public/test-tools/gdb/tbug64
[Thread debugging using libthread_db enabled]
[New Thread 549757822848 (LWP 26739)]
[New Thread 549762017472 (LWP 26740)]
[Switching to Thread 549762017472 (LWP 26740)]

Breakpoint 2, tf (arg=0x0) at tbug.c:15
15        int n = (int) (long int) arg;
(gdb) cont
Continuing.
[New Thread 549766211776 (LWP 26741)]
[Switching to Thread 549766211776 (LWP 26741)]

Breakpoint 2, tf (arg=0x1) at tbug.c:15
15        int n = (int) (long int) arg;
(gdb) cont
Continuing.
tf(1): begin
tf(0): begin
after create
tf(1): end
tf(0): end
[Thread 549762017472 (LWP 26740) exited]
[Thread 549766211776 (LWP 26741) exited]
after join

Program exited normally.
(gdb) quit

pgilliam@elm3b11:~/gdb_cvs_top/build-ppc32> gdb/gdb ~/tbug
GNU gdb 6.1.0.90_2004-06-15-cvs
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 "powerpc--linux"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) b tf
Breakpoint 1 at 0x10000584: file tbug.c, line 15.
(gdb) run
Starting program: /home/pgilliam/tbug
[Thread debugging using libthread_db enabled]
[New Thread 1024 (LWP 10689)]
[New Thread 2049 (LWP 10692)]
[New Thread 1026 (LWP 10693)]
[Switching to Thread 1026 (LWP 10693)]

Breakpoint 1, tf (arg=0x0) at tbug.c:15
15        int n = (int) (long int) arg;
(gdb) c
Continuing.
[New Thread 2051 (LWP 10694)]
tf(0): begin
after create
[Switching to Thread 2051 (LWP 10694)]

Breakpoint 1, tf (arg=0x1) at tbug.c:15
15        int n = (int) (long int) arg;
(gdb) c
Continuing.
tf(1): begin
tf(0): end
tf(1): end
after join

Program exited normally.
(gdb) q
/* File tbug.c created by Steve Munroe on Thu Jan 15 2004. */

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

#define N       2

static void *
tf (void *arg)
{
  int n = (int) (long int) arg;
  char number[160];
  sprintf(number, "tf(%ld): begin", (long)arg);
  puts (number);

 sleep (10);
  sprintf(number, "tf(%ld): end", (long)arg);
  puts (number);
  return NULL;
}

int main (int argc, char *argv[])
{
  int n;
  pthread_t th[N];

  for (n = 0; n < N; ++n)
    if (pthread_create (&th[n], NULL, tf, (void *) (long int) n) != 0)
      {
        puts ("create failed");
        exit (1);
      }

  puts("after create");

  for (n = 0; n < N; ++n)
    if (pthread_join (th[n], NULL) != 0)
      {
        puts ("join failed");
        exit (1);
      }


  puts("after join");
  return 0;
}

/* Change Log
<@log@>

Thu Jan 15 2004  13:44:33  by Steve Munroe
<reason><version><Brief description and why change was made.>
*/

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