# Choose whether to build PPU or SPU package %{!?_with_ppu:%{!?_with_spu:%{error:You must specify one of --with ppu or --with spu.}}} %{?_with_ppu:%{?_with_spu:%{error:You cannot specify both --with ppu and --with spu.}}} %define with_ppu 0%{?_with_ppu:%{!?_with_spu:1}} %define with_spu 0%{?_with_spu:%{!?_with_ppu:1}} %define package_prefix %{?_with_ppu:ppu}%{?_with_spu:spu} Version: 6.8.50 Release: 13 Name: %{package_prefix}-gdb %if %{with_ppu} Summary: Debugger for Linux on Cell BE PPU/SPU %endif %if %{with_spu} Summary: Debugger for Linux on Cell BE SPU %endif License: GPL Group: Cell Development Tools Source: gdb-6.8.50-20080526.tar.bz2 BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext BuildRequires: flex bison expat expat-devel # Testsuite Patch1: diff-dejagnu-config # SPU-specific patches Patch101: diff-spu-ext-mi Patch102: diff-spu-backchainerror Patch103: diff-spu-redzone Patch104: diff-spu-dmainfo Patch105: diff-spu-querytype-fix # PPU-specific patches Patch201: diff-ppu-unrelocopd Patch202: diff-ppu-gdbservertlsfix Patch203: diff-ppu-gdbserverhang Patch204: diff-ppu-gdbserverdeadthread Patch205: diff-ppu-removebp Patch206: diff-ppu-restartfix # Combined debugger Patch301: diff-gdb-stepthread Patch302: diff-gdb-preferredlwp Patch303: diff-gdb-preferredlwp-gdbserver Patch304: diff-gdb-targetarch Patch305: diff-gdb-solib-remote Patch306: diff-gdb-solib-auxv Patch307: diff-gdb-solib-openbfd Patch308: diff-gdb-threadarch Patch309: diff-combined-gdb Patch310: diff-combined-gdb-gdbserver Patch311: diff-combined-gdb-core Patch312: diff-combined-gdb-overlay Patch313: diff-combined-gdb-frame Patch314: diff-combined-gdb-ea-ptr Patch315: diff-combined-gdb-ea-cache Patch316: diff-combined-testsuite Patch317: diff-user-choice-symbols BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %define _unpackaged_files_terminate_build 1 # Don't strip as the host binutils may be unable to handle SPU objects. %define __os_install_post /usr/lib/rpm/brp-compress # When building the cross-toolchain, reset prefix directory and use sysroot %ifnarch ppc ppc64 %define _prefix /opt/cell/toolchain %define _mandir %{_prefix}/man %define _infodir %{_prefix}/info %define with_sysroot --with-sysroot=remote: %endif %description %if %{with_ppu} GNU debugger for Cell Broadband Engine PPU/SPU. %endif %if %{with_spu} GNU debugger for Cell Broadband Engine SPU (standalone). %endif %package -n %{package_prefix}-gdb-testsuite Summary: DejaGnu testsuite for %{package_prefix}-gdb Group: Cell Development Tools Requires: %{package_prefix}-gdb = %{version}-%{release}, dejagnu %description -n %{package_prefix}-gdb-testsuite DejaGnu testsuite for %{package_prefix}-gdb. %prep %setup -c -q %patch1 -p0 %patch101 -p0 %patch102 -p0 %patch103 -p0 %patch104 -p0 %patch105 -p0 %patch201 -p0 %patch202 -p0 %patch203 -p0 %patch204 -p0 %patch205 -p0 %patch206 -p0 %patch301 -p0 %patch302 -p0 %patch303 -p0 %patch304 -p0 %patch305 -p0 %patch306 -p0 %patch307 -p0 %patch308 -p0 %patch309 -p0 %patch310 -p0 %patch311 -p0 %patch312 -p0 %patch313 -p0 %patch314 -p0 %patch315 -p0 %patch316 -p0 %patch317 -p0 %build %if %{with_ppu} %ifarch ppc ppc64 %define configuration --host=powerpc64-linux --target=powerpc64-linux --enable-targets=spu %else %define configuration --target=powerpc64-linux --enable-targets=spu %endif %endif %if %{with_spu} %define configuration --target=spu %endif rm -fr obj-%{package_prefix} mkdir obj-%{package_prefix} cd obj-%{package_prefix} CC=gcc CFLAGS="$RPM_OPT_FLAGS" %if %{with_ppu} %ifarch ppc ppc64 CC='gcc -m64' CFLAGS=`echo $CFLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'` %endif %endif CC="$CC" CFLAGS="$CFLAGS" ../src/configure \ --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \ %if %{with_ppu} %ifarch ppc ppc64 --libdir=/usr/lib64 \ %endif %endif --with-expat --disable-nls --disable-sim --disable-werror \ --disable-install-libbfd --disable-shared \ %{?with_sysroot} --program-prefix=%{package_prefix}- %{configuration} make %{?_smp_mflags} cd .. %install rm -fr $RPM_BUILD_ROOT cd obj-%{package_prefix} make DESTDIR=$RPM_BUILD_ROOT install cd .. # Install the testsuite and helper scripts. %define builddir $RPM_BUILD_DIR/%{package_prefix}-gdb-%{version}/src %define testdir $RPM_BUILD_ROOT%{_prefix}/share/%{package_prefix}-gdb-testsuite %define baseboards $RPM_BUILD_ROOT/usr/share/dejagnu/baseboards mkdir -p $RPM_BUILD_ROOT%{_prefix}/share cp -R %{builddir}/gdb/testsuite %{testdir} install -m 755 %{builddir}/test-installed-%{package_prefix}-gdb %{testdir} install -d -m 755 %{baseboards} install -m 644 %{builddir}/%{package_prefix}-gdb-*.exp %{baseboards} # Create script to run testsuite. cat > $RPM_BUILD_ROOT%{_prefix}/bin/%{package_prefix}-gdb-runtests <<"EOF" #!/bin/sh function usage { %ifarch ppc ppc64 echo "Usage: RUNTESTFLAGS= $0 native | remote "; %else echo "Usage: RUNTESTFLAGS= $0 "; %endif echo "RUNTESTFLAGS can be used to specify the test(s) to run, for example" echo "RUNTESTFLAGS=gdb.arch/spu-info.exp" exit 1; } test $# -eq 0 && usage %ifarch ppc ppc64 test $1 = native -o \( $1 = remote -a $# = 2 \) || usage test $1 = remote && export GDB_TARGET_HOSTNAME=$2 if [ $1 = native ] ; then %if %{with_ppu} board=unix/-m32; %else board=%{package_prefix}-gdb-native; %endif else board=%{package_prefix}-gdb-remote; fi %else test $1 = native -o $1 = localhost && usage export GDB_TARGET_HOSTNAME=$1 board=%{package_prefix}-gdb-remote %endif pushd %{_prefix}/share/%{package_prefix}-gdb-testsuite subdirs=`find -type d -name 'gdb*'` popd for I in $subdirs do mkdir -p $I done RUNTESTFLAGS="$RUNTESTFLAGS" %{_prefix}/share/%{package_prefix}-gdb-testsuite/test-installed-%{package_prefix}-gdb \ --with-testsuite=%{_prefix}/share/%{package_prefix}-gdb-testsuite \ --with-gcc=%{_prefix}/bin/%{package_prefix}-gcc \ --with-g++=%{_prefix}/bin/%{package_prefix}-g++ \ --with-gdb=%{_prefix}/bin/%{package_prefix}-gdb \ %if %{with_spu} --target spu-unknown-elf \ %endif --target_board $board EOF chmod 755 $RPM_BUILD_ROOT%{_prefix}/bin/%{package_prefix}-gdb-runtests # Info and man7 files conflict with host toolchain files, # just remove them for now. rm -rf $RPM_BUILD_ROOT%{_infodir} rm -rf $RPM_BUILD_ROOT%{_mandir}/man7 # These come with the binutils package. rm -rf $RPM_BUILD_ROOT/%{_prefix}/lib{,64}/lib{bfd*,opcodes*,iberty*,mmalloc*} %clean rm -rf $RPM_BUILD_ROOT %files -n %{package_prefix}-gdb %defattr(-,root,root) %dir %{_prefix} %dir %{_prefix}/bin %dir %{_mandir} %dir %{_mandir}/man1 %{_prefix}/bin/%{package_prefix}-gdb %{_prefix}/bin/%{package_prefix}-gdbtui %ifarch ppc ppc64 %{_prefix}/bin/*-gdbserver %endif %{_mandir}/man1/%{package_prefix}-gdb* %files -n %{package_prefix}-gdb-testsuite %defattr(-,root,root) %dir %{_prefix} %dir %{_prefix}/bin %dir %{_prefix}/share %{_prefix}/bin/%{package_prefix}-gdb-runtests %{_prefix}/share/%{package_prefix}-gdb-testsuite %dir /usr/share/dejagnu/baseboards /usr/share/dejagnu/baseboards/%{package_prefix}-gdb-*.exp %changelog * Wed Sep 03 2008 Ulrich Weigand 6.8.50-13 - Do not error when backchain is invalid during backtrace (#45125). * Fri Aug 15 2008 Ulrich Weigand 6.8.50-12 - Fix query type decoding for "info spu dma" (#43474). - Improve "info spu dma" output (#43474). - Fix gdbserver errors on dead thread race condition (#46488). - Fix "Remote communication error" at program exit (#46489). - Add option to switch off that automatic __cache_flush call (#47021). - Respect SPU stack frame "red zone" for inferior calls (#47126). - Port some fixes from mainline patches. * Sat Jul 12 2008 Ulrich Weigand 6.8.50-11 - Do not error when backchain is invalid during backtrace (#45125). - Fix segfault when running program twice (#45194). - Fix inferior function calls (#45566). - Fix race when removing breakpoints from unloaded shared library. - Fix uninitialize variable access in gdbserver (#45887). - Fix generate-core-file command (#45888). - Fix ea cache_flush for SPU standalone binaries. * Thu May 29 2008 Ulrich Weigand 6.8.50-10 - Update to "2008-05-26 10:00 GMT" mainline snapshot. - Fix stepping over shared library calls (#44254). - Fix handling of dlopen()'ed libspe2 on ppc64 (#44415). * Mon Apr 28 2008 Ulrich Weigand 6.8.50-9 - Fix GDB crash after attach (#44356) and with core files (#44408, #44409). * Mon Apr 21 2008 Ulrich Weigand 6.8.50-8 - Retrieve shared library images via remote protocol. * Wed Apr 09 2008 Markus Deuling 6.8.50-7 - Port to 6.8.50-20080408 snapshot. * Tue Mar 18 2008 Ulrich Weigand 6.7-6 - Fix stray %if statement. * Thu Feb 28 2008 Markus Deuling 6.7-5 - Remove unnecessary patch. * Tue Feb 26 2008 Markus Deuling 6.7-4 - Allow usage of RUNTESTFLAGS to {spu,ppu}-gdb-runtests * Sat Nov 24 2007 Ulrich Weigand 6.7-3 - Split back into ppu-gdb and spu-gdb packages. * Wed Oct 31 2007 Ulrich Weigand 6.7-2 - Remove unnecessary patch. * Thu Oct 25 2007 Ulrich Weigand 6.7-1 - Initial version of combined cell-gdb package.