]> git.webhop.me Git - bs-cst-neutrino-hd.git/commitdiff
fix gdb for nevis
authorMarkham <markham001@gmx.de>
Sun, 8 Nov 2026 11:58:24 +0000 (12:58 +0100)
committerMarkham <markham001@gmx.de>
Sun, 8 Nov 2026 11:58:24 +0000 (12:58 +0100)
archive-patches/gdb/gdb-8.0.1-readline-wcwidth.patch [new file with mode: 0644]
make/applications.mk
make/versions.mk

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 (file)
index 0000000..7abb6e1
--- /dev/null
@@ -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 <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)
index 642368a3132aa0d15f720e8f98500c3b44f2548b..e186b4265dc3cf2eee050e9b2602758262b1468a 100755 (executable)
@@ -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 <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"; \
index 210a93cb8c8dde79c1222a435e92a177cafcc02e..f661332f054cfd20d70b06bc1371e7dbd56801b4 100644 (file)
@@ -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