This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: unable to debug statically linked program with linux threads
- From: Eric Desjardins <eric dot desjardins at discreet dot com>
- To: gdb at sources dot redhat dot com
- Date: Thu, 17 Mar 2005 17:18:52 -0500
- Subject: Re: unable to debug statically linked program with linux threads
- References: <1111097217.25342@horse.he.net>
Hi,
I got this problem too but I use dynamic linking and I run without
LD_ASSUME_KERNEL 2.4.19 env variable set (using NTPL support).
If you do not use NTPL support, you won't have this problem.
Normally when you get a sig32 signal, your thread is doing something
and is interrupted. For example, suppose your thread is waiting on a
select call and the thread is destroyed, the thread will receive a sig32
signal.
I assume this should not be happening and usually considers that as a
bug. In your case, the sleep command on your thread is interrupted so I
guess this is why you receive this signal.
Have you tried setting a signal handler?
Eric
On Thu, 2005-03-17 at 17:06, Ajay Patel wrote:
> Hi,
> I have a FC3 based i686 machine with gdb version 6.1.
> I got a simple threaded program from one BSD. (program attached)
>
> With dynamic linking (linux threads), I can run
> the program under gdb without a problem.
> All thread related commands seems to work properly.
>
> With static linking, when I run this program under
> gdb, first I get
> "Program received signal SIG32/SIG33 Real-time event 32/32".
> I avoid this problem by
> "handle SIG32/SIG33 pass nostop noprint".
>
> However none of the thread related command works.
>
> Any suggestion?
>
> Thanks
> Ajay
>
> /****************************************************************************
> *
> * Simple diff mode test.
> *
> * $FreeBSD: src/lib/libpthread/test/hello_d.c,v 1.1 2000/04/24 21:07:37
> jasone Exp $
> *
> ****************************************************************************/
>
> #include <stdio.h>
> #include <string.h>
> #include <pthread.h>
>
> void *
> entry1(void * a_arg)
> {
> fprintf(stderr, "Hello world1\n");
>
> sleep(100);
> }
>
> void *
> entry2(void * a_arg)
> {
> fprintf(stderr, "Hello world2\n");
>
> sleep(100);
> }
> int
> main()
> {
> pthread_t thread1, thread2;
> int error;
>
> error = pthread_create(&thread1, NULL, entry1, NULL);
> if (error)
> fprintf(stderr, "Error in pthread_create(): %s\n",
> strerror(error));
>
> error = pthread_create(&thread2, NULL, entry2, NULL);
> if (error)
> fprintf(stderr, "Error in pthread_create(): %s\n",
> strerror(error));
>
> error = pthread_join(thread1, NULL);
> if (error)
> fprintf(stderr, "Error in pthread_join(): %s\n",
> strerror(error));
> error = pthread_join(thread2, NULL);
> if (error)
> fprintf(stderr, "Error in pthread_join(): %s\n",
> strerror(error));
>
> return 0;
> }