--- /dev/null
+--- gdb-8.0.1.orig/readline/complete.c 2026-11-08 12:50:14.713724704 +0100
++++ gdb-8.0.1/readline/complete.c 2026-11-08 12:50:14.764124707 +0100
+@@ -27,6 +27,8 @@
+
+ #include <sys/types.h>
+ #include <fcntl.h>
++#include <wchar.h>
++extern int wcwidth(wchar_t);
+ #if defined (HAVE_SYS_FILE_H)
+ # include <sys/file.h>
+ #endif
+--- gdb-8.0.1.orig/readline/display.c 2026-11-08 12:50:14.713724704 +0100
++++ gdb-8.0.1/readline/display.c 2026-11-08 12:50:14.767724708 +0100
+@@ -40,6 +40,8 @@
+ #endif /* HAVE_STDLIB_H */
+
+ #include <stdio.h>
++#include <wchar.h>
++extern int wcwidth(wchar_t);
+
+ #ifdef __MSDOS__
+ # include <pc.h>
+--- gdb-8.0.1.orig/readline/mbutil.c 2026-11-08 12:50:14.713724704 +0100
++++ gdb-8.0.1/readline/mbutil.c 2026-11-08 12:50:14.767724708 +0100
+@@ -44,6 +44,8 @@
+
+ /* System-specific feature definitions and include files. */
+ #include "rldefs.h"
++#include <wchar.h>
++extern int wcwidth(wchar_t);
+ #include "rlmbutil.h"
+
+ #if defined (TIOCSTAT_IN_SYS_IOCTL)
$(REMOVE)/hd-idle
$(TOUCH)
+# Test target: Create and compile a segfault test program for GDB debugging
+gdb_test:
+ @echo "Creating segfault test program..."
+ mkdir -p $(BUILD_TMP)/gdb-test
+ @printf '#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint crash_function(int *ptr) {\n printf("Accessing NULL pointer at %%p...\\n", ptr);\n *ptr = 42;\n return *ptr;\n}\n\nint main() {\n printf("Starting segfault test...\\n");\n int *null_ptr = NULL;\n crash_function(null_ptr);\n return 0;\n}\n' > $(BUILD_TMP)/gdb-test/test_segfault.c
+ @echo "Compiling test program..."
+ $(TARGET)-gcc -g -O0 -o $(BUILD_TMP)/gdb-test/test_crash $(BUILD_TMP)/gdb-test/test_segfault.c
+ @echo ""
+ @echo "✓ Test program created: $(BUILD_TMP)/gdb-test/test_crash"
+ @echo ""
+ @echo "To debug on box with GDB:"
+ @echo " ulimit -c unlimited"
+ @echo " /bin/gdb /tmp/test_crash"
+ @echo " (gdb) run"
+ @echo " (gdb) bt"
+ @echo " (gdb) quit"
+
# NOTE
# gdb-inline: inline version with platform-specific flags
+# Supports: nevis/2.6 (8.0.1), kronos/apollo/3.10 (8.3.1), hd5x/hd6x (8.0.1)
+# Patches: gdb-8.0.1-readline-wcwidth.patch (archive-patches/gdb/)
+# Adds wchar.h includes and wcwidth() declarations to readline files
+# (complete.c, display.c, mbutil.c) for GCC-14 compatibility.
+# Required to prevent "implicit declaration of function 'wcwidth'" errors.
$(D)/gdb-inline: $(D)/zlib $(D)/libncurses $(ARCHIVE)/gdb-$(GDB_VER).tar.xz | $(TARGETPREFIX)
$(START_BUILD)
$(REMOVE)/gdb-$(GDB_VER)
$(UNTAR)/gdb-$(GDB_VER).tar.xz
+ cd $(BUILD_TMP)/gdb-$(GDB_VER) && \
+ patch -p1 -i $(PATCHES)/gdb/gdb-8.0.1-readline-wcwidth.patch
set -e; cd $(BUILD_TMP)/gdb-$(GDB_VER); \
export PATH="$(BUILD_TMP):$(CROSS_DIR)/bin:$$PATH"; \
- export CFLAGS="$(STD_CFLAGS) $(TARGET_EXTRA_CFLAGS) -Wno-error=implicit-function-declaration"; \
- export CPPFLAGS="$(STD_CFLAGS) $(TARGET_EXTRA_CXXFLAGS) -Wno-error=implicit-function-declaration"; \
- export CXXFLAGS="$(STD_CFLAGS) $(TARGET_EXTRA_CXXFLAGS) -Wno-error=implicit-function-declaration"; \
+ export CFLAGS="$(STD_CFLAGS) $(TARGET_EXTRA_CFLAGS) -Wno-error -fcommon"; \
+ export CPPFLAGS="$(STD_CFLAGS) $(TARGET_EXTRA_CXXFLAGS) -Wno-error -fcommon"; \
+ export CXXFLAGS="$(STD_CFLAGS) $(TARGET_EXTRA_CXXFLAGS) -Wno-error -fcommon -fpermissive"; \
export LDFLAGS="$(TARGET_LDFLAGS) -Wno-error"; \
export ARFLAGS=cr; \
export PKG_CONFIG_PATH="$(TARGETPREFIX)/lib/pkgconfig:$(TARGETPREFIX)/usr/lib/pkgconfig"; \
GD_VER = 2.2.5
# GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it executes
-ifeq ($(BOXTYPE), coolstream)
-GDB_VER=7.12
+# Version selection based on kernel and platform compatibility
+# nevis (Kernel 2.6.34) → GDB 8.0.1 (2017, better C++17 compatibility than 7.x with GCC-14)
+# kronos/apollo (Kernel 3.10) → GDB 8.3.1 (stable, good C++ support)
+# hd5x/hd6x → GDB 10.2 (default, modern)
+ifeq ($(BOXFAMILY), nevis)
+ GDB_VER = 8.0.1
+else ifeq ($(BOXFAMILY), $(filter $(BOXFAMILY), kronos apollo))
+ GDB_VER = 8.3.1
else
-GDB_VER=8.0.1
+ GDB_VER = 10.2
endif
GETTEXT_VER = 0.19.8.1