thread debugging

MuthuKumar-15 kmuthukumar@mail15.com
Tue May 25 09:21:00 GMT 2004


Hello All.

    I have a problem in thread debugging with GDB on HP-UX platform.

*** Sample program ***
/* thrd.c */

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

void *func()
{
 printf("Thread function\n"); pthread_exit(NULL);
}

main()
{
 pthread_t *t1; int result=0;

 t1=(pthread_t)malloc(sizeof(pthread_t));
 bzero((void *)t1,sizeof(pthread_t));

 result = pthread_create(t1, NULL, func, NULL);
  if (result == EAGAIN) {
   printf("EAGAIN Error\n"); free(t1); exit(1);
  }
  else if (result == -1) {
   printf("Negative return value\n"); free(t1); exit(1);
  }
 pthread_exit(NULL);
 free(t1);
}
**************************
$ cc -g -o thrd thrd.c

gdb execution:
    $ gdb -q thrd
    gdb> b main
    gdb> b func
    gdb> r
    ...
    < After finishing the pthread_exit in main(),it is going to func()'s pthread_exit.>
    gdb> s
    It is hanging over here.........!! It is not responsing.

1. What is the problem on program? How to debug this?
2. Is it good to debug memory leaks with GDB + librtc library on HP-UX platfrom?

Regards,
Muthukumar.




---
===============  It is a "Virus Free Mail" ===============
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 5/22/2004




More information about the Gdb mailing list