Dave
Attaching the patches that we have developed till now.
We have tried to accommodate your suggestions regarding Makefiles in
this patches.
We have tried to provide unwinding support in ppc64, x86_64 and x86
architecture. The feature is tested on ppc64 with dumps taken through
panic and echo c > /proc/sysrq-trigger. We have observed that many times
the variable information is optimized out and accessing variable
information is not possible (volatile variables are shown correctly),
IMHO this behavior is similar to that shown by gdb, please spare your
thoughts on this
This implementation works reasonably on ppc64, we were able to unwind
to stack and get variable information.
But we are still facing problem with x86 and x86_64 architecture, Our
generic implementation for stack unwinding using dwarf is not succeeding
, since frame pointer is optimized out by default. IMHO stack unwinding
as talked about in ABI's is not valid for the same reason. But if you
enable CONFIG_FRAME_POINTER in kernel, then unwinding using bp will be
possible.
Please let me know your thoughts in general
Here I am attaching 3 patches
1. Display-local-variables-and-function-parameters.patch
Provides feature to print local variables and arguments in the current
stack frame using dwarf information.
2. Provide-stack-unwinding-feature.patch
Provides option to unwind the stack, using dwarf information, works on
ppc64
3. unwind_x86_64.patch
provides unwinding feature in x86_64 with out using dwarf information
but requires CONFIG_FRAME_POINTER to be enabled
Note: It is tested on elfutils-0.137 and above
Thank you
Sharyathi Nagesh
Show replies by date
Index: crash-4.0-8.9/extensions/local.c
===================================================================
--- crash-4.0-8.9.orig/extensions/local.c 2009-05-25 07:43:59.000000000 +0530
+++ crash-4.0-8.9/extensions/local.c 2009-05-25 08:23:29.000000000 +0530
@@ -54,6 +54,7 @@
static ulong fetch_register_x86_64(int reg);
static int assign_register_x86_64(int reg, ulong value);
static int display_registers_x86_64(void);
+static int unwind_x86_64();
/* Dwarf routines */
static void print_function_variables();
@@ -333,7 +334,11 @@
{
case STACK_UNWIND_UP:
local->flags = STACK_UNWIND_UP;
- unwind_dw_up(local->pc);
+ #ifdef X86_64
+ unwind_x86_64();
+ #elif PPC64
+ unwind_dw_up(locddal->pc);
+ #endif
break;
case STACK_UNWIND_DOWN:
local->flags = STACK_UNWIND_DOWN;
@@ -361,6 +366,19 @@
}
}
+static int
+unwind_x86_64()
+{
+ ulong rbp;
+ struct pt_regs_x86_64 *pt_regs;
+ pt_regs = (struct pt_regs_x86_64 *)local->regs;
+ rbp = pt_regs->bp;
+ pt_regs->sp = rbp + 2*sizeof(ulong);
+ read_vmcore(rbp + sizeof(ulong), sizeof(ulong), &pt_regs->ip);
+ read_vmcore(rbp, sizeof(ulong), &pt_regs->bp);
+ local->pc = pt_regs->ip;
+ return 0;
+}
static int
str_to_option(char *str)
{