public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [NEED HELP] Problem to multithread remote debugging with GDBserver
@ 2005-10-27 10:27 Peter Choi
  2005-10-27 12:47 ` Daniel Jacobowitz
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Choi @ 2005-10-27 10:27 UTC (permalink / raw)
  To: gdb

Hi,

  I've heard that GDB 5.3 onwards has supported remote
debugging multiple thread programs, but I still fail
to do so. I wonder what I have done wrong.

  I work with a x86 host and a x86 target, both with
linux kernel 2.4.22 (FC1 actually). I worked on a test
program below, linked with glibc:

    #include <pthread.h>
    #include <stdio.h>
    #define NUM_THREADS 5

    void *thread_function(void *arg)
    {
       printf("Hello World from %d!\n", arg);
       sleep(10);
       pthread_exit(NULL);
    }

    int main(int argc, char *argv[])
    {
       pthread_t threads[NUM_THREADS];
       int i;

       for (i = 0; i < NUM_THREADS; i++)
         pthread_create(&threads[i], NULL,
thread_function, (void *)i);
      
       for (i = 0; i < NUM_THREADS; i++)
          pthread_join(threads[i], NULL);

       return 0;
    }

First we set everything up and connect:

    (gdb) set solib-search-path
/usr/local/cris/r59/cris-axis-linux-gnu/lib/
    (gdb) set solib-absolute-prefix /dev/null/
    (gdb) set remotetimeout 60
    (gdb) target remote 10.84.130.10:2222
    Remote debugging using 10.84.130.10:2222
    0x35557608 in ?? ()

Next we set a breakpoint in main after all threads
have been created:

    (gdb) break 20
    Breakpoint 1 at 0x80568: file hello.c, line 20.

Now send the program on its way:

    (gdb) c
    Continuing.
  

  On the host computer side, I fail to see other
threads,
other than the main thread. As a result, I fail to set
breakpoint on the other threads.

  I have downloaded source code of GDB6.3 and compiled
my own GDB & GDBSERVER. But it still can't see the
other threads on the host side.


  SO, I wonder what I have done wrong. What option do
I need to specify to compile GDB/GDBSERVER in order to
support multithread remote debugging ?????


  Pls HELP. Thank you for  your attention.

Regards.
Peter Choi



		


	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com


	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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

* Re: [NEED HELP] Problem to multithread remote debugging with GDBserver
  2005-10-27 10:27 [NEED HELP] Problem to multithread remote debugging with GDBserver Peter Choi
@ 2005-10-27 12:47 ` Daniel Jacobowitz
  2005-10-27 13:25   ` David Lecomber
                     ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Daniel Jacobowitz @ 2005-10-27 12:47 UTC (permalink / raw)
  To: Peter Choi; +Cc: gdb

On Thu, Oct 27, 2005 at 03:26:55AM -0700, Peter Choi wrote:
> Hi,
> 
>   I've heard that GDB 5.3 onwards has supported remote
> debugging multiple thread programs, but I still fail
> to do so. I wonder what I have done wrong.

> First we set everything up and connect:
> 
>     (gdb) set solib-search-path
> /usr/local/cris/r59/cris-axis-linux-gnu/lib/
>     (gdb) set solib-absolute-prefix /dev/null/

First of all don't do that.  Use solib-absolute-prefix and make a host
environment that looks like the target.  It's much more likely to work.

Second, you didn't mention until here that your target was cris.  It
just takes a couple of lines to implement multithread support in
gdbserver, but they have to be done for each port; I don't know if
anyone has done that for cris yet.  In fact gdbserver didn't support
cris until after the release of 6.3, so you should be using CVS.


-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

* Re: [NEED HELP] Problem to multithread remote debugging with GDBserver
  2005-10-27 12:47 ` Daniel Jacobowitz
