From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18074 invoked by alias); 11 Nov 2010 09:18:39 -0000 Received: (qmail 18061 invoked by uid 22791); 11 Nov 2010 09:18:37 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_XF,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-wy0-f169.google.com (HELO mail-wy0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Nov 2010 09:18:32 +0000 Received: by wyf23 with SMTP id 23so1973393wyf.0 for ; Thu, 11 Nov 2010 01:18:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.27.9 with SMTP id d9mr2118718wea.44.1289467109952; Thu, 11 Nov 2010 01:18:29 -0800 (PST) Received: by 10.217.0.135 with HTTP; Thu, 11 Nov 2010 01:18:29 -0800 (PST) Date: Thu, 11 Nov 2010 09:18:00 -0000 Message-ID: Subject: cross compile gdb-6.8 for xtensa From: himanshu sardana To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00047.txt.bz2 I am trying to remote debug an single threaded application main_app.c: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #include int main() { =A0 =A0int i=3D0; =A0 =A0i++; =A0 =A0printf("main_app: i=3D%d\n", i); =A0 =A0i++; =A0 =A0printf("main_app: i=3D%d\n", i); =A0 =A0i++; =A0 =A0printf("main_app: i=3D%d\n", i); =A0 =A0return 0; } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D CC=3D/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-lin= ux-gcc CFLAGS=3D"-g -I/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/include/li= bxml2" LDFLAGS=3D"-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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D /*configure and make gdb*/ gdb-6.8> ./configure --target=3Dxtensa_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=3Di686-pc-linux-gnu --host=3Dxtensa_c1lx2-linux --target=3Dxtensa_c1lx2-linux --includedir=3D/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/include =A0--oldincludedir=3D/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/incl= ude CC=3D/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-lin= ux-gcc CFLAGS=3D"-I/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/include/libxm= l2" CXX=3D/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-li= nux-g++ CPPFLAGS=3D"-I/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/include/lib= xml2" LDFLAGS=3D"-L/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/lib" STRIP=3D/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-= linux-strip AR=3D/opt/buildroot/build_xtensa_c1lx2/staging_dir/usr/bin/xtensa_c1lx2-lin= ux-ar RANLIB=3D/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*/ =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D 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. =A0Type "show copying" and "show warranty" for details. This GDB was configured as "--host=3Di686-pc-linux-gnu --target=3Dxtensa_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 =3D b Child terminated with signal =3D 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