summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-03-17 13:50:33 +0100
committerMark Wielaard <mjw@redhat.com>2009-03-17 13:50:33 +0100
commit30cb532a560ed152b86506b80490e99195970271 (patch)
tree51f00bfa7fbef7b8bc41ab9c9576bda1faf21dc8
parentdcb8ea7a7d1461bef3ea56ebf65d07e8ff998a00 (diff)
downloadsystemtap-steved-30cb532a560ed152b86506b80490e99195970271.tar.gz
systemtap-steved-30cb532a560ed152b86506b80490e99195970271.tar.xz
systemtap-steved-30cb532a560ed152b86506b80490e99195970271.zip
Get the canonical path of the main file for comparison at runtime.
When given directly by the user through -d or in case of the kernel name and path might differ. path should be used for matching. * runtime/sym.h (_stp_module): Add path field. * runtime/task_finder.c (__stp_tf_vm_cb): Use module path to compare vm_path. * translate.cxx (dump_unwindsyms): Output canonical path.
-rw-r--r--runtime/sym.h1
-rw-r--r--runtime/task_finder.c2
-rw-r--r--translate.cxx9
3 files changed, 11 insertions, 1 deletions
diff --git a/runtime/sym.h b/runtime/sym.h
index e642cab4..586b10ca 100644
--- a/runtime/sym.h
+++ b/runtime/sym.h
@@ -25,6 +25,7 @@ struct _stp_section {
struct _stp_module {
const char* name;
+ const char* path; /* canonical path used for runtime matching. */
struct _stp_section *sections;
unsigned num_sections;
diff --git a/runtime/task_finder.c b/runtime/task_finder.c
index ae381a41..38f9145d 100644
--- a/runtime/task_finder.c
+++ b/runtime/task_finder.c
@@ -72,7 +72,7 @@ static int __stp_tf_vm_cb(struct stap_task_finder_target *tgt,
struct _stp_module *module = NULL;
if (vm_path != NULL)
for (i = 0; i < _stp_num_modules; i++)
- if (strcmp(vm_path, _stp_modules[i]->name) == 0)
+ if (strcmp(vm_path, _stp_modules[i]->path) == 0)
{
#ifdef DEBUG_TASK_FINDER_VMA
_stp_dbug(__FUNCTION__, __LINE__,
diff --git a/translate.cxx b/translate.cxx
index f4c28536..377a11fb 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4700,6 +4700,15 @@ dump_unwindsyms (Dwfl_Module *m,
c->output << "static struct _stp_module _stp_module_" << stpmod_idx << " = {\n";
c->output << ".name = " << lex_cast_qstring (modname) << ", \n";
+
+ // Get the canonical path of the main file for comparison at runtime.
+ // When given directly by the user through -d or in case of the kernel
+ // name and path might differ. path should be used for matching.
+ const char *mainfile;
+ dwfl_module_info (m, NULL, NULL, NULL, NULL, NULL, &mainfile, NULL);
+ mainfile = canonicalize_file_name(mainfile);
+ c->output << ".path = " << lex_cast_qstring (mainfile) << ",\n";
+
c->output << ".dwarf_module_base = 0x" << hex << base << dec << ", \n";
if (unwind != NULL)