Package: gdb
Version: 7.2-1
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: natty origin-ubuntu ubuntu-patch

        Hey

 Ulrich Weigand told me about gdb's support for --enable-targets=all,
 and that gdb supported multiple targets since 6.8 or so; I found that
 to be a much easier path towards providing Debian/Ubuntu users with a
 cross gdb (for armel / arm-linux-gnueabi in particular) than building
 with GDB_TARGET set.  (The latter remains useful in the case where you
 have your own toolchain source tree and want to build a standalone
 cross gdb from different sources; see Debian #603347.)

 I got a gdb-multiarch binary package building, much like the gdb64 one.
 Because I did this work in Ubuntu and because we're using gcc-4.5, I
 also had to backport an upstream patch to fix the build for bfd coff
 targets with gcc-4.5.

 I'm attaching the resulting debdiff; I've omitted the generated
 debian/control.  Feel free to leave out the build fix if you don't keep
 --enable-targets=all or don't need gcc-4.5 support for now.

 I started a discussion on debian-embedded@ (Cc:ing you) on whether it
 makes sense to bother listing a set of triplets in binutils-multiarch
 and in gdb-multiarch given that this has the chance of missing useful
 ones (e.g. simply getting out of date) and given that these packages
 are typically installed on systems with tons of disk space as they also
 host debug symbols and/or large sets of build-deps.

 /usr/bin/gdb-multiarch ends up being 18 MiB on amd64 with
 --enable-targets=all (~ 4.2 MiB for /usr/bin/gdb here).

   Thanks!
-- 
Loïc Minier
diff -Nru gdb-7.2/debian/changelog gdb-7.2/debian/changelog
--- gdb-7.2/debian/changelog    2011-01-17 23:01:24.000000000 +0100
+++ gdb-7.2/debian/changelog    2011-01-19 12:26:50.000000000 +0100
@@ -1,3 +1,13 @@
+gdb (7.2-1ubuntu8) natty; urgency=low
+
+  * Add gdb-multiarch package supporting extra bfd targets similarly to
+    binutils-multiarch; the package is constructed much like gdb64 except that
+    it's build with the gdb configure flags and --enable-targets=all for now.
+  * New patch, disable-werror-on-coff-tic, fixes build of coff stuff with
+    gcc-4.5; from upstream mailing-list.
+
+ -- Loïc Minier <loic.min...@linaro.org>  Tue, 18 Jan 2011 17:44:56 +0100
+
 gdb (7.2-1ubuntu7) natty; urgency=low
 
   * Pass --gdb-datadir=/usr/share/gdb-$triplet when building a cross-gdb and
diff -Nru gdb-7.2/debian/control gdb-7.2/debian/control
--- gdb-7.2/debian/control      2011-01-17 22:32:48.000000000 +0100
+++ gdb-7.2/debian/control      2011-01-18 17:44:47.000000000 +0100
@@ -44,6 +44,20 @@
  Modula 2 and Java programs. A must-have for any serious
  programmer.
 
+Package: gdb-multiarch
+Architecture: any
+Section: devel
+Depends: ${shlibs:Depends}, gdb, ${misc:Depends}
+Description: The GNU Debugger (with support for multiple architectures)
+ GDB is a source-level debugger, capable of breaking programs at
+ any specific line, displaying variable values, and determining
+ where errors occurred. Currently, it works for C, C++, Fortran
+ Modula 2 and Java programs. A must-have for any serious
+ programmer.
+ .
+ This package contains a version of GDB which supports multiple
+ target architectures.
+
 Package: gdbserver
 Architecture: amd64 armel i386 ia64 mips mipsel powerpc s390
 Section: devel
diff -Nru gdb-7.2/debian/control.in gdb-7.2/debian/control.in
--- gdb-7.2/debian/control.in   2011-01-17 22:31:43.000000000 +0100
+++ gdb-7.2/debian/control.in   2011-01-18 17:27:28.000000000 +0100
@@ -44,6 +44,20 @@
  Modula 2 and Java programs. A must-have for any serious
  programmer.
 
+Package: gdb-multiarch
+Architecture: any
+Section: devel
+Depends: ${shlibs:Depends}, gdb, ${misc:Depends}
+Description: The GNU Debugger (with support for multiple architectures)
+ GDB is a source-level debugger, capable of breaking programs at
+ any specific line, displaying variable values, and determining
+ where errors occurred. Currently, it works for C, C++, Fortran
+ Modula 2 and Java programs. A must-have for any serious
+ programmer.
+ .
+ This package contains a version of GDB which supports multiple
+ target architectures.
+
 Package: gdbserver
 Architecture: amd64 armel i386 ia64 mips mipsel powerpc s390
 Section: devel
diff -Nru gdb-7.2/debian/patches/disable-werror-on-coff-tic.patch 
gdb-7.2/debian/patches/disable-werror-on-coff-tic.patch
--- gdb-7.2/debian/patches/disable-werror-on-coff-tic.patch     1970-01-01 
01:00:00.000000000 +0100
+++ gdb-7.2/debian/patches/disable-werror-on-coff-tic.patch     2011-01-19 
01:06:52.000000000 +0100
@@ -0,0 +1,49 @@
+Submitted upstream in http://sourceware.org/ml/binutils/2010-08/msg00139.html
+
+--- a/bfd/Makefile.am
++++ b/bfd/Makefile.am
+@@ -960,3 +960,19 @@
+           -e "s,@report_bugs_to@,$$report_bugs_to," \
+           < $(srcdir)/version.h > $@; \
+       echo "$${bfd_soversion}" > libtool-soversion
++
++# Disable -Werror, if it has been enabled, since coffswap.h won't
++# compile with gcc 4.5 and above.
++coff-tic4x.lo: coff-tic4x.c
++@am__fastdepCC_TRUE@  $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o 
$@ $< $(NO_WERROR)
++@am__fastdepCC_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
++@AMDEP_TRUE@@am__fastdepCC_FALSE@     source='$<' object='$@' libtool=yes 
@AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
++
++coff-tic54x.lo: coff-tic54x.c
++@am__fastdepCC_TRUE@  $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o 
$@ $< $(NO_WERROR)
++@am__fastdepCC_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
++@AMDEP_TRUE@@am__fastdepCC_FALSE@     source='$<' object='$@' libtool=yes 
@AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
+--- a/bfd/Makefile.in
++++ b/bfd/Makefile.in
+@@ -1990,6 +1990,22 @@
+           < $(srcdir)/version.h > $@; \
+       echo "$${bfd_soversion}" > libtool-soversion
+ 
++# Disable -Werror, if it has been enabled, since coffswap.h won't
++# compile with gcc 4.5 and above.
++coff-tic4x.lo: coff-tic4x.c
++@am__fastdepCC_TRUE@  $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o 
$@ $< $(NO_WERROR)
++@am__fastdepCC_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
++@AMDEP_TRUE@@am__fastdepCC_FALSE@     source='$<' object='$@' libtool=yes 
@AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
++
++coff-tic54x.lo: coff-tic54x.c
++@am__fastdepCC_TRUE@  $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o 
$@ $< $(NO_WERROR)
++@am__fastdepCC_TRUE@  $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
++@AMDEP_TRUE@@am__fastdepCC_FALSE@     source='$<' object='$@' libtool=yes 
@AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
++
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
diff -Nru gdb-7.2/debian/patches/gdb-7.2-gcore-relro-writer.patch 
gdb-7.2/debian/patches/gdb-7.2-gcore-relro-writer.patch
--- gdb-7.2/debian/patches/gdb-7.2-gcore-relro-writer.patch     2010-12-10 
04:54:41.000000000 +0100
+++ gdb-7.2/debian/patches/gdb-7.2-gcore-relro-writer.patch     2011-01-18 
23:58:24.000000000 +0100
@@ -35,10 +35,8 @@
        * gdb.base/gcore-relro-main.c: New file.
        * gdb.base/gcore-relro-lib.c: New file.
 
-Index: gdb-7.2/gdb/defs.h
-===================================================================
---- gdb-7.2.orig/gdb/defs.h    2010-12-09 19:53:37.281926514 -0800
-+++ gdb-7.2/gdb/defs.h 2010-12-09 19:53:51.065010647 -0800
+--- a/gdb/defs.h
++++ b/gdb/defs.h
 @@ -631,9 +631,10 @@
  
  /* From exec.c */
@@ -51,10 +49,8 @@
  
  /* Take over the 'find_mapped_memory' vector from exec.c. */
  extern void exec_set_find_memory_regions
-Index: gdb-7.2/gdb/fbsd-nat.c
-===================================================================
---- gdb-7.2.orig/gdb/fbsd-nat.c        2010-12-09 19:53:37.311933228 -0800
-+++ gdb-7.2/gdb/fbsd-nat.c     2010-12-09 19:53:51.075012885 -0800
+--- a/gdb/fbsd-nat.c
++++ b/gdb/fbsd-nat.c
 @@ -133,7 +133,7 @@
        }
  
