From c265cd259a82542abf290a6aeb058056d6c18b73 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 3 Jun 2010 11:26:17 +0200 Subject: [PATCH] Replace walk_stack field version guard with autoconf test. The test for whether or not to assign print_context_stack to the walk_stack stacktrace_ops field depended on the kernel version. Replace with a proper runtime/autoconf test to make sure the field always gets assigned when available. * buildrun.cxx (compile_pass): Add output for STAP_CONF_WALK_STACK. * runtime/autoconf-walk-stack.c: New test. * runtime/stack.c (print_stack_ops): Assign walk_stack field print_context_stack depending on STAP_CONF_WALK_STACK. --- buildrun.cxx | 1 + runtime/autoconf-walk-stack.c | 9 +++++++++ runtime/stack.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 runtime/autoconf-walk-stack.c diff --git a/buildrun.cxx b/buildrun.cxx index 79bf54876..4d4e2358a 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -195,6 +195,7 @@ compile_pass (systemtap_session& s) "STAPCONF_ASM_SYSCALL_H", NULL); 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); o << module_cflags << " += -include $(STAPCONF_HEADER)" << endl; diff --git a/runtime/autoconf-walk-stack.c b/runtime/autoconf-walk-stack.c new file mode 100644 index 000000000..0583d656e --- /dev/null +++ b/runtime/autoconf-walk-stack.c @@ -0,0 +1,9 @@ +/* Some kernels have an extra stacktrace_ops field walk_stack. */ +#include +#include + +void foo (void) +{ + struct stacktrace_ops t; + t.walk_stack = print_context_stack; +} diff --git a/runtime/stack.c b/runtime/stack.c index 0e80e2cef..12be5d6e7 100644 --- a/runtime/stack.c +++ b/runtime/stack.c @@ -99,7 +99,7 @@ static const struct stacktrace_ops print_stack_ops = { .warning_symbol = print_stack_warning_symbol, .stack = print_stack_stack, .address = print_stack_address, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +#if defined(STAPCONF_WALK_STACK) .walk_stack = print_context_stack, #endif }; -- 2.43.5