Last active
December 22, 2015 00:29
-
-
Save auselen/6389994 to your computer and use it in GitHub Desktop.
Make kernel stack unwinding feature of ARM DS-5 Streamline's optional at run time instead of build time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gator-driver/gator_backtrace.c b/gator-driver/gator_backtrace.c | |
index 0670d6c..903e964 100644 | |
--- a/gator-driver/gator_backtrace.c | |
+++ b/gator-driver/gator_backtrace.c | |
@@ -130,17 +130,13 @@ static int report_trace(struct stackframe *frame, void *d) | |
} | |
#endif | |
-// Uncomment the following line to enable kernel stack unwinding within gator, note it can also be defined from the Makefile | |
-// #define GATOR_KERNEL_STACK_UNWINDING | |
static void kernel_backtrace(int cpu, struct pt_regs *const regs) | |
{ | |
#if defined(__arm__) || defined(__aarch64__) | |
-#ifdef GATOR_KERNEL_STACK_UNWINDING | |
- int depth = gator_backtrace_depth; | |
-#else | |
int depth = 1; | |
-#endif | |
struct stackframe frame; | |
+ if (kernel_stack_unwinding) | |
+ depth = gator_backtrace_depth; | |
if (depth == 0) | |
depth = 1; | |
#if defined(__arm__) | |
diff --git a/gator-driver/gator_main.c b/gator-driver/gator_main.c | |
index 46fe31d..76765b5 100644 | |
--- a/gator-driver/gator_main.c | |
+++ b/gator-driver/gator_main.c | |
@@ -1411,6 +1411,10 @@ static void __exit gator_module_exit(void) | |
gatorfs_unregister(); | |
} | |
+/* module parameter controlling kernel stack tracing */ | |
+bool kernel_stack_unwinding = 0; /* off by default */ | |
+module_param(kernel_stack_unwinding, bool, 0644); | |
+MODULE_PARM_DESC(kernel_stack_unwinding, "Allow gator to unwind kernel stack."); | |
module_init(gator_module_init); | |
module_exit(gator_module_exit); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment