* cross compile gdb-6.8 for xtensa
@ 2010-11-11 9:18 himanshu sardana
2010-11-11 16:21 ` Maxim Grigoriev
2010-11-11 23:16 ` Maxim Grigoriev
0 siblings, 2 replies; 3+ messages in thread
From: himanshu sardana @ 2010-11-11 9:18 UTC (permalink / raw)
To: gdb
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: cross compile gdb-6.8 for xtensa
2010-11-11 9:18 cross compile gdb-6.8 for xtensa himanshu sardana
@ 2010-11-11 16:21 ` Maxim Grigoriev
2010-11-11 23:16 ` Maxim Grigoriev
1 sibling, 0 replies; 3+ messages in thread
From: Maxim Grigoriev @ 2010-11-11 16:21 UTC (permalink / raw)
To: himanshu sardana; +Cc: gdb, Piet Delaney, Marc Gauthier
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: cross compile gdb-6.8 for xtensa
2010-11-11 9:18 cross compile gdb-6.8 for xtensa himanshu sardana
2010-11-11 16:21 ` Maxim Grigoriev
@ 2010-11-11 23:16 ` Maxim Grigoriev
1 sibling, 0 replies; 3+ messages in thread
From: Maxim Grigoriev @ 2010-11-11 23:16 UTC (permalink / raw)
To: himanshu sardana; +Cc: gdb, Marc Gauthier, Piet Delaney
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<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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-11 23:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-11 9:18 cross compile gdb-6.8 for xtensa himanshu sardana
2010-11-11 16:21 ` Maxim Grigoriev
2010-11-11 23:16 ` Maxim Grigoriev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox