This Magisk module contains gdb 16.3 for arm64 CPUs


ASUS_I006D:/ $ gdb --version
GNU gdb (GDB) 16.3
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
ASUS_I006D:/ $ 


ASUS_I006D:/ $ echo "show configuration"  | gdb
GNU gdb (GDB) 16.3
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-linux-android".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) This GDB was configured as follows:
   configure --host=aarch64-linux-android --target=aarch64-linux-android
	     --with-auto-load-dir=$debugdir:$datadir/auto-load
	     --with-auto-load-safe-path=$debugdir:$datadir/auto-load
	     --with-expat
	     --with-gdb-datadir=/system/usr/share/gdb (relocatable)
	     --with-jit-reader-dir=/system/usr/lib/gdb (relocatable)
	     --without-libunwind-ia64
	     --with-lzma
	     --without-babeltrace
	     --without-intel-pt
	     --with-xxhash
	     --without-python
	     --without-python-libdir
	     --without-debuginfod
	     --with-curses
	     --without-guile
	     --without-amd-dbgapi
	     --disable-source-highlight
	     --enable-threading
	     --enable-tui
	     --without-system-readline
	     --with-separate-debug-dir=/system/usr/lib/debug (relocatable)

("Relocatable" means the directory can be moved with the GDB installation
tree, and GDB will still find it.)

GNU Readline library version: 8.2	(internal)
(gdb) ASUS_I006D:/ $ 


Details

The binaries are dynamically linked for the Android standard libraries only:

ASUS_I006D:/ $  LD_LIBRARY_PATH=/system/usr/gdb16_libs/ ldd /system/usr/bin/gdb
	linux-vdso.so.1 => [vdso] (0x7d04ab7000)
	libm.so => /apex/com.android.runtime/lib64/bionic/libm.so (0x7d03843000)
	libdl.so => /apex/com.android.runtime/lib64/bionic/libdl.so (0x7d01dd0000)
	libc.so => /apex/com.android.runtime/lib64/bionic/libc.so (0x7d00f00000)
ASUS_I006D:/ $ 


The executables are installed in /system/usr/bin. There is a symbolic link to a wrapper script for each executable in the directory /system/bin:

ASUS_I006D:/ $ ls -l /system/bin  | grep gdb16_wrapper                                                                                                                                          
lrwxrwxrwx 1 root root       24 1970-01-08 20:36 gcore -> ./gdb16_wrapper_template
lrwxrwxrwx 1 root root       24 1970-01-08 20:36 gdb -> ./gdb16_wrapper_template
lrwxrwxrwx 1 root root       24 1970-01-08 20:36 gdb-add-index -> ./gdb16_wrapper_template
-rwxr-xr-x 1 root root       82 2025-05-22 09:06 gdb16_wrapper_template
lrwxrwxrwx 1 root root       24 1970-01-08 20:36 gdbserver -> ./gdb16_wrapper_template
lrwxrwxrwx 1 root root       24 1970-01-08 20:36 gstack -> ./gdb16_wrapper_template
lrwxrwxrwx 1 root root       24 1970-01-08 20:36 run -> ./gdb16_wrapper_template
ASUS_I006D:/ $ 


There are also statically linked binaries in this Magisk Module.

The statically linked binaries are in the directory /system/usr/static_gdb.

ASUS_I006D:/ $ ls -hl /system/usr/static_gdb/
total 18K
-rwxr-xr-x 1 root root  12M 2025-09-18 14:34 gdb_16.3_static
-rwxr-xr-x 1 root root 2.0M 2025-09-18 14:34 gdbserver_16.3_static
-rwxr-xr-x 1 root root 3.3M 2025-09-18 14:34 run_16.3_static
ASUS_I006D:/ $ 


ASUS_I006D:/ $ file /system/usr/static_gdb/*
/system/usr/static_gdb/gdb_16.3_static:       ELF executable, 64-bit LSB arm64, static, for Android 28, built by NDK r27c (12479018), stripped
/system/usr/static_gdb/gdbserver_16.3_static: ELF executable, 64-bit LSB arm64, static, for Android 28, built by NDK r27c (12479018), stripped
/system/usr/static_gdb/run_16.3_static:       ELF executable, 64-bit LSB arm64, static, for Android 28, built by NDK r27c (12479018), stripped
ASUS_I006D:/ $ 


The statically linked binaries can also be used if the phone is booted into a recovery.



To compile gdb 16.3 with the clang from the Android NDK a patch for the file gdb/eintr.h is necessary. This patch is in the directory source in this Magisk Module:

eintr-wrapper.patch


History

22.05.2025 v1.0.0 /bs
  initial release

18.09.2025 v1.1.0 /bs
  added statically linked gdb binaries
  the dynamically linked binaries do not need the library libc++_shared.so anymore

    