@ 2005-10-27 13:25   ` David Lecomber
  2005-10-27 13:50     ` Daniel Jacobowitz
  2005-10-28  1:55   ` Peter Choi
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: David Lecomber @ 2005-10-27 13:25 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Peter Choi, gdb

On Thu, 2005-10-27 at 08:47 -0400, Daniel Jacobowitz wrote:
> On Thu, Oct 27, 2005 at 03:26:55AM -0700, Peter Choi wrote:
> > Hi,
> > 
> >   I've heard that GDB 5.3 onwards has supported remote
> > debugging multiple thread programs, but I still fail
> > to do so. I wonder what I have done wrong.
> 
> > First we set everything up and connect:
> > 
> >     (gdb) set solib-search-path
> > /usr/local/cris/r59/cris-axis-linux-gnu/lib/
> >     (gdb) set solib-absolute-prefix /dev/null/
> 
> First of all don't do that.  Use solib-absolute-prefix and make a host
> environment that looks like the target.  It's much more likely to work.
> 
> Second, you didn't mention until here that your target was cris.  It
> just takes a couple of lines to implement multithread support in
> gdbserver, but they have to be done for each port; I don't know if
> anyone has done that for cris yet.  In fact gdbserver didn't support
> cris until after the release of 6.3, so you should be using CVS.

Hi Daniel

A much asked question seems to be how do you implement multithread
support in gdbserver..   Where would you go about finding documentation
for this, my googling has only so far come up with an email from you of
about two years or so ago seeing we need some docs!  Is there a True
Definitive Guide?

Cheers
David



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

* Re: [NEED HELP] Problem to multithread remote debugging with GDBserver
  2005-10-27 13:25   ` David Lecomber
@ 2005-10-27 13:50     ` Daniel Jacobowitz
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Jacobowitz @ 2005-10-27 13:50 UTC (permalink / raw)
  To: David Lecomber; +Cc: Peter Choi, gdb

On Thu, Oct 27, 2005 at 02:44:52PM +0100, David Lecomber wrote:
> Hi Daniel
> 
> A much asked question seems to be how do you implement multithread
> support in gdbserver..   Where would you go about finding documentation
> for this, my googling has only so far come up with an email from you of
> about two years or so ago seeing we need some docs!  Is there a True
> Definitive Guide?

It's not really a frequently asked question - it generally only gets
asked once per target :-)  The frequently asked question is how to make
it work.

There are no docs, really - but it's just a matter of adding the
missing methods to the linux-<foo>-low.c file and most of them have it
now.  I believe get_pc and set_pc are the most important ones.  Check
one where it works to see the rest, or look through the changelog.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

* Re: [NEED HELP] Problem to multithread remote debugging with GDBserver
  2005-10-27 12:47 ` Daniel Jacobowitz
  2005-10-27 13:25   ` David Lecomber
@ 2005-10-28  1:55   ` Peter Choi
  2005-10-28  3:05     ` Daniel Jacobowitz
  2005-10-28  4:50   ` Peter Choi
  2005-10-28  4:58   ` Peter Choi
  3 siblings, 1 reply; 11+ messages in thread
From: Peter Choi @ 2005-10-28  1:55 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

Hi Daniel,

  Yes, the path is incorrect.

  Actually the environment (library path) in both my
host computer and my target computer are identical.
Both are of FC1. Do I still need to set up the
solib-absolute-prefix & solib-search-path???

  In fact, I have already tried:
1. set solib-absolute-prefix=/dev/null &
solib-search-path=/lib/tls/:/lib,
and 
2. leave both empty,

  but in both cases, it seems not working : I still
can't see other threads on the host side.

1.  I wonder does the version kernel matter on this???
I'm using 2.4.22 (from FC1), do I need to update the
kernel???

2. If I compile my own GDB & GDBserver from 6.3 source
code, do I need to specify any option during
compilation, to order to enable multithread support on
remote debugging???? 

  Thank you for your help.

Regards.
Peter Choi


--- Daniel Jacobowitz <drow@false.org> wrote:

> On Thu, Oct 27, 2005 at 03:26:55AM -0700, Peter Choi
> wrote:
> > Hi,
> > 
> >   I've heard that GDB 5.3 onwards has supported
> remote
> > debugging multiple thread programs, but I still
> fail
> > to do so. I wonder what I have done wrong.
> 
> > First we set everything up and connect:
> > 
> >     (gdb) set solib-search-path
> > /usr/local/cris/r59/cris-axis-linux-gnu/lib/
> >     (gdb) set solib-absolute-prefix /dev/null/
> 
> First of all don't do that.  Use
> solib-absolute-prefix and make a host
> environment that looks like the target.  It's much
> more likely to work.
> 
> Second, you didn't mention until here that your
> target was cris.  It
> just takes a couple of lines to implement
> multithread support in
> gdbserver, but they have to be done for each port; I
> don't know if
> anyone has done that for cris yet.  In fact
> gdbserver didn't support
> cris until after the release of 6.3, so you should
> be using CVS.
> 
> 
> -- 
> Daniel Jacobowitz
> CodeSourcery, LLC
> 



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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

* Re: [NEED HELP] Problem to multithread remote debugging with GDBserver
  2005-10-28  1:55   ` Peter Choi
