git » gdb-cross.git » commit c5030d3

gdb-cross 17.1

author Urja (ARMLFS builder)
2026-03-28 01:20:55 UTC
committer Urja (ARMLFS builder)
2026-03-28 01:20:55 UTC
parent 22aeac4b8f2d54b964ffb9b4887d6ec6549bf741

gdb-cross 17.1

.SRCINFO +10 -26
PKGBUILD +34 -38
gdb64.sh +5 -0
make-cross-container.sh +81 -0

diff --git a/.SRCINFO b/.SRCINFO
index 4ebf54b..0b8bed0 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,9 +1,8 @@
-pkgbase = gdb
+pkgbase = gdb-cross
 	pkgdesc = The GNU Debugger
-	pkgver = 14.2
-	pkgrel = 3
+	pkgver = 17.1
+	pkgrel = 1
 	url = https://www.gnu.org/software/gdb/
-	arch = armv7h
 	arch = aarch64
 	license = GPL3
 	makedepends = glibc
@@ -17,27 +16,12 @@ pkgbase = gdb
 	makedepends = boost
 	makedepends = readline
 	makedepends = gcc-libs
-	source = https://ftp.gnu.org/gnu/gdb/gdb-14.2.tar.xz
-	source = https://ftp.gnu.org/gnu/gdb/gdb-14.2.tar.xz.sig
+	options = !debug
+	source = https://ftp.gnu.org/gnu/gdb/gdb-17.1.tar.xz
+	source = https://ftp.gnu.org/gnu/gdb/gdb-17.1.tar.xz.sig
 	validpgpkeys = F40ADB902B24264AA42E50BF92EDB04BFF325CF3
-	sha1sums = 4f38f7c24d523b6923f22404b7dee4152a00d0d4
-	sha1sums = SKIP
-	b2sums = 65765dfd1ed08e19bb881fc7ae98d6ee4914f38a9a2bb0d0ca73bef472669664f807fe9c04e8dffd7025be98e736ac52f88ff5851ceddbb01a361885b18befc8
-	b2sums = SKIP
+	sha256sums = 14996f5f74c9f68f5a543fdc45bca7800207f91f92aeea6c2e791822c7c6d876
+	sha256sums = SKIP
 
-pkgname = gdb
-	depends = glibc
-	depends = ncurses
-	depends = libncursesw.so
-	depends = expat
-	depends = xz
-	depends = mpfr
-	depends = source-highlight
-	depends = gdb-common=14.2
-	depends = readline
-	depends = python
-	depends = elfutils
-	backup = etc/gdb/gdbinit
-
-pkgname = gdb-common
-	depends = python
+pkgname = gdb-cross
+	depends = 
diff --git a/PKGBUILD b/PKGBUILD
index 89b2117..82770b3 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,26 +1,24 @@
+# This is not a package you install into a system.... this creates most of 
+# a system to run the cross-gdb (64-bit gdb for analyzing 32-bit crash dumps)
+
 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
 # Maintainer: Anatol Pomozov <anatol.pomozov@gmail.com>
 # Contributor: Allan McRae <allan@archlinux.org>
 # Contributor: Jan de Groot <jgc@archlinux.org>
 
-pkgbase=gdb
-# gdb-common is a package that contains files common for all cross compiled versions
-# of gdb (for arm/avr/...)
-pkgname=(gdb gdb-common)
-pkgver=14.2
-pkgrel=3
+pkgname=gdb-cross
+_pkgname=gdb
+pkgver=17.1
+pkgrel=1
 pkgdesc='The GNU Debugger'
-arch=('armv7h' 'aarch64')
+arch=('aarch64')
 url='https://www.gnu.org/software/gdb/'
 license=(GPL3)
 makedepends=(glibc texinfo python ncurses expat xz mpfr
              source-highlight boost readline gcc-libs)
