Re: Error building qnx cross-gdb 6.3

Ion Gaztañaga
2005-05-24T17:19:15Z

Hello to all,

Thanks Kris for the link. I thought cross-compilation was already in head
with remote debugging. Anyway if it is useful I've debugged a bit.
It may seem a joke but the only commands I knew about gdb were r, c, and bt
(yes, building a tool I never use is not usual but work is like that...) But
anyway, this seems enough to get some hints:

$
addr2line.exe --exe=/tools/i386-pc-nto-qnx6.3.0/bin/i386-pc-nto-qnx6.3.0-gdb.exe
0042012D
/src/gdb-6.3/objdir/gdb/../../gdb/infrun.c:3077
004E0F60
/src/gdb-6.3/objdir/gdb/../../gdb/nto-tdep.c:322
00425F89
/src/gdb-6.3/objdir/gdb/init.c:123
00403DB6
/src/gdb-6.3/objdir/gdb/../../gdb/top.c:1766
00401616
/src/gdb-6.3/objdir/gdb/../../gdb/main.c:527
00402281
/src/gdb-6.3/objdir/gdb/../../gdb/top.c:525
004020F5
/src/gdb-6.3/objdir/gdb/../../gdb/top.c:431
004022E0
/src/gdb-6.3/objdir/gdb/../../gdb/top.c:538
00401DF3
/src/gdb-6.3/objdir/gdb/../../gdb/main.c:814
004010AA
/src/gdb-6.3/objdir/gdb/../../gdb/gdb.c:36
61005F34
??:0
6100614B
??:0

------------------------------------------------

igaztanaga@ion ~
$ gdb /tools/i386-pc-nto-qnx6.3.0/bin/i386-pc-nto-qnx6.3.0-gdb.exe
GNU gdb 2003-09-20-cvs (cygwin-special)
Copyright 2003 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 "i686-pc-cygwin"...
(gdb) c
The program is not being run.
(gdb) r
Starting program:
/tools/i386-pc-nto-qnx6.3.0/bin/i386-pc-nto-qnx6.3.0-gdb.exe

Program received signal SIGSEGV, Segmentation fault.
0x0042012d in signal_stop_update (signo=57, state=0)
at ../../gdb/infrun.c:3077
3077 int ret = signal_stop[signo];
(gdb) bt
#0 0x0042012d in signal_stop_update (signo=57, state=0)
at ../../gdb/infrun.c:3077
#1 0x004e0f60 in _initialize_nto_tdep () at ../../gdb/nto-tdep.c:321
#2 0x00425f89 in initialize_all_files () at init.c:122
#3 0x00403db6 in gdb_init (
argv0=0x10101f70
"/tools/i386-pc-nto-qnx6.3.0/bin/i386-pc-nto-qnx6.3.0-gdb")
at ../../gdb/top.c:1765
#4 0x00401616 in captured_main (data=0x22f000) at ../../gdb/main.c:520
#5 0x00402281 in do_catch_errors (uiout=0x5834d0, data=0x22efc0)
at ../../gdb/top.c:524
#6 0x004020f5 in catcher (func=0x402270 <do_catch_errors>,
func_uiout=0x5834d0, func_args=0x22efc0, func_val=0x22efb8,
func_caught=0x22efbc, errstring=0x58e0e2 "", gdberrmsg=0x0, mask=6)
at ../../gdb/top.c:431
#7 0x004022e0 in catch_errors (func=0x401110 <captured_main>,
func_args=0x22f000, errstring=0x58e0e2 "", mask=6) at
../../gdb/top.c:536
#8 0x00401df3 in gdb_main (args=0x22f000) at ../../gdb/main.c:810
#9 0x004010aa in main (argc=1, argv=0x10101f40) at ../../gdb/gdb.c:35

It seems that in the signal_stop function array is not initialized.
_initialize_infrun is not called?

(gdb) print signal_stop
$1 = (unsigned char *) 0x0

After some breakpoints (yes, I've learnt that right now ;-) ) I find that:

_initialize_nto_tdep is called before _initialize_infrun so signal arrays
are not initialized. I can confirm this in gdb\init.c file of my build-dir

I will return when gdb 6.4 is out ;-) . Regards and thanks.

Ion

----- Original Message -----
From: "Kris Warkentin" <kewarken@qnx.com>
To: "Ion GaztaÃ±aga" <ion_g_m@terra.es>
Cc: "Daniel Jacobowitz" <drow@false.org>; <gdb@sources.redhat.com>
Sent: Tuesday, May 24, 2005 5:54 PM
Subject: Re: Error building qnx cross-gdb 6.3

> You're going into somewhat uncharted territories here. We _DO_ cross
> compile gdb targetting qnx but the GNU cvs doesn't have all the files yet
> for remote debugging. It only has self-hosted, i386 targetting.
>
> If you would like a drop of the full port of the sources, go to
> http://www.qnx.com/download/group.html?programid=11358 and you can find
> compiled binaries and source for gdb-6.2.1. You may need to create a free
> myQNX account.
>
> I also have 6.3.0 sources if you would like them. For what it's worth, I
> build gdb under cygwin with
> 'configure --disable-sim --disable-nls --disable-gdbtk --target=i386-nto'
>
> cheers,
>
> Kris