summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>2008-04-09 11:32:50 -0400
committerMartin Hunt <hunt@redhat.com>2008-04-09 11:32:50 -0400
commitfa670082537aea7f090bc8dcfab69ac5f62546bc (patch)
tree85831b4fa3ec69d8db97e33a4b0a642d8eadb4fd /runtime
parent073b6ba57a498c3c97426f6f6d0666f1f5eb30d4 (diff)
downloadsystemtap-steved-fa670082537aea7f090bc8dcfab69ac5f62546bc.tar.gz
systemtap-steved-fa670082537aea7f090bc8dcfab69ac5f62546bc.tar.xz
systemtap-steved-fa670082537aea7f090bc8dcfab69ac5f62546bc.zip
Change stap to get kernel symbols from debuginfo and
compile them into the module.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/transport/ChangeLog6
-rw-r--r--runtime/transport/symbols.c23
2 files changed, 25 insertions, 4 deletions
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog
index 0bb62497..b3a159e3 100644
--- a/runtime/transport/ChangeLog
+++ b/runtime/transport/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-09 Martin Hunt <hunt@dragon>
+
+ * symbols.c (_stp_init_kernel_symbols): Print error
+ messages and exit if symbol lookups fail.
+ (_stp_init_modules): Lookup modules_op.
+
2008-03-31 Martin Hunt <hunt@redhat.com>
* symbols.c (_stp_init_modules): Use STP_USE_DWARF_UNWINDER.
diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c
index 8bab1e70..b0e7c319 100644
--- a/runtime/transport/symbols.c
+++ b/runtime/transport/symbols.c
@@ -187,8 +187,8 @@ static int _stp_init_kernel_symbols(void)
{
_stp_modules[0] = (struct _stp_module *)_stp_kzalloc(sizeof(struct _stp_module));
if (_stp_modules[0] == NULL) {
- errk("cannot allocate memory\n");
- return -EFAULT;
+ _dbug("cannot allocate memory\n");
+ return -1;
}
_stp_modules[0]->symbols = _stp_kernel_symbols;
_stp_modules[0]->num_symbols = _stp_num_kernel_symbols;
@@ -197,11 +197,21 @@ static int _stp_init_kernel_symbols(void)
/* Note: this mapping is used by kernel/_stext pseudo-relocations. */
_stp_modules[0]->text = _stp_kallsyms_lookup_name("_stext");
+ if (_stp_modules[0]->text == 0) {
+ _dbug("Lookup of _stext failed. Exiting.\n");
+ return -1;
+ }
_stp_modules[0]->data = _stp_kallsyms_lookup_name("_etext");
+ if (_stp_modules[0]->data == 0) {
+ _dbug("Lookup of _etext failed. Exiting.\n");
+ return -1;
+ }
_stp_modules[0]->text_size = _stp_modules[0]->data - _stp_modules[0]->text;
_stp_modules_by_addr[0] = _stp_modules[0];
_stp_kretprobe_trampoline = _stp_kallsyms_lookup_name("kretprobe_trampoline");
+ /* Lookup failure is not fatal */
+
return 0;
}
@@ -559,14 +569,19 @@ static struct notifier_block _stp_module_load_nb = {
};
#include <linux/seq_file.h>
-extern unsigned long _stp_modules_op; /* from stap */
+
static int _stp_init_modules(void)
{
loff_t pos = 0;
void *res;
struct module *mod;
+ const struct seq_operations *modules_op = (const struct seq_operations *)_stp_kallsyms_lookup_name("modules_op");
+
+ if (modules_op == NULL) {
+ _dbug("Lookup of modules_op failed.\n");
+ return -1;
+ }
- const struct seq_operations *modules_op = (const struct seq_operations *)_stp_modules_op;
/* Use the seq_file interface to safely get a list of installed modules */
res = modules_op->start(NULL, &pos);
while (res) {