-source=(https://ftp.gnu.org/gnu/gdb/${pkgname}-${pkgver}.tar.xz{,.sig})
-sha1sums=('4f38f7c24d523b6923f22404b7dee4152a00d0d4'
-          'SKIP')
-b2sums=('65765dfd1ed08e19bb881fc7ae98d6ee4914f38a9a2bb0d0ca73bef472669664f807fe9c04e8dffd7025be98e736ac52f88ff5851ceddbb01a361885b18befc8'
-        'SKIP')
+source=(https://ftp.gnu.org/gnu/gdb/${_pkgname}-${pkgver}.tar.xz{,.sig})
 validpgpkeys=('F40ADB902B24264AA42E50BF92EDB04BFF325CF3') # Joel Brobecker
+options=(!debug)
 
 build() {
   cd gdb-$pkgver
@@ -29,41 +27,39 @@ build() {
   ../configure \
     --prefix=/usr \
     --disable-nls \
+    --target=armv7l-unknown-linux-gnueabihf \
     --enable-source-highlight \
     --enable-tui \
     --with-system-readline \
     --without-guile \
-    --with-python=/usr/bin/python3 \
-    --with-system-gdbinit=/etc/gdb/gdbinit
-  make
-}
-
-package_gdb-common() {
-  depends=(python)
+    --with-python=/usr/bin/python3
 
-  cd gdb-$pkgver/build
-  make -C gdb/data-directory DESTDIR="$pkgdir" install
+  make
 }
 
-package_gdb() {
-  depends=(glibc ncurses libncursesw.so expat xz mpfr source-highlight gdb-common=$pkgver
-           readline python elfutils)
-  backup=(etc/gdb/gdbinit)
+package() {
+  depends=()
 
   cd gdb-$pkgver/build
-  make -C gdb DESTDIR="$pkgdir" install
-  make -C gdbserver DESTDIR="$pkgdir" install
-
-  # install "custom" system gdbinit
-  install -dm 755 "$pkgdir/etc/gdb"
-  touch "$pkgdir/etc/gdb/gdbinit"
+  make DESTDIR="$pkgdir" install
 
-  # comes from gdb-common
-  rm -r "$pkgdir/usr/share/gdb/"
+  # This explains the empty depends ;) - the _point_ is to ship all the libs in this package, so 
+  # we snatch them from the temporary build host here
+  ( unset LD_PRELOAD
+  # It is nice to be able to _get a shell_ and _test python_ in the container, so including these binaries.
+  cp -vLp /usr/bin/{bash,python3} $pkgdir/usr/bin
+  LIBS=$(ldd $pkgdir/usr/bin/* | grep "/usr/lib/" | cut -d ' ' -f 1 | sort | uniq | grep -v 'ld-linux')
+  LIBS="$(echo $LIBS)"
+  echo $LIBS
+  mkdir -p $pkgdir/usr/lib/aarch64
+  ln -s usr/lib $pkgdir/lib
+  ln -s usr/bin $pkgdir/bin
+  cd /usr/lib
+  cp -vrp python3.* $pkgdir/usr/lib
+  cp -vLp $LIBS $pkgdir/usr/lib/aarch64/
+  cp -vLp /lib/ld-linux-aarch64.so.1 $pkgdir/usr/lib
+  )
 }
 
-# vim: ts=2 sw=2 et:
-sha1sums=('4f38f7c24d523b6923f22404b7dee4152a00d0d4'
-          'SKIP')
-b2sums=('65765dfd1ed08e19bb881fc7ae98d6ee4914f38a9a2bb0d0ca73bef472669664f807fe9c04e8dffd7025be98e736ac52f88ff5851ceddbb01a361885b18befc8'
-        'SKIP')
+sha256sums=('14996f5f74c9f68f5a543fdc45bca7800207f91f92aeea6c2e791822c7c6d876'
+            'SKIP')
diff --git a/gdb64.sh b/gdb64.sh
new file mode 100755
index 0000000..ca88335
--- /dev/null
+++ b/gdb64.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+sudo systemd-nspawn -i gdb64.sqfs --register=no --read-only -a \
+	--tmpfs=/root --chdir=/root -E PATH=/bin --bind=$1:/root/core \
+	-E DEBUGINFOD_URLS=http://a64box.urja.dev/armlfs-debuginfo \
+	/bin/armv7l-unknown-linux-gnueabihf-gdb --core core
diff --git a/make-cross-container.sh b/make-cross-container.sh
new file mode 100755
index 0000000..bc07754
--- /dev/null
+++ b/make-cross-container.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+# Usage: ./make-cross-container.sh <gdb-cross-pkg.tar.xz>
+BSN=gdb64
+BS=$(pwd)/$BSN
+
+mkdir -p $BS/{etc,sys,proc,dev,usr,root,tmp,run,var/lib/pacman}
+cd $BS
+pacman -U --arch aarch64 --noconfirm --noscriptlet -b $BS/var/lib/pacman -r $BS "$1"
+echo "/usr/lib/aarch64" >> etc/ld.so.conf
+cat > etc/passwd << "EOF"
+root:x:0:0:root:/root:/bin/bash
+nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false
+user:x:1000:1000::/home/user:/usr/bin/bash
+builder:x:2000:2000::/home/builder:/usr/bin/bash
+EOF
+cat > etc/shadow << "EOF"
+root::19818:0:99999:7:::
+nobody:x:19818:0:99999:7:::
+user::19897:0:99999:7:::
+builder::19897:0:99999:7:::
+EOF
+cat > etc/group << "EOF"
+root:x:0:
+kmem:x:3:
+tape:x:4:
+tty:x:5:
+daemon:x:6:
+floppy:x:7:
+disk:x:8:
+lp:x:9:
+dialout:x:10:
+audio:x:11:
+video:x:12:
+utmp:x:13:
+cdrom:x:15:
+adm:x:16:
+input:x:24:
+mail:x:34:
+kvm:x:61:
+wheel:x:97:builder,user
+users:x:999:builder,user
+nogroup:x:65534:
+user:x:1000:
+builder:x:2000:
+EOF
+cat > etc/gshadow << "EOF"
+root:x::
+kmem:x::
+tape:x::
+tty:x::
+daemon:x::
+floppy:x::
+disk:x::
+lp:x::
+dialout:x::
+audio:x::
+video:x::
+utmp:x::
+cdrom:x::
+adm:x::
+input:x::
+mail:x::
+kvm:x::
+wheel:x::builder,user
+users:x::builder,user
+nogroup:x::
+user:x::
+builder:x::
+EOF
+chmod 0600 etc/{g,}shadow
+# These need to exist for systemd to overmount them
+touch etc/{localtime,resolv.conf}
+# HTTPS debuginfod downloads need the cert database for curl
+mkdir -p etc/pki/tls/certs
+cp /etc/pki/tls/certs/ca-bundle.crt etc/pki/tls/certs/
+mkdir -p home/{user,builder}
+chown -R 1000 home/user
+chown -R 2000 home/builder
+ldconfig -r .
+cd ..
+mksquashfs $BSN $BSN.sqfs -b 1M -comp zstd