81 lines
3 KiB
Diff
81 lines
3 KiB
Diff
From 15de83a3b4b298ea8fa5f86083017d062393c0db Mon Sep 17 00:00:00 2001
|
|
From: David Smith <dsmith@redhat.com>
|
|
Date: Fri, 27 May 2016 11:19:03 -0500
|
|
Subject: [PATCH] Fix PR20158 by updating the runtime for the 4.6 kernel.
|
|
|
|
* buildrun.cxx (compile_pass): Added autoconf-stacktrace_ops-int-address.c
|
|
compile test.
|
|
* stack.c: (print_stack_address): If STAPCONF_STACKTRACE_OPS_INT_ADDRESS
|
|
is defined, the function returns a int instead of being a void
|
|
function.
|
|
* runtime/linux/autoconf-stacktrace_ops-int-address.c: New autoconf-style
|
|
test.
|
|
---
|
|
buildrun.cxx | 2 ++
|
|
runtime/linux/autoconf-stacktrace_ops-int-address.c | 14 ++++++++++++++
|
|
runtime/stack.c | 7 +++++++
|
|
3 files changed, 23 insertions(+)
|
|
create mode 100644 runtime/linux/autoconf-stacktrace_ops-int-address.c
|
|
|
|
diff --git a/buildrun.cxx b/buildrun.cxx
|
|
index 27e2be6a2dc3..7c68ba03e025 100644
|
|
--- a/buildrun.cxx
|
|
+++ b/buildrun.cxx
|
|
@@ -371,6 +371,8 @@ compile_pass (systemtap_session& s)
|
|
output_autoconf(s, o, "autoconf-walk-stack.c", "STAPCONF_WALK_STACK", NULL);
|
|
output_autoconf(s, o, "autoconf-stacktrace_ops-warning.c",
|
|
"STAPCONF_STACKTRACE_OPS_WARNING", NULL);
|
|
+ output_autoconf(s, o, "autoconf-stacktrace_ops-int-address.c",
|
|
+ "STAPCONF_STACKTRACE_OPS_INT_ADDRESS", NULL);
|
|
output_autoconf(s, o, "autoconf-mm-context-vdso.c", "STAPCONF_MM_CONTEXT_VDSO", NULL);
|
|
output_autoconf(s, o, "autoconf-mm-context-vdso-base.c", "STAPCONF_MM_CONTEXT_VDSO_BASE", NULL);
|
|
output_autoconf(s, o, "autoconf-blk-types.c", "STAPCONF_BLK_TYPES", NULL);
|
|
diff --git a/runtime/linux/autoconf-stacktrace_ops-int-address.c b/runtime/linux/autoconf-stacktrace_ops-int-address.c
|
|
new file mode 100644
|
|
index 000000000000..8ca277a6e1c3
|
|
--- /dev/null
|
|
+++ b/runtime/linux/autoconf-stacktrace_ops-int-address.c
|
|
@@ -0,0 +1,14 @@
|
|
+#include <linux/sched.h>
|
|
+#include <asm/stacktrace.h>
|
|
+
|
|
+// check for 4.6 patch which changed the function signature of
|
|
+// stacktrace_ops 'address' member.
|
|
+
|
|
+int print_stack_address(void *data __attribute__ ((unused)),
|
|
+ unsigned long addr __attribute__ ((unused)),
|
|
+ int reliable __attribute__ ((unused)))
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+struct stacktrace_ops ops __attribute__ ((unused)) = {.address=print_stack_address};
|
|
diff --git a/runtime/stack.c b/runtime/stack.c
|
|
index a7d03db722d5..a99bad062382 100644
|
|
--- a/runtime/stack.c
|
|
+++ b/runtime/stack.c
|
|
@@ -111,7 +111,11 @@ static int print_stack_stack(void *data, char *name)
|
|
return -1;
|
|
}
|
|
|
|
+#ifdef STAPCONF_STACKTRACE_OPS_INT_ADDRESS
|
|
+static int print_stack_address(void *data, unsigned long addr, int reliable)
|
|
+#else
|
|
static void print_stack_address(void *data, unsigned long addr, int reliable)
|
|
+#endif
|
|
{
|
|
struct print_stack_data *sdata = data;
|
|
if (sdata->skip > 0)
|
|
@@ -122,6 +126,9 @@ static void print_stack_address(void *data, unsigned long addr, int reliable)
|
|
NULL);
|
|
sdata->levels--;
|
|
}
|
|
+#ifdef STAPCONF_STACKTRACE_OPS_INT_ADDRESS
|
|
+ return 0;
|
|
+#endif
|
|
}
|
|
|
|
static const struct stacktrace_ops print_stack_ops = {
|
|
--
|
|
2.8.1
|
|
|