@ 2005-10-28  3:05     ` Daniel Jacobowitz
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Jacobowitz @ 2005-10-28  3:05 UTC (permalink / raw)
  To: Peter Choi; +Cc: gdb

On Thu, Oct 27, 2005 at 06:55:46PM -0700, Peter Choi wrote:
> Hi Daniel,
> 
>   Yes, the path is incorrect.
> 
>   Actually the environment (library path) in both my
> host computer and my target computer are identical.
> Both are of FC1. Do I still need to set up the
> solib-absolute-prefix & solib-search-path???

Huh?  Your target is the system you're debugging.  From below, it shows
that you are targeting a CRIS target.  That can't be running Red Hat
FC1!

I'm confused about what you are really doing.

> 2. If I compile my own GDB & GDBserver from 6.3 source
> code, do I need to specify any option during
> compilation, to order to enable multithread support on
> remote debugging???? 

No.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

* Re: [NEED HELP] Problem to multithread remote debugging with GDBserver
  2005-10-27 12:47 ` Daniel Jacobowitz
  2005-10-27 13:25   ` David Lecomber
  2005-10-28  1:55   ` Peter Choi
@ 2005-10-28  4:50   ` Peter Choi
  2005-10-28  4:58   ` Peter Choi
  3 siblings, 0 replies; 11+ messages in thread
From: Peter Choi @ 2005-10-28  4:50 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

Hi,

  How to set solib-absolute-prefix & solib-search-path
then??? in case the library path on both sides (host &
target) are identical???


Regards.
Peter Choi


--- Daniel Jacobowitz <drow@false.org> wrote:

> On Thu, Oct 27, 2005 at 03:26:55AM -0700, Peter Choi
> wrote:
> > Hi,
> > 
> >   I've heard that GDB 5.3 onwards has supported
> remote
> > debugging multiple thread programs, but I still
> fail
> > to do so. I wonder what I have done wrong.
> 
> > First we set everything up and connect:
> > 

> 
> First of all don't do that.  Use
> solib-absolute-prefix and make a host
> environment that looks like the target.  It's much
> more likely to work.
> 
> Second, you didn't mention until here that your
> target was cris.  It
> just takes a couple of lines to implement
> multithread support in
> gdbserver, but they have to be done for each port; I
> don't know if
> anyone has done that for cris yet.  In fact
> gdbserver didn't support
> cris until after the release of 6.3, so you should
> be using CVS.
> 
> 
> -- 
> Daniel Jacobowitz
> CodeSourcery, LLC
> 



	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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

* Re: [NEED HELP] Problem to multithread remote debugging with GDBserver
  2005-10-27 12:47 ` Daniel Jacobowitz
                     ` (2 preceding siblings ...)
  2005-10-28  4:50   ` Peter Choi
@ 2005-10-28  4:58   ` Peter Choi
  2005-10-28 12:47     ` Daniel Jacobowitz
  3 siblings, 1 reply; 11+ messages in thread
From: Peter Choi @ 2005-10-28  4:58 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

Hi,

  Do my version of libpthread and libthread_db need to
be matched??? I'm now using libpthread-0.60 and
libthread_db-1.0.


Regards.
Peter Choi


--- Daniel Jacobowitz <drow@false.org> wrote:

> On Thu, Oct 27, 2005 at 03:26:55AM -0700, Peter Choi
> wrote:
> > Hi,
> > 
> >   I've heard that GDB 5.3 onwards has supported
> remote
> > debugging multiple thread programs, but I still
> fail
> > to do so. I wonder what I have done wrong.
> 
> > First we set everything up and connect:
> > 
> >     (gdb) set solib-search-path
> > /usr/local/cris/r59/cris-axis-linux-gnu/lib/
> >     (gdb) set solib-absolute-prefix /dev/null/
> 
> First of all don't do that.  Use
> solib-absolute-prefix and make a host
> environment that looks like the target.  It's much
> more likely to work.
> 
> Second, you didn't mention until here that your
> target was cris.  It
> just takes a couple of lines to implement
> multithread support in
> gdbserver, but they have to be done for each port; I
> don't know if
> anyone has done that for cris yet.  In fact
> gdbserver didn't support
> cris until after the release of 6.3, so you should
> be using CVS.
> 
> 
> -- 
> Daniel Jacobowitz
> CodeSourcery, LLC
> 



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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

* Re: [NEED HELP] Problem to multithread remote debugging with GDBserver
  2005-10-28  4:58   ` Peter Choi
