summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--buildrun.cxx2
-rw-r--r--runtime/autoconf-save-stack-trace.c22
-rw-r--r--runtime/stack-i386.c2
-rw-r--r--runtime/stack-x86_64.c2
-rw-r--r--runtime/stack.c7
5 files changed, 29 insertions, 6 deletions
diff --git a/buildrun.cxx b/buildrun.cxx
index fe060236..973343cd 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -153,6 +153,8 @@ compile_pass (systemtap_session& s)
* this autoconf. */
output_autoconf(s, o, "autoconf-probe-kernel.c", "STAPCONF_PROBE_KERNEL", NULL);
#endif
+ output_autoconf(s, o, "autoconf-save-stack-trace.c",
+ "STAPCONF_KERNEL_STACKTRACE", NULL);
o << module_cflags << " += -include $(STAPCONF_HEADER)" << endl;
diff --git a/runtime/autoconf-save-stack-trace.c b/runtime/autoconf-save-stack-trace.c
new file mode 100644
index 00000000..39ded684
--- /dev/null
+++ b/runtime/autoconf-save-stack-trace.c
@@ -0,0 +1,22 @@
+#include <linux/string.h>
+#include <linux/sched.h>
+#include <linux/stacktrace.h>
+#include <asm/stacktrace.h>
+
+void foo(struct task_struct *foo)
+{
+ struct stack_trace trace;
+ unsigned long backtrace[20];
+ memset(&trace, 0, sizeof(trace));
+ trace.entries = &backtrace[0];
+ trace.max_entries = 20;
+ trace.skip = 0;
+ save_stack_trace_tsk(tsk, &trace);
+}
+
+static const struct stacktrace_ops print_stack_ops;
+
+void dumper(struct task_struct *foo)
+{
+ dump_trace(foo, 0, 0, 0, &print_stack_ops, 0);
+}
diff --git a/runtime/stack-i386.c b/runtime/stack-i386.c
index 206801d8..5a18c9d8 100644
--- a/runtime/stack-i386.c
+++ b/runtime/stack-i386.c
@@ -14,7 +14,7 @@ static int _stp_valid_stack_ptr(unsigned long context, unsigned long p)
}
/* DWARF unwinder failed. Just dump intereting addresses on kernel stack. */
-#if ! (defined(CONFIG_STACKTRACE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26))
+#if !defined(STAPCONF_KERNEL_STACKTRACE)
static void _stp_stack_print_fallback(unsigned long stack, int verbose, int levels)
{
unsigned long addr;
diff --git a/runtime/stack-x86_64.c b/runtime/stack-x86_64.c
index 183de0a0..03d88ef0 100644
--- a/runtime/stack-x86_64.c
+++ b/runtime/stack-x86_64.c
@@ -10,7 +10,7 @@
/* DWARF unwinder failed. Just dump intereting addresses on kernel stack. */
-#if ! (defined(CONFIG_STACKTRACE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26))
+#if !defined(STAPCONF_KERNEL_STACKTRACE)
static void _stp_stack_print_fallback(unsigned long stack, int verbose, int levels)
{
unsigned long addr;
diff --git a/runtime/stack.c b/runtime/stack.c
index aa0e6d65..f6b1cd08 100644
--- a/runtime/stack.c
+++ b/runtime/stack.c
@@ -27,8 +27,7 @@
#define MAXBACKTRACE 20
-#if defined(CONFIG_STACKTRACE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
-// XXX: PR9866: hacky temporarily restriction to recent kernels
+#if defined(STAPCONF_KERNEL_STACKTRACE)
#include <linux/stacktrace.h>
#include <asm/stacktrace.h>
#endif
@@ -51,7 +50,7 @@ static void _stp_stack_print_fallback(unsigned long, int, int);
#error "Unsupported architecture"
#endif
-#if defined(CONFIG_STACKTRACE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
+#if defined(STAPCONF_KERNEL_STACKTRACE)
struct print_stack_data
{
@@ -161,7 +160,7 @@ static void _stp_ustack_print(char *str)
void _stp_stack_print_tsk(struct task_struct *tsk, int verbose, int levels)
{
-#if defined(CONFIG_STACKTRACE) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
+#if defined(STAPCONF_KERNEL_STACKTRACE)
int i;
unsigned long backtrace[MAXBACKTRACE];
struct stack_trace trace;