diff --git a/srcpkgs/gdb/patches/gdb-76-linux-low-threaddb.patch b/srcpkgs/gdb/patches/gdb-76-linux-low-threaddb.patch new file mode 100644 index 0000000000..eb5bb744f7 --- /dev/null +++ b/srcpkgs/gdb/patches/gdb-76-linux-low-threaddb.patch @@ -0,0 +1,32 @@ +this patch fixes compilation of gdbserver on systems that don't have +thread_db.h. in that case we fall back to gdb's own copy +"gdb_thread_db.h", so the typedef of the td_thrhandle_t member is +available, which is accessed in other parts of the code without +checking whether thread_db.h is available. +this is by far the cleaner solution, removing the accesses to the +th member in other parts of the source would either litter it with +ifdefs or cripple the functionality. + +--- gdb-7.6.2.org/gdb/gdbserver/linux-low.h ++++ gdb-7.6.2/gdb/gdbserver/linux-low.h +@@ -18,6 +18,8 @@ + + #ifdef HAVE_THREAD_DB_H + #include ++#else ++#include "gdb_thread_db.h" + #endif + #include + +@@ -270,11 +272,9 @@ + int need_step_over; + + int thread_known; +-#ifdef HAVE_THREAD_DB_H + /* The thread handle, used for e.g. TLS access. Only valid if + THREAD_KNOWN is set. */ + td_thrhandle_t th; +-#endif + + /* Arch-specific additions. */ + struct arch_lwp_info *arch_private; diff --git a/srcpkgs/gdb/patches/gdb-76-pid_t.patch b/srcpkgs/gdb/patches/gdb-76-pid_t.patch new file mode 100644 index 0000000000..7ad3030c43 --- /dev/null +++ b/srcpkgs/gdb/patches/gdb-76-pid_t.patch @@ -0,0 +1,10 @@ +--- gdb-7.6.2.org/gdb/common/linux-ptrace.h ++++ gdb-7.6.2/gdb/common/linux-ptrace.h +@@ -67,6 +67,7 @@ + #define __WALL 0x40000000 /* Wait for any child. */ + #endif + ++#include /* for pid_t */ + extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer); + extern void linux_ptrace_init_warnings (void); + diff --git a/srcpkgs/gdb/patches/gdb-amd64-debugreg.patch b/srcpkgs/gdb/patches/gdb-amd64-debugreg.patch new file mode 100644 index 0000000000..e7d380ee18 --- /dev/null +++ b/srcpkgs/gdb/patches/gdb-amd64-debugreg.patch @@ -0,0 +1,64 @@ +diff -u -r -N gdb-7.3.1-org//gdb/amd64-linux-nat.c gdb-7.3.1-patched//gdb/amd64-linux-nat.c +--- gdb-7.3.1-org//gdb/amd64-linux-nat.c 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.3.1-patched//gdb/amd64-linux-nat.c 2011-09-22 22:20:23.438841813 +0000 +@@ -32,7 +32,7 @@ + #include "elf/common.h" + #include + #include +-#include ++#include "debugreg.h" + #include + #include + #include +diff -u -r -N gdb-7.3.1-org//gdb/debugreg.h gdb-7.3.1-patched//gdb/debugreg.h +--- gdb-7.3.1-org//gdb/debugreg.h 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.3.1-patched//gdb/debugreg.h 2011-09-22 22:20:01.381841813 +0000 +@@ -0,0 +1,48 @@ ++#ifndef SYS_DEBUGREG_H ++#define SYS_DEBUGREG_H ++ ++#include ++ ++#define DR_FIRSTADDR 0 ++#define DR_LASTADDR 3 ++ ++#define DR_STATUS 6 ++#define DR_CONTROL 7 ++ ++#define DR_TRAP0 (0x1) ++#define DR_TRAP1 (0x2) ++#define DR_TRAP2 (0x4) ++#define DR_TRAP3 (0x8) ++ ++#define DR_STEP (0x4000) ++#define DR_SWITCH (0x8000) ++ ++#define DR_CONTROL_SHIFT 16 ++#define DR_CONTROL_SIZE 4 ++ ++#define DR_RW_EXECUTE (0x0) ++#define DR_RW_WRITE (0x1) ++#define DR_RW_READ (0x3) ++ ++#define DR_LEN_1 (0x0) ++#define DR_LEN_2 (0x4) ++#define DR_LEN_4 (0xC) ++#define DR_LEN_8 (0x8) ++ ++#define DR_LOCAL_ENABLE_SHIFT 0 ++#define DR_GLOBAL_ENABLE_SHIFT 1 ++#define DR_ENABLE_SIZE 2 ++ ++#define DR_LOCAL_ENABLE_MASK (0x55) ++#define DR_GLOBAL_ENABLE_MASK (0xAA) ++ ++ ++#if SIZE_MAX > 4294967295 ++# define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00UL) ++#else ++# define DR_CONTROL_RESERVED (0x00FC00U) ++#endif ++#define DR_LOCAL_SLOWDOWN (0x100) ++#define DR_GLOBAL_SLOWDOWN (0x200) ++ ++#endif diff --git a/srcpkgs/gdb/patches/gdb-arm-gentmap.patch b/srcpkgs/gdb/patches/gdb-arm-gentmap.patch new file mode 100644 index 0000000000..5432bb3520 --- /dev/null +++ b/srcpkgs/gdb/patches/gdb-arm-gentmap.patch @@ -0,0 +1,10 @@ +--- gdb-7.4.org/sim/common/gentmap.c 2012-06-27 16:43:51.032331245 +0000 ++++ gdb-7.4/sim/common/gentmap.c 2012-06-27 16:49:12.382319996 +0000 +@@ -2,6 +2,7 @@ + + #include + #include ++#include + + struct tdefs { + char *symbol; diff --git a/srcpkgs/gdb/patches/gdb-linux_nat.patch b/srcpkgs/gdb/patches/gdb-linux_nat.patch new file mode 100644 index 0000000000..f91e16f2c3 --- /dev/null +++ b/srcpkgs/gdb/patches/gdb-linux_nat.patch @@ -0,0 +1,30 @@ +the first chunk fixes build errors, +the non_stop part below fixes thread debugging being available +by default without setting any breakpoints or usage of libthread_db. + +--- gdb-7.4.org/gdb/linux-nat.c 2013-08-10 05:24:24.651000003 +0000 ++++ gdb-7.4/gdb/linux-nat.c 2013-08-10 05:25:50.966000003 +0000 +@@ -71,6 +71,14 @@ + # endif + #endif /* HAVE_PERSONALITY */ + ++#ifndef __SIGRTMIN ++#define __SIGRTMIN SIGRTMIN ++#endif ++ ++#ifndef W_STOPCODE ++#define W_STOPCODE(sig) ((sig) << 8 | 0x7f) ++#endif ++ + /* This comment documents high-level logic of this file. + + Waiting for events in sync mode +@@ -2265,7 +2273,7 @@ + status = 0; + } + +- if (non_stop) ++ if (1) + { + /* Add the new thread to GDB's lists as soon as possible + so that: diff --git a/srcpkgs/gdb/patches/gdb-threaddb.patch b/srcpkgs/gdb/patches/gdb-threaddb.patch new file mode 100644 index 0000000000..2a2285ac8b --- /dev/null +++ b/srcpkgs/gdb/patches/gdb-threaddb.patch @@ -0,0 +1,36 @@ +--- gdb-7.4.org/gdb/common/gdb_thread_db.h ++++ gdb-7.4/gdb/common/gdb_thread_db.h +@@ -1,17 +1,5 @@ + #ifdef HAVE_THREAD_DB_H + #include +- +-#ifndef LIBTHREAD_DB_SO +-#define LIBTHREAD_DB_SO "libthread_db.so.1" +-#endif +- +-#ifndef LIBTHREAD_DB_SEARCH_PATH +-/* $sdir appears before $pdir for some minimal security protection: +- we trust the system libthread_db.so a bit more than some random +- libthread_db associated with whatever libpthread the app is using. */ +-#define LIBTHREAD_DB_SEARCH_PATH "$sdir:$pdir" +-#endif +- + #else + + /* Copyright (C) 1999-2000, 2007-2012 Free Software Foundation, Inc. +@@ -453,3 +441,15 @@ + #endif /* thread_db.h */ + + #endif /* HAVE_THREAD_DB_H */ ++ ++#ifndef LIBTHREAD_DB_SO ++#define LIBTHREAD_DB_SO "libthread_db.so.1" ++#endif ++ ++#ifndef LIBTHREAD_DB_SEARCH_PATH ++/* $sdir appears before $pdir for some minimal security protection: ++ we trust the system libthread_db.so a bit more than some random ++ libthread_db associated with whatever libpthread the app is using. */ ++#define LIBTHREAD_DB_SEARCH_PATH "$sdir:$pdir" ++#endif ++ diff --git a/srcpkgs/gdb/template b/srcpkgs/gdb/template index 9fb8ba8a48..23ad8a2294 100644 --- a/srcpkgs/gdb/template +++ b/srcpkgs/gdb/template @@ -1,9 +1,10 @@ # Template file for 'gdb' pkgname=gdb version=7.6.2 -revision=1 +revision=2 +patch_args="-Np1" build_style=gnu-configure -configure_args="--disable-nls --with-system-readline --with-system-gdbinit=/etc/gdb/gdbinit" +configure_args="--disable-werror --disable-nls --with-system-readline --with-system-gdbinit=/etc/gdb/gdbinit" makedepends="ncurses-devel zlib-devel readline-devel" conf_files="/etc/gdb/gdbinit" pycompile_dirs="usr/share/gdb/python/gdb"