bug-gdb
[Top][All Lists]
Advanced

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

thread bug in new GDB-6.8 -- copie


From: Dušan Ďurech
Subject: thread bug in new GDB-6.8 -- copie
Date: Fri, 28 Mar 2008 16:45:08 +0100

Dear Sir

I thing, that I find in new GDB 6.8 new bug.

example :

#include <pthread.h>
#include <stdio.h>
#include <unistd.h>

static pthread_mutex_t mutex;

void* print_pokus(void *unused)
{
  while(1)
  {
    pthread_mutex_lock(&mutex);
    printf(" %s\n", (char *)unused);
    pthread_mutex_unlock(&mutex);
  }

  return(NULL);
}

int main()
{
  pthread_t thread_id1;
  pthread_t thread_id2;
  pthread_t thread_id3;
 
 pthread_mutex_init(&mutex, NULL);

 pthread_create(&thread_id1, NULL, print_pokus, "1");
 pthread_create(&thread_id2, NULL, print_pokus, "2");
 pthread_create(&thread_id3, NULL, print_pokus, "3");

  while(1)
  {
    sleep(1);
  }

  return(0);
}

I compile source code :
gcc -Wall -pedantic -g -O0 thread.c -lpthread

ulimit -c unlimited
gdb ./a.out
(gdb) break print_pokus
Breakpoint 1 at 0x80484fa: file thread.c, line 12.
(gdb) run
Starting program: /home/dusan/tuxanci-ng-svn/a.out
[Thread debugging using libthread_db enabled]
[New Thread 0xb7dfaad0 (LWP 19310)]
[New Thread 0xb7df9b90 (LWP 19313)]

(gdb) continue
[ press key ENTER 10 second ]

GDB remember last command. I press key ENTER more or less 10 second,
then a use commad step same 10 second and debufer`s program down.

(gdb) step
[ press key ENTER 10 second ]

I analyze coredump :
(gdb) disassemble
0x080484f4 <print_pokus+0>:     push   %ebp
0x080484f5 <print_pokus+1>:     mov    %esp,%ebp
0x080484f7 <print_pokus+3>:     sub    $0x8,%esp
0x080484fa <print_pokus+6>:     int3
0x080484fb <print_pokus+7>:     add    $0x24,%al
0x080484fd <print_pokus+9>:     int3
0x080484fe <print_pokus+10>:    xchg   %eax,%edi
0x080484ff <print_pokus+11>:    add    $0x8,%al
0x08048501 <print_pokus+13>:    call   0x8048440 <address@hidden>
0x08048506 <print_pokus+18>:    int3
0x08048507 <print_pokus+19>:    inc    %ebp
0x08048508 <print_pokus+20>:    or     %cl,-0x38fbdbbc(%ecx)
0x0804850e <print_pokus+26>:    add    $0x24,%al
0x08048510 <print_pokus+28>:    cwtl
0x08048511 <print_pokus+29>:    xchg   %al,(%eax,%ecx,1)
0x08048514 <print_pokus+32>:    call   0x8048420 <address@hidden>
0x08048519 <print_pokus+37>:    movl   $0x80497cc,(%esp)
0x08048520 <print_pokus+44>:    call   0x8048410 <address@hidden>
0x08048525 <print_pokus+49>:    jmp    0x80484fa <print_pokus+6>

I see, that GDB-6.8 abandon in debufer`s program int3 instruction and hereat program down.
GDB abandon in debufer`s program int3 instruction in function, which share more threads.

best regarts

PS:

When send this email, My down email client, hereat send email even now.

Dušan Ďurech - Slowakia Republic


reply via email to

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