From: Markham Date: Sun, 8 Nov 2026 11:58:24 +0000 (+0100) Subject: fix gdb for nevis X-Git-Url: https://git.webhop.me/?a=commitdiff_plain;h=bdbf46b8ee06b732e94375e9125d548a7a6be1b7;p=bs-cst-neutrino-hd.git fix gdb for nevis --- diff --git a/archive-patches/gdb/gdb-8.0.1-readline-wcwidth.patch b/archive-patches/gdb/gdb-8.0.1-readline-wcwidth.patch new file mode 100644 index 0000000..7abb6e1 --- /dev/null +++ b/archive-patches/gdb/gdb-8.0.1-readline-wcwidth.patch @@ -0,0 +1,33 @@ +--- 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 + #include ++#include ++extern int wcwidth(wchar_t); + #if defined (HAVE_SYS_FILE_H) + # include + #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 ++#include ++extern int wcwidth(wchar_t); + + #ifdef __MSDOS__ + # include +--- 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 ++extern int wcwidth(wchar_t); + #include "rlmbutil.h" + + #if defined (TIOCSTAT_IN_SYS_IOCTL) diff --git a/make/applications.mk b/make/applications.mk index 642368a..e186b42 100755 --- a/make/applications.mk +++ b/make/applications.mk @@ -440,17 +440,41 @@ $(D)/hd-idle: $(ARCHIVE)/hd-idle-$(HD_IDLE_VER).tgz | $(TARGETPREFIX) $(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 \n#include \n#include \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"; \ diff --git a/make/versions.mk b/make/versions.mk index 210a93c..f661332 100644 --- a/make/versions.mk +++ b/make/versions.mk @@ -41,10 +41,16 @@ DROPBEAR_VER=2026.92 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