public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: unable to debug statically linked program with linux threads
@ 2005-03-17 23:59 Ajay Patel
  2005-03-18  2:47 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Ajay Patel @ 2005-03-17 23:59 UTC (permalink / raw)
  To: Daniel Jacobowitz, Ajay Patel, gdb

Daniel,

I checked out gdb from CVS head and applied this
"http://sourceware.org/ml/gdb-patches/2004-12/msg00240.html"
patch.

But still no thread commands.

Thanks for your help.
Ajay


> On Thu, Mar 17, 2005 at 02:06:57PM -0800, 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?
> 
> There's a patch in the gdb-patches archive for this.  I'll go ping
> it... it applies to CVS HEAD GDB.
> 
> 
> -- 
> Daniel Jacobowitz
> CodeSourcery, LLC
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: unable to debug statically linked program with linux threads
  2005-03-17 23:59 unable to debug statically linked program with linux threads Ajay Patel
@ 2005-03-18  2:47 ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2005-03-18  2:47 UTC (permalink / raw)
  To: Ajay Patel; +Cc: gdb

On Thu, Mar 17, 2005 at 03:59:12PM -0800, Ajay Patel wrote:
> Daniel,
> 
> I checked out gdb from CVS head and applied this
> "http://sourceware.org/ml/gdb-patches/2004-12/msg00240.html"
> patch.
> 
> But still no thread commands.

I'm afraid you'll need the second patch referenced in that message; I
haven't submitted it to gdb-patches yet - thought I had.  I will be
doing that after this patch is approved, or you can try the Debian
source package which includes the patch.


-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: unable to debug statically linked program with linux threads
@ 2005-03-18 23:53 Ajay Patel
  0 siblings, 0 replies; 6+ messages in thread
From: Ajay Patel @ 2005-03-18 23:53 UTC (permalink / raw)
  To: Daniel Jacobowitz, Ajay Patel, gdb

I got gdb_6.3.orig.tar.gz and gdb_6.3-5.diff from debian.
Newer Gdb works on a statically linked binaries.

With the same gdb source/binaries I tried different
combination. Here is the summary.

For iX86 running FC3.
---------------------
Program with Linux threads & dynamic linking
   all thread related command works
Program with Linux threads static linking
   all thread related command works.

Program with NPTL & dynamic linking 
   all thread realted command works.
Program with NPTL & static linking
  It gives following erros and thread related command does not work

warning: Cannot initialize thread debugging library: unknown thread_db
error '22'
warning: Cannot initialize thread debugging library: unknown thread_db
error '22

With EMAC(PPC-G4) running YDL 4.0.
----------------------------------
With Linux threads static linking or dynamic linking
none of the thread related command work.

With NPTL static linking or dynamic linking 
none of the thread related command work. 

Thanks for your help.

Thanks
Ajay

 
> On Thu, Mar 17, 2005 at 03:59:12PM -0800, Ajay Patel wrote:
> > Daniel,
> > 
> > I checked out gdb from CVS head and applied this
> > "http://sourceware.org/ml/gdb-patches/2004-12/msg00240.html"
> > patch.
> > 
> > But still no thread commands.
> 
> I'm afraid you'll need the second patch referenced in that message; I
> haven't submitted it to gdb-patches yet - thought I had.  I will be
> doing that after this patch is approved, or you can try the Debian
> source package which includes the patch.
> 
> 
> -- 
> Daniel Jacobowitz
> CodeSourcery, LLC
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: unable to debug statically linked program with linux threads
  2005-03-17 22:07 Ajay Patel
  2005-03-17 22:13 ` Daniel Jacobowitz
@ 2005-03-17 22:19 ` Eric Desjardins
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Desjardins @ 2005-03-17 22:19 UTC (permalink / raw)
  To: gdb

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;
> }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: unable to debug statically linked program with linux threads
  2005-03-17 22:07 Ajay Patel
@ 2005-03-17 22:13 ` Daniel Jacobowitz
  2005-03-17 22:19 ` Eric Desjardins
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2005-03-17 22:13 UTC (permalink / raw)
  To: Ajay Patel; +Cc: gdb

On Thu, Mar 17, 2005 at 02:06:57PM -0800, 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?

There's a patch in the gdb-patches archive for this.  I'll go ping
it... it applies to CVS HEAD GDB.


-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 6+ messages in thread

* unable to debug statically linked program with linux threads
@ 2005-03-17 22:07 Ajay Patel
  2005-03-17 22:13 ` Daniel Jacobowitz
  2005-03-17 22:19 ` Eric Desjardins
  0 siblings, 2 replies; 6+ messages in thread
From: Ajay Patel @ 2005-03-17 22:07 UTC (permalink / raw)
  To: gdb


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;
}




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-03-18 23:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17 23:59 unable to debug statically linked program with linux threads Ajay Patel
2005-03-18  2:47 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2005-03-18 23:53 Ajay Patel
2005-03-17 22:07 Ajay Patel
2005-03-17 22:13 ` Daniel Jacobowitz
2005-03-17 22:19 ` Eric Desjardins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).