This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Remote debugging using gdbserver with threads on ARM linux: No backtrace


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





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]