@@ -64,10 +60,8 @@
      }
  
    do_cleanups (cleanup);
-Index: gdb-7.2/gdb/gcore.c
-===================================================================
---- gdb-7.2.orig/gdb/gcore.c   2010-12-09 19:53:37.311933228 -0800
-+++ gdb-7.2/gdb/gcore.c        2010-12-09 19:53:51.075012885 -0800
+--- a/gdb/gcore.c
++++ b/gdb/gcore.c
 @@ -378,8 +378,8 @@
  }
  
@@ -136,10 +130,8 @@
             obfd);
  
    return 0;
-Index: gdb-7.2/gdb/gnu-nat.c
-===================================================================
---- gdb-7.2.orig/gdb/gnu-nat.c 2010-12-09 19:53:37.311933228 -0800
-+++ gdb-7.2/gdb/gnu-nat.c      2010-12-09 19:53:51.075012885 -0800
+--- a/gdb/gnu-nat.c
++++ b/gdb/gnu-nat.c
 @@ -2544,7 +2544,7 @@
                     last_protection & VM_PROT_READ,
                     last_protection & VM_PROT_WRITE,
@@ -158,10 +150,8 @@
  
    return 0;
  }
-Index: gdb-7.2/gdb/linux-nat.c
-===================================================================
---- gdb-7.2.orig/gdb/linux-nat.c       2010-12-09 19:53:37.321935466 -0800
-+++ gdb-7.2/gdb/linux-nat.c    2010-12-09 19:53:51.085015123 -0800
+--- a/gdb/linux-nat.c
++++ b/gdb/linux-nat.c
 @@ -4021,12 +4021,9 @@
  /* Service function for corefiles and info proc.  */
  
