Browse Source

musl/gdb: added sabotage patches and musl extra configs.

stable/0.6
Nagy Karoly Gabriel 11 years ago
parent
commit
3619010740
  1. 51
      base/musl/pkg/gdb/gdb-76-linux-low-threaddb.patch
  2. 28
      base/musl/pkg/gdb/gdb-76-pid_t.patch
  3. 83
      base/musl/pkg/gdb/gdb-amd64-debugreg.patch
  4. 49
      base/musl/pkg/gdb/gdb-linux_nat.patch
  5. 54
      base/musl/pkg/gdb/gdb-threaddb.patch
  6. 16
      base/musl/pkg/gdb/gdb.conf

51
base/musl/pkg/gdb/gdb-76-linux-low-threaddb.patch

@ -0,0 +1,51 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../musl/pkg/gdb/gdb-76-linux-low-threaddb.patch
# Copyright (C) 2014 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
This is a patch from sabotage-linux
https://github.com/sabotage-linux/sabotage/blob/master/KEEP/gdb-76-linux-low-threaddb.patch
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 <thread_db.h>
+#else
+#include "gdb_thread_db.h"
#endif
#include <signal.h>
@@ -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;

28
base/musl/pkg/gdb/gdb-76-pid_t.patch

@ -0,0 +1,28 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../musl/pkg/gdb/gdb-76-pid_t.patch
# Copyright (C) 2014 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
This is a patch from sabotage-linux
https://github.com/sabotage-linux/sabotage/blob/master/KEEP/gdb-76-pid_t.patch
--- 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 <unistd.h> /* for pid_t */
extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer);
extern void linux_ptrace_init_warnings (void);

83
base/musl/pkg/gdb/gdb-amd64-debugreg.patch

@ -0,0 +1,83 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../musl/pkg/gdb/gdb-amd64-debugreg.patch
# Copyright (C) 2014 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
This is a patch from sabotage-linux
https://raw.github.com/sabotage-linux/sabotage/master/KEEP/gdb-amd64-debugreg.patch
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 <sys/uio.h>
#include <sys/ptrace.h>
-#include <sys/debugreg.h>
+#include "debugreg.h"
#include <sys/syscall.h>
#include <sys/procfs.h>
#include <asm/prctl.h>
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 <stdint.h>
+
+#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

49
base/musl/pkg/gdb/gdb-linux_nat.patch

@ -0,0 +1,49 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../musl/pkg/gdb/gdb-linux_nat.patch
# Copyright (C) 2014 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
This is a patch from sabotage-linux
https://raw.github.com/sabotage-linux/sabotage/master/KEEP/gdb-linux_nat.patch
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:

54
base/musl/pkg/gdb/gdb-threaddb.patch

@ -0,0 +1,54 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../musl/pkg/gdb/gdb-threaddb.patch
# Copyright (C) 2014 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
This is a patch from sabotage-linux
https://github.com/sabotage-linux/sabotage/blob/master/KEEP/gdb-threaddb.patch
--- 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 <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
-
#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
+

16
base/musl/pkg/gdb/gdb.conf

@ -0,0 +1,16 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../musl/pkg/gdb/gdb.conf
# Copyright (C) 2014 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
var_append confopt ' ' "--disable-werror"
var_append confopt ' ' "--disable-tls"
Loading…
Cancel
Save