summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tapsets.cxx25
-rwxr-xr-xtestsuite/buildok/seventeen.stp9
-rw-r--r--translate.cxx7
3 files changed, 32 insertions, 9 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
diff --git a/testsuite/buildok/seventeen.stp b/testsuite/buildok/seventeen.stp
index 126db1fb..4e0b07c4 100755
--- a/testsuite/buildok/seventeen.stp
+++ b/testsuite/buildok/seventeen.stp
@@ -11,3 +11,12 @@ probe kernel.function("pipe_write")
printf("0x%x\n", $write_fifo_fops->llseek)
%)
}
+
+# PR10000: We're looking for *some* module function that has a nearby global variable in scope
+# XXX: See PR4096
+probe module("nfs").function("nfs_create_client") !, module("nfs").function("nfs_init_client") !,
+ kernel.function("nfs_fsync_dir") {
+ println(kernel_string($nfs_program->name))
+}
+
+probe timer.s(5) { exit() }
diff --git a/translate.cxx b/translate.cxx
index 0b81d9bb..47fffd1e 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4564,7 +4564,7 @@ dump_unwindsyms (Dwfl_Module *m,
// base address outself. (see also below).
extra_offset = sym.st_value - base;
if (c->session.verbose > 2)
- clog << "Found kernel _stext 0x" << hex << extra_offset << dec << endl;
+ clog << "Found kernel _stext extra offset 0x" << hex << extra_offset << dec << endl;
}
// We only need the function symbols to identify kernel-mode
@@ -4572,8 +4572,9 @@ dump_unwindsyms (Dwfl_Module *m,
// These fake absolute addresses occur in some older i386
// kernels to indicate they are vDSO symbols, not real
// functions in the kernel.
- if (GELF_ST_TYPE (sym.st_info) == STT_FUNC &&
- ! (sym.st_shndx == SHN_UNDEF || sym.st_shndx == SHN_ABS))
+ if ((GELF_ST_TYPE (sym.st_info) == STT_FUNC ||
+ GELF_ST_TYPE (sym.st_info) == STT_OBJECT) // PR10000: also need .data
+ && !(sym.st_shndx == SHN_UNDEF || sym.st_shndx == SHN_ABS))
{
Dwarf_Addr sym_addr = sym.st_value;
const char *secname = NULL;