From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31721 invoked by alias); 11 Nov 2010 23:16:33 -0000 Received: (qmail 31711 invoked by uid 22791); 11 Nov 2010 23:16:32 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=BAYES_00,TW_XF,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mailgw.tensilica.com (HELO mailgw.tensilica.com) (65.119.96.134) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Nov 2010 23:16:26 +0000 Received: from localhost (unknown [127.0.0.1]) by mailgw.tensilica.com (Postfix) with ESMTP id 1ECEB1160D99; Thu, 11 Nov 2010 23:16:25 +0000 (UTC) Received: from mailgw.tensilica.com ([127.0.0.1]) by localhost (mailgw.tensilica.com [127.0.0.1]) (amavisd-maia, port 10024) with ESMTP id 25582-03; Thu, 11 Nov 2010 15:16:24 -0800 (PST) Received: from mail.tensilica.com (mail.tensilica.com [192.168.15.138]) by mailgw.tensilica.com (Postfix) with ESMTP id 85FBC1160D98; Thu, 11 Nov 2010 15:16:24 -0800 (PST) Received: from [192.168.11.68] (192.168.11.68) by mail.tensilica.com (192.168.15.138) with Microsoft SMTP Server id 8.2.254.0; Thu, 11 Nov 2010 15:16:24 -0800 Message-ID: <4CDC7948.3070306@tensilica.com> Date: Thu, 11 Nov 2010 23:16:00 -0000 From: Maxim Grigoriev User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc12 Lightning/1.0b2pre Thunderbird/3.0.4 MIME-Version: 1.0 To: himanshu sardana CC: "gdb@sourceware.org" , Marc Gauthier , Piet Delaney Subject: Re: cross compile gdb-6.8 for xtensa References: In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00055.txt.bz2 Hello Himanshu, I am guessing that you did not build host gdb and target gdbserver properly. Xtensa is configurable, that's why source overlays should be applied to gdb/gdbserver before you build these tools. Buildroot knows how to do it for you automatically. So if you build gdb and gdbserver from Buildroot it will work properly. You seem to be using tools, which were built for a default Xtensa configuration. If you don't know how to use Xtensa Buildroot, Piet - our Linux expert - will send you an instruction (off list). Thanks, -- Maxim On 11/11/2010 01:18 AM, himanshu sardana wrote: > I am trying to remote debug an single threaded application main_app.c: > > ================================================================= > #include > > int main() > { > int i=0; > > i++; > printf("main_app: i=%d\n", i); > > i++; > printf("main_app: i=%d\n", i); > > i++; > printf("main_app: i=%d\n", i); > > return 0; > } > =================================================================== > > My linux machine is: > Linux ankit 2.6.18-92.el5 #1 SMP Tue Jun 10 18:49:47 EDT 2008 i686 > i686 i386 GNU/Linux > > > STEP 1 > ----------- > I compiled main_app.c for xtensa on linux machine: > > =================================================================== > CC=/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-linux-gcc > CFLAGS="-g -I/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/include/libxml2" > LDFLAGS="-L/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/lib" > > $CC $CFLAGS -c -o main_app.o main_app.c $LDFLAGS > $CC $CFLAGS -o main_app main_app.o $LDFLAGS > =================================================================== > > > STEP 2 > ----------- > I am using gdbserver on the target machine (xtensa_c1lx2-linux) and > gdb on the host machine (i686-pc-linux-gnu). > > Compilation steps for gdb-6.8 > > ======================================================================== > /*configure and make gdb*/ > gdb-6.8> ./configure --target=xtensa_c1lx2-linux > > gdb-6.8> make > > gdb-6.8> cd gdb/ > > gdb-6.8> ls -ltrh > > /*Got gdb binary here*/ > > > /*Now configure and make gdbserver*/ > gdb-6.8> cd gdbserver/ > > gdb-6.8> ./configure --build=i686-pc-linux-gnu > --host=xtensa_c1lx2-linux --target=xtensa_c1lx2-linux > --includedir=/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/include > --oldincludedir=/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/include > CC=/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-linux-gcc > CFLAGS="-I/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/include/libxml2" > CXX=/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-linux-g++ > CPPFLAGS="-I/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/include/libxml2" > LDFLAGS="-L/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/lib" > STRIP=/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-linux-strip > AR=/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-linux-ar > RANLIB=/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-linux-ranlib > > gdb-6.8> make > > gdb-6.8> ls -ltrh > > /*Got gdbserver binary here*/ > ======================================================================== > > > STEP 3 > ------------ > Transfer gdbserver and main_app on target machine and then run gdbserver > > target> ./gdbserver 192.168.202.143:2108 ./main_app > Process ./main_app created; pid = 340 > Listening on port 2108 > Remote debugging from host 192.168.202.184 > > > STEP 4 > ----------- > > linux> /opt/himanshu/gdb-6.8/gdb/gdb ./main_app > GNU gdb 6.8 > Copyright (C) 2008 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. Type "show copying" > and "show warranty" for details. > This GDB was configured as "--host=i686-pc-linux-gnu > --target=xtensa_c1lx2-linux"... > (gdb) target remote 192.168.202.143:2108 > Remote debugging using 192.168.202.143:2108 > [New Thread 336] > 0xfc140020 in ?? () > (gdb) > > > After these steps if I simply 'continue' the program, the program > executes fine and then terminates properly. But, If I put a breakpoint > and then continue execution I get the following problem: > > ------------------------------------------------------------------------------------------------------ > (gdb) b main > Breakpoint 1 at 0x4002b9: file main_app.c, line 5. > (gdb) c > Continuing. > > Program received signal SIGSEGV, Segmentation fault. > 0xc7024000 in ?? () > (gdb) c > Continuing. > > Program terminated with signal SIGSEGV, Segmentation fault. > The program no longer exists. > (gdb) q > ------------------------------------------------------------------------------------------------------- > > > And at gdbserver side: > ------------------------------------------------------------------------------------------------------- > Child terminated with signal = b > > Child terminated with signal = 0xb (SIGSEGV) > GDBserver exiting > ------------------------------------------------------------------------------------------------------- > > What may be the problem due to which I get the above error? > Am i rightly configuring it in order to cross-compile it for xtensa? > > Any suggestions will be highly appreciable. > > Thanks, > Himanshu >