TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/gdb/
TERMUX_PKG_DESCRIPTION="The standard GNU Debugger that runs on many Unix-like systems and works for many programming languages"
-TERMUX_PKG_DEPENDS="liblzma, libexpat, readline, ncurses"
-TERMUX_PKG_VERSION=8.0.1
-TERMUX_PKG_REVISION=1
+TERMUX_PKG_DEPENDS="liblzma, libexpat, readline, ncurses, libmpfr"
+TERMUX_PKG_VERSION=8.1
+TERMUX_PKG_SHA256=af61a0263858e69c5dce51eab26662ff3d2ad9aa68da9583e8143b5426be4b34
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/gdb/gdb-${TERMUX_PKG_VERSION}.tar.xz
-TERMUX_PKG_SHA256=3dbd5f93e36ba2815ad0efab030dcd0c7b211d7b353a40a53f4c02d7d56295e3
+TERMUX_PKG_API_LEVEL=23
# gdb can not build with our normal --disable-static: https://sourceware.org/bugzilla/show_bug.cgi?id=15916
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--with-system-readline
export gl_cv_func_memchr_works=yes
export gl_cv_func_stat_file_slash=yes
export gl_cv_func_frexp_no_libm=no
+ export gl_cv_func_strerror_0_works=yes
+ export gl_cv_func_working_strerror=yes
+ export gl_cv_func_getcwd_path_max=yes
}
+++ /dev/null
-diff -u -r ../gdb-7.6.2/gdb/fork-child.c ./gdb/fork-child.c
---- ../gdb-7.6.2/gdb/fork-child.c 2013-12-08 05:33:13.000000000 +0100
-+++ ./gdb/fork-child.c 2014-01-07 16:43:01.862311352 +0100
-@@ -36,7 +36,7 @@
- #include <signal.h>
-
- /* This just gets used as a default if we can't find SHELL. */
--#define SHELL_FILE "/bin/sh"
-+#define SHELL_FILE "@TERMUX_PREFIX@/bin/sh"
-
- extern char **environ;
--- /dev/null
+diff -u -r ../gdb-8.1/gdb/common/job-control.c ./gdb/common/job-control.c
+--- ../gdb-8.1/gdb/common/job-control.c 2018-01-05 05:07:23.000000000 +0100
++++ ./gdb/common/job-control.c 2018-02-01 21:19:44.732858138 +0100
+@@ -45,10 +45,7 @@
+ if (job_control)
+ {
+ #ifdef HAVE_SETPGID
+- /* The call setpgid (0, 0) is supposed to work and mean the same
+- thing as this, but on Ultrix 4.2A it fails with EPERM (and
+- setpgid (getpid (), getpid ()) succeeds). */
+- retval = setpgid (getpid (), getpid ());
++ retval = setpgid (0, 0);
+ #else
+ #ifdef HAVE_SETPGRP
+ #ifdef SETPGRP_VOID
-On Android signal handlers are setup by the linker (through debuggerd_client):
-https://github.com/android/platform_system_core/blob/6fff551728f75e35b69bd59f2bc722a72d5c6d61/debuggerd/client/debuggerd_client.cpp#L290
-
-diff -u -r ../gdb-7.12/gdb/common/signals-state-save-restore.c ./gdb/common/signals-state-save-restore.c
---- ../gdb-7.12/gdb/common/signals-state-save-restore.c 2016-10-07 13:04:17.000000000 -0400
-+++ ./gdb/common/signals-state-save-restore.c 2016-10-09 18:39:27.866619885 -0400
-@@ -58,10 +58,12 @@
- else if (res == -1)
- perror_with_name (("sigaction"));
-
+diff -u -r ../gdb-8.1/gdb/common/signals-state-save-restore.c ./gdb/common/signals-state-save-restore.c
+--- ../gdb-8.1/gdb/common/signals-state-save-restore.c 2018-01-31 03:58:50.000000000 +0100
++++ ./gdb/common/signals-state-save-restore.c 2018-02-01 21:38:47.791540495 +0100
+@@ -69,6 +69,7 @@
+ && oldact->sa_handler != SIG_DFL
+ && oldact->sa_handler != SIG_IGN)
+ {
+#ifndef __ANDROID__
- /* If we find a custom signal handler already installed, then
- this function was called too late. */
- if (oldact->sa_handler != SIG_DFL && oldact->sa_handler != SIG_IGN)
- internal_error (__FILE__, __LINE__, _("unexpected signal handler"));
+ found_preinstalled = true;
+
+ /* Use raw fprintf here because we're being called in early
+@@ -78,6 +79,7 @@
+ _("warning: Found custom handler for signal "
+ "%d (%s) preinstalled.\n"), i,
+ strsignal (i));
+#endif
+ }
}
- #endif
- }
+
+++ /dev/null
-diff -u -r ../gdb-7.10.1/gdb/inflow.c ./gdb/inflow.c
---- ../gdb-7.10.1/gdb/inflow.c 2015-12-05 10:16:45.000000000 -0500
-+++ ./gdb/inflow.c 2016-02-07 19:28:38.979181296 -0500
-@@ -862,10 +862,10 @@
- {
- #if defined (HAVE_TERMIOS) || defined (TIOCGPGRP)
- #ifdef HAVE_SETPGID
-- /* The call setpgid (0, 0) is supposed to work and mean the same
-- thing as this, but on Ultrix 4.2A it fails with EPERM (and
-- setpgid (getpid (), getpid ()) succeeds). */
-- retval = setpgid (getpid (), getpid ());
-+ /* Termux change: setpgid(getpid(), getpid()), which is used upstream
-+ for working around Ultrix 4.2A issue, does not work on Android but
-+ fails with ESRCH. So revert back to simple setpgid(0,0). */
-+ retval = setpgid (0, 0);
- #else
- #ifdef HAVE_SETPGRP
- #ifdef SETPGRP_VOID
--- /dev/null
+diff -u -r ../gdb-8.1/gdb/nat/fork-inferior.c ./gdb/nat/fork-inferior.c
+--- ../gdb-8.1/gdb/nat/fork-inferior.c 2018-01-05 05:07:23.000000000 +0100
++++ ./gdb/nat/fork-inferior.c 2018-02-01 21:49:06.148349274 +0100
+@@ -32,7 +32,7 @@
+
+ /* Default shell file to be used if 'startup-with-shell' is set but
+ $SHELL is not. */
+-#define SHELL_FILE "/bin/sh"
++#define SHELL_FILE "@TERMUX_PREFIX@/bin/sh"
+
+ /* Build the argument vector for execv(3). */
+
--- /dev/null
+diff -u -r ../gdb-8.1/gdb/ser-pipe.c ./gdb/ser-pipe.c
+--- ../gdb-8.1/gdb/ser-pipe.c 2018-01-05 04:07:23.000000000 +0000
++++ ./gdb/ser-pipe.c 2018-01-31 22:21:26.902931647 +0000
+@@ -122,7 +122,7 @@
+ }
+
+ close_most_fds ();
+- execl ("/bin/sh", "sh", "-c", name, (char *) 0);
++ execl ("@TERMUX_PREFIX@/bin/sh", "sh", "-c", name, (char *) 0);
+ _exit (127);
+ }
+