@@ -274,10 +264,8 @@
            {
              size = endaddr - addr;
  
-Index: gdb-7.2/gdb/procfs.c
-===================================================================
---- gdb-7.2.orig/gdb/procfs.c  2010-12-09 19:53:37.351942180 -0800
-+++ gdb-7.2/gdb/procfs.c       2010-12-09 19:53:51.115021838 -0800
+--- a/gdb/procfs.c
++++ b/gdb/procfs.c
 @@ -5285,7 +5285,7 @@
                  (map->pr_mflags & MA_READ) != 0,
                  (map->pr_mflags & MA_WRITE) != 0,
@@ -287,10 +275,8 @@
  }
  
  /* External interface.  Calls a callback function once for each
-Index: gdb-7.2/gdb/testsuite/gdb.base/gcore-relro-lib.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2/gdb/testsuite/gdb.base/gcore-relro-lib.c   2010-12-09 
19:53:51.125024077 -0800
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-relro-lib.c
 @@ -0,0 +1,21 @@
 +/* Copyright 2010 Free Software Foundation, Inc.
 +
@@ -313,10 +299,8 @@
 +lib (void)
 +{
 +}
-Index: gdb-7.2/gdb/testsuite/gdb.base/gcore-relro-main.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2/gdb/testsuite/gdb.base/gcore-relro-main.c  2010-12-09 
19:53:51.125024077 -0800
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-relro-main.c
 @@ -0,0 +1,25 @@
 +/* Copyright 2010 Free Software Foundation, Inc.
 +
@@ -343,10 +327,8 @@
 +  lib ();
 +  return 0;
 +}
-Index: gdb-7.2/gdb/testsuite/gdb.base/gcore-relro.exp
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.2/gdb/testsuite/gdb.base/gcore-relro.exp     2010-12-09 
19:53:51.125024077 -0800
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-relro.exp
 @@ -0,0 +1,80 @@
 +# Copyright 2010 Free Software Foundation, Inc.
 +
diff -Nru gdb-7.2/debian/patches/series gdb-7.2/debian/patches/series
--- gdb-7.2/debian/patches/series       2010-12-10 19:38:00.000000000 +0100
+++ gdb-7.2/debian/patches/series       2011-01-19 00:05:12.000000000 +0100
@@ -13,3 +13,4 @@
 # Forwarded to Debian, bug 606667
 gdb-7.2-gcore-relro-cleanup.patch
 gdb-7.2-gcore-relro-writer.patch
+disable-werror-on-coff-tic.patch
diff -Nru gdb-7.2/debian/rules gdb-7.2/debian/rules
--- gdb-7.2/debian/rules        2011-01-17 22:31:36.000000000 +0100
+++ gdb-7.2/debian/rules        2011-01-18 19:28:34.000000000 +0100
@@ -84,6 +84,8 @@
 endif
 endif
 
+BUILDDIRMULTIARCH = $(ALL_BUILDDIR)/objdir-multiarch
+
 run_tests := yes
 
 ifneq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
@@ -127,6 +129,38 @@
 DEB_CONFIGURE_FLAGS_64 := --host=$(HOST64) $(EXTRA_FLAGS) \
        --enable-tui
 
+# multiarch targets; this is taken from the binutils-multiarch package but
+# doesn't seem like a terribly nice list; see
+# <20110117211551.ga7...@bee.dooz.org> for discussion
+#MULTIARCH_TARGETS := \
+#      alpha-linux-gnu \
+#      arm-linux-gnu \
+#      armel-linux-gnu \
+#      hppa-linux-gnu \
+#      i686-linux-gnu \
+#      ia64-linux-gnu \
+#      m68k-linux-gnu \
+#      m68k-rtems \
+#      mips-linux-gnu \
+#      mipsel-linux-gnu \
+#      mips64-linux-gnu \
+#      mips64el-linux-gnu \
+#      powerpc-linux-gnu \
+#      powerpc64-linux-gnu \
+#      s390-linux-gnu \
+#      s390x-linux-gnu \
+#      sh-linux-gnu \
+#      sh64-linux-gnu \
+#      sparc-linux-gnu \
+#      sparc64-linux-gnu \
+#      x86_64-linux-gnu \
+#      m32r-linux-gnu \
+#      spu
+MULTIARCH_TARGETS := all
+# multiarch flags
+DEB_CONFIGURE_FLAGS_MULTIARCH := $(DEB_CONFIGURE_EXTRA_FLAGS) \
+       --enable-targets=`set -- $(MULTIARCH_TARGETS); IFS=,; echo "$$*"`
+
 # Minimal flags
 DEB_CONFIGURE_FLAGS_MIN := --host=$(DEB_HOST_GNU_TYPE) $(EXTRA_FLAGS) \
        --disable-tui --without-expat --without-python
@@ -163,6 +197,14 @@
        cd $(BUILDDIR64) && $(DEB_MAKE_ENVVARS) $(MAKE) $(NJOBS)
        touch $@
 
+build/gdb-multiarch:: build-multiarch-stamp
+build-multiarch-stamp:
+       mkdir -p $(BUILDDIRMULTIARCH)
+       cd $(BUILDDIRMULTIARCH) && \
+         $(shell pwd)/configure $(DEB_CONFIGURE_FLAGS_MULTIARCH)
+       cd $(BUILDDIRMULTIARCH) && $(DEB_MAKE_ENVVARS) $(MAKE) $(NJOBS)
+       touch $@
+
 build/gdb-minimal:: build-minimal-stamp
 build-minimal-stamp:
        mkdir -p $(BUILDDIRMIN)
@@ -179,7 +221,7 @@
        touch $@
 
 clean::
-       rm -f check-stamp build64-stamp
+       rm -f check-stamp build64-stamp build-multiarch-stamp
        rm -rf $(ALL_BUILDDIR)
 
        if test -f gdb/version.in.backup; then \
@@ -227,6 +269,13 @@
        rm -rf debian/gdb64/usr/share/doc/gdb64
        ln -s gdb debian/gdb64/usr/share/doc/gdb64
 
+binary-post-install/gdb-multiarch ::
+       install -d debian/gdb-multiarch/usr/bin
+       install -s -m 755 $(BUILDDIRMULTIARCH)/gdb/gdb 
debian/gdb-multiarch/usr/bin/gdb-multiarch
+       dh_link -pgdb-mutliarch usr/share/man/man1/gdb.1.gz 
usr/share/man/man1/gdb64.1.gz
+       rm -rf debian/gdb-multiarch/usr/share/doc/gdb-multiarch
+       ln -s gdb debian/gdb-multiarch/usr/share/doc/gdb-multiarch
+
 binary-post-install/gdb-minimal ::
        install -d debian/gdb-minimal/usr/bin
        $(INSTALL) -m 755 -o root -g root \
@@ -269,6 +318,7 @@
                > debian/control
 ifeq ($(DEB_CROSS),yes)
        sed -i "/Package: gdb64/,\$$ d" debian/control
+       sed -i "/Package: gdb-multiarch/,\$$ d" debian/control
        sed "s+/gdb+/$(TP)gdb+g; s+usr/share/$(TP)gdb+usr/share/gdb$(TS)+g" \
                debian/gdb.install > debian/gdb$(TS).install
 endif

Reply via email to