summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-03-27 11:54:42 -0400
committerFrank Ch. Eigler <fche@elastic.org>2009-03-27 11:55:02 -0400
commit432f054fc20511d487d18234b6408b5df89a8c4d (patch)
treed2cd351411510383056b42dafbf266bd270e4c04 /tapsets.cxx
parent0977ab1f283c48918c483a73d96b1345286419ca (diff)
downloadsystemtap-steved-432f054fc20511d487d18234b6408b5df89a8c4d.tar.gz
systemtap-steved-432f054fc20511d487d18234b6408b5df89a8c4d.tar.xz
systemtap-steved-432f054fc20511d487d18234b6408b5df89a8c4d.zip
PR10000: emit _stp_relocate* calculations correctly for kernel/module global $data
* translate.cxx (dump_unwindsyms): Also emit STT_OBJECT symbols, therefore .data etc. sections into stap-symbols.h. * tapsets.cxx (iterate_over_modules): Omit a dwfl_getmodules() RC-checking assertion that blocked meaningful $context var error messages. (dwflpp::emit_address): Bypass dwfl_module_relocate_address() for kernel symbols as it has been unreliable; subtract sess.sym_stext manually. * testsuite/buildok/seventeen.stp: Extend test with module $global.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx25
1 files changed, 19 insertions, 6 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index c36a1aa0..82c61525 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -1040,7 +1040,10 @@ struct dwflpp
off = dwfl_getmodules (dwfl, callback, data, off);
}
while (off > 0);
- dwfl_assert("dwfl_getmodules", off == 0);
+ // Don't complain if we exited dwfl_getmodules early.
+ // This could be a $target variable error that will be
+ // reported soon anyway.
+ // dwfl_assert("dwfl_getmodules", off == 0);
// PR6864 XXX: For dwarfless case (if .../vmlinux is missing), then the
// "kernel" module is not reported in the loop above. However, we
@@ -1699,15 +1702,25 @@ struct dwflpp
// relocatable module probing code will need to have.
Dwfl_Module *mod = dwfl_addrmodule (dwfl, address);
dwfl_assert ("dwfl_addrmodule", mod);
+ const char *modname = dwfl_module_info (mod, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL);
int n = dwfl_module_relocations (mod);
dwfl_assert ("dwfl_module_relocations", n >= 0);
- int i = dwfl_module_relocate_address (mod, &address);
+ Dwarf_Addr reloc_address = address;
+ int i = dwfl_module_relocate_address (mod, &reloc_address);
dwfl_assert ("dwfl_module_relocate_address", i >= 0);
- const char *modname = dwfl_module_info (mod, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL);
dwfl_assert ("dwfl_module_info", modname);
const char *secname = dwfl_module_relocation_info (mod, i, NULL);
+ if (sess.verbose > 2)
+ {
+ clog << "emit dwarf addr 0x" << hex << address << dec
+ << " => module " << modname
+ << " section " << (secname ?: "null")
+ << " relocaddr 0x" << hex << reloc_address << dec
+ << endl;
+ }
+
if (n > 0 && !(n == 1 && secname == NULL))
{
dwfl_assert ("dwfl_module_relocation_info", secname);
@@ -1717,7 +1730,7 @@ struct dwflpp
// module, for a kernel module (or other ET_REL module object).
obstack_printf (pool, "({ static unsigned long addr = 0; ");
obstack_printf (pool, "if (addr==0) addr = _stp_module_relocate (\"%s\",\"%s\",%#" PRIx64 "); ",
- modname, secname, address);
+ modname, secname, reloc_address);
obstack_printf (pool, "addr; })");
}
else if (n == 1 && module_name == TOK_KERNEL && secname[0] == '\0')
@@ -1728,7 +1741,7 @@ struct dwflpp
secname = "_stext";
obstack_printf (pool, "({ static unsigned long addr = 0; ");
obstack_printf (pool, "if (addr==0) addr = _stp_module_relocate (\"%s\",\"%s\",%#" PRIx64 "); ",
- modname, secname, address);
+ modname, secname, address); // PR10000 NB: not reloc_address
obstack_printf (pool, "addr; })");
}
else