From f37008e205b4472fefc485a87c9473d39f449bce Mon Sep 17 00:00:00 2001 From: Dave Anderson Date: Fri, 14 Oct 2016 14:53:38 -0400 Subject: [PATCH] Workaround glibc declaration of ps_get_thread_area in nptl_db/proc_service.h until it gets updated in the Fedora build. --- crash.spec | 2 + glibc_ps_get_thread_area_workaround.patch | 61 +++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 glibc_ps_get_thread_area_workaround.patch diff --git a/crash.spec b/crash.spec index a56494b..e091216 100644 --- a/crash.spec +++ b/crash.spec @@ -18,6 +18,7 @@ Provides: bundled(libiberty) Provides: bundled(gdb) = 7.6 Patch0: lzo_snappy.patch Patch1: use_system_readline_v3.patch +Patch2: glibc_ps_get_thread_area_workaround.patch %description The core analysis suite is a self-contained tool that can be used to @@ -40,6 +41,7 @@ offered by Mission Critical Linux, or the LKCD kernel patch. %setup -n %{name}-%{version} -q %patch0 -p1 -b lzo_snappy.patch %patch1 -p1 -b use_system_readline_v3.patch +%patch2 -p1 -b glibc_ps_get_thread_area_workaround.patch %build make RPMPKG="%{version}-%{release}" CFLAGS="%{optflags}" diff --git a/glibc_ps_get_thread_area_workaround.patch b/glibc_ps_get_thread_area_workaround.patch new file mode 100644 index 0000000..3c22f8f --- /dev/null +++ b/glibc_ps_get_thread_area_workaround.patch @@ -0,0 +1,61 @@ +--- crash-7.1.6/gdb-7.6.patch.orig ++++ crash-7.1.6/gdb-7.6.patch +@@ -2299,3 +2299,58 @@ diff -up gdb-7.6/bfd/elf64-ppc.c.orig gd + + do_cleanups (old_chain); + } ++--- gdb-7.6/gdb/gdb_proc_service.h.orig +++++ gdb-7.6/gdb/gdb_proc_service.h ++@@ -115,7 +115,7 @@ extern pid_t ps_getpid (struct ps_procha ++ /* Fetch the special per-thread address associated with the given LWP. ++ This call is only used on a few platforms (most use a normal register). ++ The meaning of the `int' parameter is machine-dependent. */ ++-extern ps_err_e ps_get_thread_area (const struct ps_prochandle *, +++extern ps_err_e ps_get_thread_area (struct ps_prochandle *, ++ lwpid_t, int, psaddr_t *); ++ ++ ++--- gdb-7.6/gdb/amd64-linux-nat.c.orig +++++ gdb-7.6/gdb/amd64-linux-nat.c ++@@ -493,7 +493,7 @@ amd64_linux_new_fork (struct lwp_info *p ++ a request for a thread's local storage address. */ ++ ++ ps_err_e ++-ps_get_thread_area (const struct ps_prochandle *ph, +++ps_get_thread_area (struct ps_prochandle *ph, ++ lwpid_t lwpid, int idx, void **base) ++ { ++ if (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 32) ++--- gdb-7.6/gdb/aarch64-linux-nat.c.orig +++++ gdb-7.6/gdb/aarch64-linux-nat.c ++@@ -750,7 +750,7 @@ aarch64_linux_new_fork (struct lwp_info ++ storage (or its descriptor). */ ++ ++ ps_err_e ++-ps_get_thread_area (const struct ps_prochandle *ph, +++ps_get_thread_area (struct ps_prochandle *ph, ++ lwpid_t lwpid, int idx, void **base) ++ { ++ struct iovec iovec; ++--- gdb-7.6/gdb/arm-linux-nat.c.orig +++++ gdb-7.6/gdb/arm-linux-nat.c ++@@ -613,7 +613,7 @@ supply_fpregset (struct regcache *regcac ++ /* Fetch the thread-local storage pointer for libthread_db. */ ++ ++ ps_err_e ++-ps_get_thread_area (const struct ps_prochandle *ph, +++ps_get_thread_area (struct ps_prochandle *ph, ++ lwpid_t lwpid, int idx, void **base) ++ { ++ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0) ++--- gdb-7.6/gdb/i386-linux-nat.c.orig +++++ gdb-7.6/gdb/i386-linux-nat.c ++@@ -849,7 +849,7 @@ i386_linux_new_fork (struct lwp_info *pa ++ storage (or its descriptor). */ ++ ++ ps_err_e ++-ps_get_thread_area (const struct ps_prochandle *ph, +++ps_get_thread_area (struct ps_prochandle *ph, ++ lwpid_t lwpid, int idx, void **base) ++ { ++ /* NOTE: cagney/2003-08-26: The definition of this buffer is found