Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - GDB for powerpc-unknown-nto-qnx6.5.0: (10 Items)
   
GDB for powerpc-unknown-nto-qnx6.5.0  
Hello,

I'm trying to build GDB for powerpc-unknown-nto-qnx6.5.0 using cross-compilation tools for linux-x86 host. Compilation 
fails with message:

ntoppc-gcc -c  -g -O2 -DHAVE_CONFIG_H  -I. -I/home/max/gdb-7.6/qnx/gdb-7.6/intl plural.c
plural.c:184: error: conflicting types for 'libintl_gettextparse'
/home/max/gdb-7.6/qnx/gdb-7.6/intl/plural-exp.h:114: note: previous declaration of 'libintl_gettextparse' was here
plural.c:1129: error: conflicting types for 'libintl_gettextparse'
/home/max/gdb-7.6/qnx/gdb-7.6/intl/plural-exp.h:114: note: previous declaration of 'libintl_gettextparse' was here
plural.c: In function 'libintl_gettextparse':
plural.c:1298: error: too few arguments to function '__gettextlex'
/home/max/gdb-7.6/qnx/gdb-7.6/intl/plural.y:178: error: 'arg' undeclared (first use in this function)
/home/max/gdb-7.6/qnx/gdb-7.6/intl/plural.y:178: error: (Each undeclared identifier is reported only once
/home/max/gdb-7.6/qnx/gdb-7.6/intl/plural.y:178: error: for each function it appears in.)
make[2]: *** [plural.o] Error 1
make[2]: Leaving directory `/home/max/gdb-7.6/qnx/gdb_build/intl'
make[1]: *** [all-intl] Error 2
make[1]: Leaving directory `/home/max/gdb-7.6/qnx/gdb_build'
make: *** [all] Error 2

GDB 7.6, downloaded from f27svn.qnx.com/svn/repos/core-dev-tools 

Cross-compilation tools:
GNU Make 3.81
ntoppc-gcc 4.4.2, target - powerpc-unknown-nto-qnx6.5.0

How to fix it?
Re: GDB for powerpc-unknown-nto-qnx6.5.0  
We do not support ppc host. But if you really want to build it, apply the
following patch:


Index: gdb/config/powerpc/nto.mh
===================================================================
--- gdb/config/powerpc/nto.mh   (revision 0)
+++ gdb/config/powerpc/nto.mh   (working copy)
@@ -0,0 +1,4 @@
+# Host: Intel 386 running QNX.
+
+NATDEPFILES= nto-procfs.o
+NAT_FILE= config/nm-nto.h
Index: gdb/configure.host
===================================================================
--- gdb/configure.host  (revision 897)
+++ gdb/configure.host  (working copy)
@@ -134,6 +134,7 @@ powerpc-*-linux*)   gdb_host=linux ;;
 powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
            gdb_host=nbsd ;;
 powerpc-*-openbsd*)    gdb_host=obsd ;;
+powerpc*-*-nto*)   gdb_host=nto ;;


 powerpc64-*-linux*)     gdb_host=ppc64-linux
                         # Support 'pseudo-native' debugging on the Cell BE



Then:
$ mkdir build
$ cd build
$ ../configure --host=powerpc-unknown-nto-qnx6.5.0
--target=powerpc-unknown-nto-qnx6.5.0 --without-expat --with-bugurl=no
--with-python=no --program-prefix=ntoppc- --enable-gdbmi --disable-nls
--disable-tui --disable-sim --without-sim --with-expat=no --disable-werror
--verbose CFLAGS="-D__QNXTARGET__ -g0 -O -D_LARGEFILE64_SOURCE"
CPPFLAGS="-I/tmp/stage650/qnx6/usr/include -I${QNX_TARGET}/usr/include"
LDFLAGS="-L${QNX_TARGET}/ppc/lib -L${QNX_TARGET}/ppc/usr/lib"
$ make


You will need proper environment variables
(QNX_HOST,QNX_TARGET,MAKEFLAGS,PATH).



Good luck,

Aleks

Re: GDB for powerpc-unknown-nto-qnx6.5.0  
Thank you, Aleks!
I've successfully built gdb. Unfortunately, when I try to run some simple program inside the debugger, it returns me 
message "Memory fault".
Re: GDB for powerpc-unknown-nto-qnx6.5.0  
Not surprising. We do not support PPC in 6.6.0, and gdb 7.6 was not really
meant to be used with 6.5.0. So I can't help you much more with that.

However, if you do need gdb 7.6 for 6.5.0/ppc, I suggest you go through
QNX support.

Or you can go back to our gdb 6.8 and try it, it should work better
(though, again, we never tested it self-hosted on ppc). Similar patch
would be needed as for 7.6.


---
Aleksandar

