summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhunt <hunt>2005-08-31 18:24:26 +0000
committerhunt <hunt>2005-08-31 18:24:26 +0000
commit5a90d39d40a4360db4715408190aee558dbc3813 (patch)
tree36181c4b49e9ea92bf37e2e5a1a6b2db669b47b0
parent9a062ac8db299aeea20f189dafa253875889abb8 (diff)
downloadsystemtap-steved-5a90d39d40a4360db4715408190aee558dbc3813.tar.gz
systemtap-steved-5a90d39d40a4360db4715408190aee558dbc3813.tar.xz
systemtap-steved-5a90d39d40a4360db4715408190aee558dbc3813.zip
2005-08-31 Martin Hunt <hunt@redhat.com>
* sym.c (_stp_kallsyms_lookup): Moved to runtime.h. * stack.c (_stp_kta): Moved to runtime.h. * runtime.h (init_module): Initialize _stp_kallsyms_lookup and _stp_kta. * probes.c (_stp_lookup_name): Replaced by kallsyms_lookup_name().
-rw-r--r--runtime/ChangeLog5
-rw-r--r--runtime/probes.c13
-rw-r--r--runtime/runtime.h8
-rw-r--r--runtime/stack.c2
-rw-r--r--runtime/sym.c11
5 files changed, 16 insertions, 23 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index aeb21685..b8d8087d 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,5 +1,10 @@
2005-08-31 Martin Hunt <hunt@redhat.com>
+ * sym.c (_stp_kallsyms_lookup): Moved to runtime.h.
+ * stack.c (_stp_kta): Moved to runtime.h.
+ * runtime.h (init_module): Initialize _stp_kallsyms_lookup
+ and _stp_kta.
+ * probes.c (_stp_lookup_name): Replaced by kallsyms_lookup_name().
* list.c (_stp_copy_argv_from_user): ifdef this function
NEED_STRING_VALS.
diff --git a/runtime/probes.c b/runtime/probes.c
index bb410915..139d53aa 100644
--- a/runtime/probes.c
+++ b/runtime/probes.c
@@ -5,13 +5,6 @@
* @brief Functions to assist loading and unloading groups of probes.
*/
-/** Lookup name.
- * This simply calls the kernel function kallsyms_lookup_name().
- * That function is not exported, so this workaround is required.
- * See the kernel source, kernel/kallsyms.c for more information.
- */
-static unsigned long (*_stp_lookup_name)(char *name)=(void *)KALLSYMS_LOOKUP_NAME;
-
/** Unregister a group of jprobes.
* @param probes Pointer to an array of struct jprobe.
* @param num_probes Number of probes in the array.
@@ -37,7 +30,7 @@ int _stp_register_jprobes (struct jprobe *probes, int num_probes)
unsigned long addr;
for (i = 0; i < num_probes; i++) {
- addr =_stp_lookup_name((char *)probes[i].kp.addr);
+ addr =kallsyms_lookup_name((char *)probes[i].kp.addr);
if (addr == 0) {
_stp_warn("function %s not found!\n", (char *)probes[i].kp.addr);
ret = -1; /* FIXME */
@@ -95,7 +88,7 @@ int _stp_register_kprobes (struct kprobe *probes, int num_probes)
unsigned long addr;
for (i = 0; i < num_probes; i++) {
- addr =_stp_lookup_name((char *)probes[i].addr);
+ addr = kallsyms_lookup_name((char *)probes[i].addr);
if (addr == 0) {
_stp_warn("function %s not found!\n", (char *)probes[i].addr);
ret = -1;
@@ -126,7 +119,7 @@ int _stp_register_kretprobes (struct kretprobe *probes, int num_probes)
unsigned long addr;
for (i = 0; i < num_probes; i++) {
- addr =_stp_lookup_name((char *)probes[i].kp.addr);
+ addr = kallsyms_lookup_name((char *)probes[i].kp.addr);
if (addr == 0) {
_stp_warn("function %s not found!\n",
(char *)probes[i].kp.addr);
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 5e77505b..6189a92c 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -61,11 +61,19 @@ static struct
#include "arith.c"
#include "copy.c"
+static int (*_stp_kta)(unsigned long addr);
+static const char * (*_stp_kallsyms_lookup)(unsigned long addr,
+ unsigned long *symbolsize,
+ unsigned long *offset,
+ char **modname, char *namebuf);
+
/************* Module Stuff ********************/
int probe_start(void);
int init_module (void)
{
+ _stp_kta = (int (*)(unsigned long))kallsyms_lookup_name("__kernel_text_address");
+ _stp_kallsyms_lookup = (const char * (*)())kallsyms_lookup_name("kallsyms_lookup");
return _stp_transport_init();
}
diff --git a/runtime/stack.c b/runtime/stack.c
index 1f7073f5..ba0c9935 100644
--- a/runtime/stack.c
+++ b/runtime/stack.c
@@ -20,8 +20,6 @@
#include "sym.c"
#include "regs.h"
-static int (*_stp_kta)(unsigned long addr)=(void *)KTA;
-
#if defined (__x86_64__)
static void __stp_stack_sprint (String str, unsigned long *stack, int verbose, int levels)
diff --git a/runtime/sym.c b/runtime/sym.c
index a1c04a65..107f6b33 100644
--- a/runtime/sym.c
+++ b/runtime/sym.c
@@ -9,17 +9,6 @@
* @{
*/
-/** Lookup symbol.
- * This simply calls the kernel function kallsyms_lookup().
- * That function is not exported, so this workaround is required.
- * See the kernel source, kernel/kallsyms.c for more information.
- */
-static const char * (*_stp_kallsyms_lookup)(unsigned long addr,
- unsigned long *symbolsize,
- unsigned long *offset,
- char **modname, char *namebuf)=(void *)KALLSYMS_LOOKUP;
-
-
/** Write addresses symbolically into a String
* @param str String
* @param address The address to lookup.