Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Maxim Grigoriev <maxim@tensilica.com>
To: himanshu sardana <er.sardana@gmail.com>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>,
	Piet Delaney	<piet.delaney@tensilica.com>,
	Marc Gauthier <marc@tensilica.com>
Subject: Re: cross compile gdb-6.8 for xtensa
Date: Thu, 11 Nov 2010 16:21:00 -0000	[thread overview]
Message-ID: <4CDC17FD.9060702@tensilica.com> (raw)
In-Reply-To: <AANLkTi=95nwyR4T8y-VyfFMjshDc9JGfWv0kP0h8vrnB@mail.gmail.com>

Hello Himanshu,

I will look into it and then get back to you.

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<stdio.h>
>
> 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<http://gnu.org/licenses/gpl.html>
> 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
>    


  reply	other threads:[~2010-11-11 16:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11  9:18 himanshu sardana
2010-11-11 16:21 ` Maxim Grigoriev [this message]
2010-11-11 23:16 ` Maxim Grigoriev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CDC17FD.9060702@tensilica.com \
    --to=maxim@tensilica.com \
    --cc=er.sardana@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=marc@tensilica.com \
    --cc=piet.delaney@tensilica.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox