systemtap/swbz12927.patch
2011-06-23 14:31:43 -04:00

73 lines
2.5 KiB
Diff

commit 0bbb80098decc9c4c43a1800538007d86b600bba
Author: Josh Stone <jistone@redhat.com>
Date: Tue Jun 7 11:23:13 2011 -0700
stapconf: Conditionalize stacktrace_ops.warning{,_symbol}
Kernel commit 449a66f removed these fields.
* buildrun.cxx: Include the new test.
* runtime/autoconf-stacktrace_ops-warning.c: Check the warning field.
* runtime/stack.c: Conditionalize the warning initialization.
diff --git a/buildrun.cxx b/buildrun.cxx
index 0bebc35..79f8818 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -215,6 +215,8 @@ compile_pass (systemtap_session& s)
output_autoconf(s, o, "autoconf-ring_buffer-flags.c", "STAPCONF_RING_BUFFER_FLAGS", NULL);
output_autoconf(s, o, "autoconf-kallsyms-on-each-symbol.c", "STAPCONF_KALLSYMS_ON_EACH_SYMBOL", NULL);
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-mm-context-vdso.c", "STAPCONF_MM_CONTEXT_VDSO", NULL);
output_autoconf(s, o, "autoconf-blk-types.c", "STAPCONF_BLK_TYPES", NULL);
output_autoconf(s, o, "autoconf-perf-structpid.c", "STAPCONF_PERF_STRUCTPID", NULL);
diff --git a/runtime/autoconf-stacktrace_ops-warning.c b/runtime/autoconf-stacktrace_ops-warning.c
new file mode 100644
index 0000000..9c00f05
--- /dev/null
+++ b/runtime/autoconf-stacktrace_ops-warning.c
@@ -0,0 +1,10 @@
+/* Some kernels have warning fields in stacktrace_ops. */
+#include <linux/sched.h>
+#include <asm/stacktrace.h>
+
+void foo (void)
+{
+ struct stacktrace_ops t;
+ t.warning = 0;
+ (void) t;
+}
diff --git a/runtime/stack.c b/runtime/stack.c
index 68a7e4f..b2d5d1d 100644
--- a/runtime/stack.c
+++ b/runtime/stack.c
@@ -73,6 +73,7 @@ struct print_stack_data
int level;
};
+#if defined(STAPCONF_STACKTRACE_OPS_WARNING)
static void print_stack_warning(void *data, char *msg)
{
}
@@ -81,6 +82,7 @@ static void
print_stack_warning_symbol(void *data, char *msg, unsigned long symbol)
{
}
+#endif
static int print_stack_stack(void *data, char *name)
{
@@ -95,8 +97,10 @@ static void print_stack_address(void *data, unsigned long addr, int reliable)
}
static const struct stacktrace_ops print_stack_ops = {
+#if defined(STAPCONF_STACKTRACE_OPS_WARNING)
.warning = print_stack_warning,
.warning_symbol = print_stack_warning_symbol,
+#endif
.stack = print_stack_stack,
.address = print_stack_address,
#if defined(STAPCONF_WALK_STACK)