public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Remote debugging using gdbserver with threads on ARM linux: No backtrace
@ 2004-10-12 15:56 philippe.vivarelli
  2004-10-12 19:48 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: philippe.vivarelli @ 2004-10-12 15:56 UTC (permalink / raw)
  To: gdb

Hi,

The backtrace feature doesn't work using gdbserver on ARM linux to debbug
threaded applications.

I browse several mailing lists, I found this issue occurs time to times.
In those mailing list I was not able to find a solution which works for me.

Here is my setting and configuration:

Target side:
ARM920T
Kernel 2.4.19-rmk4
GDB/GDBserver 6.1-debian

Host side:
Intel(R) Pentium(R) 4 CPU 1500MHz
Kernel 2.4.20-8
GNU gdb 6.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=arm-linux-gnu".



The .gdbinit file configured as follow:
hand SIG32 nostop
set complaints 1
set confirm 1
set solib-absolute-prefix /dev/null
set solib-search-path /usr/local/arm-tools/arm-linux/lib/

dir /home/philippe/gdb-6.1/mmalloc
dir /home/philippe/gdb-6.1/libiberty
dir /home/philippe/gdb-6.1/bfd
dir .
set prompt (top-gdb)



===========================================================================
Target side commands and display:
===========================================================================
# gdbserver 192.168.32.144:8000 testGdbArm
Process testGdbArm created; pid = 6453
Listening on port 8000
Remote debugging from host 192.168.32.51
I'm the thread 0 and I'm a good dog
I'm the thread 1 and I'm a good dog
I'm the thread 2 and I'm a good dog
I'm the thread 3 and I'm a good dog
I'm the thread 4 and I have a bad temper

===========================================================================
Host side commands and display:
===========================================================================
(top-gdb)file testGdbArm
Reading symbols from testGdbArm...done.
(top-gdb)target remote 192.168.32.144:8000
Remote debugging using 192.168.32.144:8000
0x40000a70 in ?? ()

(top-gdb)b 34
Breakpoint 1 at 0x8544: file testGdb.c, line 34.
(top-gdb)c
Continuing.

Program received signal SIG32, Real-time event 32.

Program received signal SIG32, Real-time event 32.

Program received signal SIG32, Real-time event 32.

Program received signal SIG32, Real-time event 32.

Program received signal SIG32, Real-time event 32.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x40024f9c in ?? ()
(top-gdb)bt
#0  0x40024f9c in ?? ()
(top-gdb)

===========================================================================
===========================================================================
Command line used to build the program below.
arm-linux-gcc testGdb.c -o testGdbArm -O0 -Wall -lpthread -g
===========================================================================

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

void * Thread1( void * p )
{
  int myTid = *((int *)p);
  int i     = 0;
  struct timespec ts;

  printf ("I'm the thread %d and I'm a good dog\n", myTid);

  ts.tv_sec = 10 + myTid;
  ts.tv_nsec = 0;

  while (1)
  {
      nanosleep  (&ts, NULL);
      printf ("<T%d,%d> ", myTid, i++);
  }
  return NULL;
}

void * Thread2( void * p )
{
  char * ptr = 0;
  struct timespec ts = {20, 0};


  printf ("I'm the thread %d and I have a bad temper\n", *((int *)p));
  nanosleep (&ts, NULL);
  /* breakpoint placed here */
  return NULL;
}
This GDB

int main( int argc, char ** argv )
{
  pthread_t pid[5];
  int       threadNr[5];
  int       i;

  for (i = 0; i < 4; i++)
  {
    threadNr[i] = i;
    pthread_create( &pid[i], NULL, Thread1, &(threadNr[i]));
  }

  threadNr[i] = i;
  pthread_create( &pid[i], NULL, Thread2, &(threadNr[i]));

  pthread_join( pid[0], NULL );
  pthread_join( pid[1], NULL );
  pthread_join( pid[2], NULL );
  pthread_join( pid[3], NULL );
  pthread_join( pid[4], NULL );
  return 0;
}




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

* Re: Remote debugging using gdbserver with threads on ARM linux: No backtrace
  2004-10-12 15:56 Remote debugging using gdbserver with threads on ARM linux: No backtrace philippe.vivarelli
@ 2004-10-12 19:48 ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2004-10-12 19:48 UTC (permalink / raw)
  To: philippe.vivarelli; +Cc: gdb