@ 2005-10-28 12:47     ` Daniel Jacobowitz
  2005-10-31  1:51       ` Peter Choi
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2005-10-28 12:47 UTC (permalink / raw)
  To: Peter Choi; +Cc: gdb

On Thu, Oct 27, 2005 at 09:58:24PM -0700, Peter Choi wrote:
> Hi,
> 
>   Do my version of libpthread and libthread_db need to
> be matched??? I'm now using libpthread-0.60 and
> libthread_db-1.0.

They need to come from the same source, which those probably do.

You didn't answer my question about what you're really debugging; it
can't be both cris and FC1.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

* Re: [NEED HELP] Problem to multithread remote debugging with GDBserver
  2005-10-28 12:47     ` Daniel Jacobowitz
@ 2005-10-31  1:51       ` Peter Choi
  2005-10-31  4:20         ` Daniel Jacobowitz
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Choi @ 2005-10-31  1:51 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb


Hi,

  I'm not debugging Cris. I'm debugging an x86 machine
(TARGET) with x86 PC as the host. (I'm sorry. The
first email contains a mistake in the
"solib-absolute-prefix" & "solib-search-path"
setting).

 Both are installed with FC1, and the library path are
identical in both machines. How should the I set up 
"solib-absolute-prefix" & "solib-search-path" ????

  

Regards.
Peter Choi

--- Daniel Jacobowitz <drow@false.org> wrote:

> On Thu, Oct 27, 2005 at 09:58:24PM -0700, Peter Choi
> wrote:
> > Hi,
> > 
> >   Do my version of libpthread and libthread_db
> need to
> > be matched??? I'm now using libpthread-0.60 and
> > libthread_db-1.0.
> 
> They need to come from the same source, which those
> probably do.
> 
> You didn't answer my question about what you're
> really debugging; it
> can't be both cris and FC1.
> 
> -- 
> Daniel Jacobowitz
> CodeSourcery, LLC
> 



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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

* Re: [NEED HELP] Problem to multithread remote debugging with GDBserver
  2005-10-31  1:51       ` Peter Choi
@ 2005-10-31  4:20         ` Daniel Jacobowitz
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Jacobowitz @ 2005-10-31  4:20 UTC (permalink / raw)
  To: Peter Choi; +Cc: gdb

On Sun, Oct 30, 2005 at 05:51:04PM -0800, Peter Choi wrote:
> 
> Hi,
> 
>   I'm not debugging Cris. I'm debugging an x86 machine
> (TARGET) with x86 PC as the host. (I'm sorry. The
> first email contains a mistake in the
> "solib-absolute-prefix" & "solib-search-path"
> setting).
> 
>  Both are installed with FC1, and the library path are
> identical in both machines. How should the I set up 
> "solib-absolute-prefix" & "solib-search-path" ????

Then you should not need to set them at all; leave them alone.


-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

end of thread, other threads:[~2005-10-31  4:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-27 10:27 [NEED HELP] Problem to multithread remote debugging with GDBserver Peter Choi
2005-10-27 12:47 ` Daniel Jacobowitz
2005-10-27 13:25   ` David Lecomber
2005-10-27 13:50     ` Daniel Jacobowitz
2005-10-28  1:55   ` Peter Choi
2005-10-28  3:05     ` Daniel Jacobowitz
2005-10-28  4:50   ` Peter Choi
2005-10-28  4:58   ` Peter Choi
2005-10-28 12:47     ` Daniel Jacobowitz
2005-10-31  1:51       ` Peter Choi
2005-10-31  4:20         ` Daniel Jacobowitz

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).