summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>2008-03-30 19:47:51 -0400
committerMartin Hunt <hunt@redhat.com>2008-03-30 19:47:51 -0400
commit20d2c2c26b42b27a4881a46364a33330b2a6ea31 (patch)
tree8c2c94a65276d7815314eea72fa6ac30964c4cf1 /runtime
parent6567250495117bfa4eb8b58c805897133c0d3ff2 (diff)
downloadsystemtap-steved-20d2c2c26b42b27a4881a46364a33330b2a6ea31.tar.gz
systemtap-steved-20d2c2c26b42b27a4881a46364a33330b2a6ea31.tar.xz
systemtap-steved-20d2c2c26b42b27a4881a46364a33330b2a6ea31.zip
Support for kernels built with CONFIG_FRAME_POINTER
Diffstat (limited to 'runtime')
-rw-r--r--runtime/ChangeLog9
-rw-r--r--runtime/copy.c2
-rw-r--r--runtime/runtime.h7
-rw-r--r--runtime/stack-arm.c4
-rw-r--r--runtime/stack-i386.c4
-rw-r--r--runtime/transport/ChangeLog5
-rw-r--r--runtime/transport/symbols.c5
-rw-r--r--runtime/transport/transport.c2
-rw-r--r--runtime/unwind/i386.h2
-rw-r--r--runtime/unwind/x86_64.h5
10 files changed, 36 insertions, 9 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index d9ea4474..7c6dbbea 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,12 @@
+2008-03-30 Martin Hunt <hunt@redhat.com>
+
+ * runtime.h (STP_USE_FRAME_POINTER): Define when frame pointers
+ are available in the kernel and can be used.
+ * stack-arm.c: Use STP_USE_FRAME_POINTER.
+ * stack-i386.c: Ditto.
+ * unwind/i386.h: Ditto.
+ * unwind/x86_64.h: Ditto.
+
2008-03-28 Martin Hunt <hunt@redhat.com>
* copy.c (_stp_read_address): New function. Safely read
diff --git a/runtime/copy.c b/runtime/copy.c
index 8891f171..6bb22762 100644
--- a/runtime/copy.c
+++ b/runtime/copy.c
@@ -1,6 +1,6 @@
/* -*- linux-c -*-
* Copy from user space functions
- * Copyright (C) 2005, 2006, 2007 Red Hat Inc.
+ * Copyright (C) 2005-2008 Red Hat Inc.
* Copyright (C) 2005 Intel Corporation.
*
* This file is part of systemtap, and is free software. You can
diff --git a/runtime/runtime.h b/runtime/runtime.h
index b9a9c778..6d8d9dc9 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -70,6 +70,13 @@ static struct
#define MAXSTRINGLEN 128
#endif
+#ifdef CONFIG_FRAME_POINTER
+/* Just because frame pointers are available does not mean we can trust them. */
+#if defined (__i386__) || defined (__arm__)
+#define STP_USE_FRAME_POINTER
+#endif
+#endif
+
#include "alloc.c"
#include "print.c"
#include "string.c"
diff --git a/runtime/stack-arm.c b/runtime/stack-arm.c
index 0c8ce450..9b0b772d 100644
--- a/runtime/stack-arm.c
+++ b/runtime/stack-arm.c
@@ -33,7 +33,7 @@ static int __init find_str_pc_offset(void)
static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels)
{
-#if defined(CONFIG_FRAME_POINTER)
+#ifdef STP_USE_FRAME_POINTER
int pc_offset = find_str_pc_offset();
unsigned long *fp = (unsigned long *)regs->ARM_fp;
unsigned long *next_fp, *pc;
@@ -68,5 +68,5 @@ static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels)
fp = next_fp;
}
-#endif
+#endif /* STP_USE_FRAME_POINTER */
}
diff --git a/runtime/stack-i386.c b/runtime/stack-i386.c
index 11919b29..20c8eda5 100644
--- a/runtime/stack-i386.c
+++ b/runtime/stack-i386.c
@@ -32,7 +32,7 @@ static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels)
unsigned long *stack = (unsigned long *)&REG_SP(regs);
unsigned long context = (unsigned long)stack & ~(THREAD_SIZE - 1);
-#ifdef CONFIG_FRAME_POINTER
+#ifdef STP_USE_FRAME_POINTER
/* FIXME: need to use _stp_func_print() and safe copy */
unsigned long addr;
@@ -72,5 +72,5 @@ static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels)
_stp_stack_print_fallback(context, UNW_SP(&info), verbose);
break;
}
-#endif /* CONFIG_FRAME_POINTER */
+#endif /* STP_USE_FRAME_POINTER */
}
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog
index 2db40a12..b55657e9 100644
--- a/runtime/transport/ChangeLog
+++ b/runtime/transport/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-30 Martin Hunt <hunt@redhat.com>
+
+ * symbols.c (_stp_init_modules): If using frames, don't
+ request unwind info.
+
2008-03-25 Martin Hunt <hunt@redhat.com>
* control.c (_stp_ctl_write_dbug): Insert missing break.
diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c
index 83a3a635..118d5693 100644
--- a/runtime/transport/symbols.c
+++ b/runtime/transport/symbols.c
@@ -581,7 +581,10 @@ static int _stp_init_modules(void)
/* unlocks the list */
modules_op->stop(NULL, NULL);
-#ifndef CONFIG_FRAME_POINTER
+#ifdef STP_USE_FRAME_POINTER
+ /* done with modules, now go */
+ _stp_ctl_send(STP_TRANSPORT, NULL, 0);
+#else
/* now that we have all the modules, ask for their unwind info */
{
unsigned long flags;
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index aa96a50e..8f59584d 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -259,7 +259,7 @@ int _stp_transport_init(void)
goto err3;
_stp_transport_state = 1;
-
+
dbug_trans(1, "calling init_kernel_symbols\n");
if (_stp_init_kernel_symbols() < 0)
goto err4;
diff --git a/runtime/unwind/i386.h b/runtime/unwind/i386.h
index cb2efab7..354807a0 100644
--- a/runtime/unwind/i386.h
+++ b/runtime/unwind/i386.h
@@ -30,7 +30,7 @@ struct unwind_frame_info
#define UNW_PC(frame) (frame)->regs.eip
#define UNW_SP(frame) (frame)->regs.esp
-#ifdef CONFIG_FRAME_POINTER
+#ifdef STP_USE_FRAME_POINTER
#define UNW_FP(frame) (frame)->regs.ebp
#define FRAME_RETADDR_OFFSET 4
#define FRAME_LINK_OFFSET 0
diff --git a/runtime/unwind/x86_64.h b/runtime/unwind/x86_64.h
index 6e6e521f..48838490 100644
--- a/runtime/unwind/x86_64.h
+++ b/runtime/unwind/x86_64.h
@@ -35,13 +35,16 @@ struct unwind_frame_info
#define UNW_PC(frame) (frame)->regs.rip
#define UNW_SP(frame) (frame)->regs.rsp
-#ifdef CONFIG_FRAME_POINTER
+
+#if 0 /* STP_USE_FRAME_POINTER */
+/* Frame pointers not implemented in x86_64 currently */
#define UNW_FP(frame) (frame)->regs.rbp
#define FRAME_RETADDR_OFFSET 8
#define FRAME_LINK_OFFSET 0
#define STACK_BOTTOM(tsk) (((tsk)->thread.rsp0 - 1) & ~(THREAD_SIZE - 1))
#define STACK_TOP(tsk) ((tsk)->thread.rsp0)
#endif
+
/* Might need to account for the special exception and interrupt handling
stacks here, since normally
EXCEPTION_STACK_ORDER < THREAD_ORDER < IRQSTACK_ORDER,