Re: GDB for powerpc-unknown-nto-qnx6.5.0  
On 15-05-14 10:30 AM, Aleksandar Ristovski wrote:
> Not surprising. We do not support PPC in 6.6.0, and gdb 7.6 was not really
> meant to be used with 6.5.0. So I can't help you much more with that.
>
> However, if you do need gdb 7.6 for 6.5.0/ppc, I suggest you go through
> QNX support.
>
> Or you can go back to our gdb 6.8 and try it, it should work better
> (though, again, we never tested it self-hosted on ppc). Similar patch
> would be needed as for 7.6.

One quick thing to try is that gdb self hosted on ppc might be running 
out of stack (default of 512K), so he should try to use ldrel to set a 
fairly larger stack size on the gdb binary.

Regards,

Ryan Mansfield
Re: GDB for powerpc-unknown-nto-qnx6.5.0  

On 2015-05-14, 10:35 AM, "Ryan Mansfield" <community-noreply@qnx.com>
wrote:

>On 15-05-14 10:30 AM, Aleksandar Ristovski wrote:
>> Not surprising. We do not support PPC in 6.6.0, and gdb 7.6 was not
>>really
>> meant to be used with 6.5.0. So I can't help you much more with that.
>>
>> However, if you do need gdb 7.6 for 6.5.0/ppc, I suggest you go through
>> QNX support.
>>
>> Or you can go back to our gdb 6.8 and try it, it should work better
>> (though, again, we never tested it self-hosted on ppc). Similar patch
>> would be needed as for 7.6.
>
>One quick thing to try is that gdb self hosted on ppc might be running
>out of stack (default of 512K), so he should try to use ldrel to set a
>fairly larger stack size on the gdb binary.

That is true.

In your build directory:

$ ldrel -L -S 4M gdb/gdb

Re: GDB for powerpc-unknown-nto-qnx6.5.0  
I've applied ldrel to my gdb 7.6 binary, but it didn't help.

After that, I've downloaded and patched gdb 6.8, but build process failed with message:
make[2]: Entering directory `/home/max/gdb_build/bfd'
Making info in doc
make[3]: Entering directory `/home/max/gdb_build/bfd/doc'
restore=: && backupdir=".am$$" && \
	rm -rf $backupdir && mkdir $backupdir && \
	if (makeinfo --split-size=5000000 --split-size=5000000 --version) >/dev/null 2>&1; then \
	  for f in bfd.info bfd.info-[0-9] bfd.info-[0-9][0-9] bfd.i[0-9] bfd.i[0-9][0-9]; do \
	    if test -f $f; then mv $f $backupdir; restore=mv; else :; fi; \
	  done; \
	else :; fi && \
	if makeinfo --split-size=5000000 --split-size=5000000   -I /home/max/gdb-6.8/bfd/doc \
	 -o bfd.info `test -f 'bfd.texinfo' || echo '/home/max/gdb-6.8/bfd/doc/'`bfd.texinfo; \
	then \
	  rc=0; \
	else \
	  rc=$?; \
	  $restore $backupdir/* `echo "./bfd.info" | sed 's|[^/]*$||'`; \
	fi; \
	rm -rf $backupdir; exit $rc
/home/max/gdb-6.8/bfd/doc/bfd.texinfo:326: unknown command `colophon'
/home/max/gdb-6.8/bfd/doc/bfd.texinfo:337: unknown command `cygnus'
/home/max/gdb-6.8/bfd/doc/elf.texi:11: raising the section level of @subsubsection which is too low
make[3]: *** [bfd.info] Error 1
make[3]: Leaving directory `/home/max/gdb_build/bfd/doc'
Making info in po
make[3]: Entering directory `/home/max/gdb_build/bfd/po'
make[3]: Nothing to be done for `info'.
make[3]: Leaving directory `/home/max/gdb_build/bfd/po'
make[3]: Entering directory `/home/max/gdb_build/bfd'
make[3]: Nothing to be done for `info-am'.
make[3]: Leaving directory `/home/max/gdb_build/bfd'
make[2]: *** [info-recursive] Error 1
make[2]: Leaving directory `/home/max/gdb_build/bfd'
make[1]: *** [all-bfd] Error 2
make[1]: Leaving directory `/home/max/gdb_build'
make: *** [all] Error 2

Adding "--disable-doc --without-doc" to configuration flags had no effect.
Re: GDB for powerpc-unknown-nto-qnx6.5.0  
Touch those files that want to get regenerated

E.g.

$ touch gdb-6.8/bfd/doc/bfd.info


Re: GDB for powerpc-unknown-nto-qnx6.5.0  
There is no memory fault now, but debug process of some program terminates with signal "illegal instruction". Besides 
that, sometimes it fails to load my program.
Anyway, thanks for help!
Re: GDB for powerpc-unknown-nto-qnx6.5.0  
A very disturbing thread. I was hoping to use QNX to develop on a PPC platform, but no it seems pointless.