From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12123 invoked by alias); 12 Oct 2004 07:34:17 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 12062 invoked from network); 12 Oct 2004 07:34:15 -0000 Received: from unknown (HELO mail53-haw-R.bigfish.com) (12.129.199.61) by sourceware.org with SMTP; 12 Oct 2004 07:34:15 -0000 Received: from mail53-haw.bigfish.com (localhost.localdomain [127.0.0.1]) by mail53-haw-R.bigfish.com (Postfix) with ESMTP id 1D2BC319ACC for ; Tue, 12 Oct 2004 07:34:15 +0000 (UCT) X-BigFish: VPC Received: by mail53-haw.bigfish.com (MessageSwitch) id 1097566454846133_2630; Tue, 12 Oct 2004 07:34:14 +0000 (UCT) Received: from mspdsmtp2.mindspeed.com (mspdsmtp2.mindspeed.com [199.33.64.93]) by mail53-haw.bigfish.com (Postfix) with ESMTP id C02A73194B9 for ; Tue, 12 Oct 2004 07:34:14 +0000 (UCT) Received: from npblnh1.la.mindspeed.com (npblnh1.la.mindspeed.com [10.231.23.16]) by mspdsmtp2.mindspeed.com (8.11.7p1+Sun/8.11.7) with ESMTP id i9C6h7A23846 for ; Mon, 11 Oct 2004 23:43:07 -0700 (PDT) Received: from sophiam1.nice.mindspeed.com ([10.1.124.21]) by npblnh1.la.mindspeed.com (Lotus Domino Release 5.0.12) with ESMTP id 2004101200341256:758156 ; Tue, 12 Oct 2004 00:34:12 -0700 Subject: Remote debugging using gdbserver with threads on ARM linux: No backtrace To: gdb@sources.redhat.com Message-ID: From: philippe.vivarelli@mindspeed.com Date: Tue, 12 Oct 2004 15:56:00 -0000 MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-SW-Source: 2004-10/txt/msg00294.txt.bz2 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 #include #include #include #include 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 (" ", 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; }