On Tue, Oct 12, 2004 at 09:34:10AM +0200, philippe.vivarelli@mindspeed.com wrote:
> The .gdbinit file configured as follow:
> hand SIG32 nostop
> set complaints 1
> set confirm 1
> set solib-absolute-prefix /dev/null
> set solib-search-path /usr/local/arm-tools/arm-linux/lib/

No, that's wrong.  Remove the "hand SIG32 nostop".  Remove the
solib-search-path.  Set solib-absolute-prefix to
/usr/local/arm-tools/arm-linux.  See if that works better.
Are you sure the libraries in that directory are both unstripped and
otherwise exactly the same as the ones on your target?

If you don't use solib-absolute-prefix, we may not find the dynamic
linker, so thread breakpoints will not be set properly.

-- 
Daniel Jacobowitz

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

* Re: Remote debugging using gdbserver with threads on ARM linux: No backtrace
  2004-10-13  0:31 philippe.vivarelli
@ 2004-10-13  4:57 ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2004-10-13  4:57 UTC (permalink / raw)
  To: philippe.vivarelli; +Cc: gdb

On Tue, Oct 12, 2004 at 05:55:45PM +0200, philippe.vivarelli@mindspeed.com wrote:
> The librairies in /usr/local/arm-tools/arm-linux/lib/ are comming with the
> arm-linux toolchain for ARM  (cross compiler arm-linux-gcc 3.3.1)
> The librairies on the target are comming from the Debian distribution for
> ARM (gcc 3.3.4).

Don't do that then.

> What do you recommend ?
> Make a copy of the libraries comming from the Debian distribution onto the
> host, and set the solib-absolute-prefix to the path of the copy ?

Yes, probably.

-- 
Daniel Jacobowitz

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

* Re: Remote debugging using gdbserver with threads on ARM linux: No backtrace
@ 2004-10-13  0:31 philippe.vivarelli
  2004-10-13  4:57 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: philippe.vivarelli @ 2004-10-13  0:31 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb


Hi,

Thank you for this first quick answer.

As suggested I removed the solid-search-path and the hand SIG32 nostop
lines from my .gdbinit file.
But it does the same (except I need to to enter "c" several time to
continue on signal 32).

The librairies in /usr/local/arm-tools/arm-linux/lib/ are comming with the
arm-linux toolchain for ARM  (cross compiler arm-linux-gcc 3.3.1)
The librairies on the target are comming from the Debian distribution for
ARM (gcc 3.3.4).

What do you recommend ?
Make a copy of the libraries comming from the Debian distribution onto the
host, and set the solib-absolute-prefix to the path of the copy ?

Thanks

Philippe Vivarelli




|---------+---------------------------->
|         |           Daniel Jacobowitz|
|         |           <drow@false.org> |
|         |                            |
|         |           12/10/2004 15:42 |
|         |                            |
|---------+---------------------------->
  >------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                              |
  |       To:       philippe.vivarelli@mindspeed.com                                                                             |
  |       cc:       gdb@sources.redhat.com                                                                                       |
  |       Subject:  Re: Remote debugging using gdbserver with threads on ARM linux: No backtrace                                 |
  >------------------------------------------------------------------------------------------------------------------------------|




On Tue, Oct 12, 2004 at 09:34:10AM +0200, philippe.vivarelli@mindspeed.com
wrote:
> The .gdbinit file configured as follow:
> hand SIG32 nostop
> set complaints 1
> set confirm 1
> set solib-absolute-prefix /dev/null
> set solib-search-path /usr/local/arm-tools/arm-linux/lib/

No, that's wrong.  Remove the "hand SIG32 nostop".  Remove the
solib-search-path.  Set solib-absolute-prefix to
/usr/local/arm-tools/arm-linux.  See if that works better.
Are you sure the libraries in that directory are both unstripped and
otherwise exactly the same as the ones on your target?

If you don't use solib-absolute-prefix, we may not find the dynamic
linker, so thread breakpoints will not be set properly.

--
Daniel Jacobowitz





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

end of thread, other threads:[~2004-10-12 22:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-12 15:56 Remote debugging using gdbserver with threads on ARM linux: No backtrace philippe.vivarelli
2004-10-12 19:48 ` Daniel Jacobowitz
2004-10-13  0:31 philippe.vivarelli
2004-10-13  4:57 ` 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).