]> sourceware.org Git - systemtap.git/commitdiff
PR10327: Fix and test alias matching
authorJosh Stone <jistone@redhat.com>
Sat, 12 Jun 2010 00:44:51 +0000 (17:44 -0700)
committerJosh Stone <jistone@redhat.com>
Mon, 14 Jun 2010 22:30:17 +0000 (15:30 -0700)
The optimization in commit 4df79aa broke alias matching for functions
without wildcards, but we didn't have any testing. :(

* dwflpp.cxx (dwflpp::iterate_single_function): Call update_symtab after
  building the module function cache, to enable alias matching.
* testsuite/systemtap.base/func_alias.{exp,c}: New test.

dwflpp.cxx
testsuite/systemtap.base/func_alias.c [new file with mode: 0644]
testsuite/systemtap.base/func_alias.exp [new file with mode: 0644]

index d38fbdc89ef9eb12c9d764edb76e5846e91d5349..73e8ef29b1cab6566ec6ec3afea1b11653caeb3c 100644 (file)
@@ -884,6 +884,7 @@ dwflpp::iterate_single_function (int (* callback)(Dwarf_Die * func, base_query *
       if (sess.verbose > 4)
         clog << "module function cache " << module_name
              << " size " << v->size() << endl;
+      mod_info->update_symtab(v);
     }
 
   cu_function_cache_t::iterator it;
diff --git a/testsuite/systemtap.base/func_alias.c b/testsuite/systemtap.base/func_alias.c
new file mode 100644 (file)
index 0000000..acc6b30
--- /dev/null
@@ -0,0 +1,2 @@
+int main() { return 0; }
+extern int (*func_alias) __attribute__ ((alias ("main")));
diff --git a/testsuite/systemtap.base/func_alias.exp b/testsuite/systemtap.base/func_alias.exp
new file mode 100644 (file)
index 0000000..49a29b6
--- /dev/null
@@ -0,0 +1,60 @@
+set test "func_alias"
+
+proc run {subtest pp} {
+  global test
+  verbose -log "subtest $subtest"
+  verbose -log "Running stap -l $pp"
+  set match 0
+  spawn stap -l $pp
+  expect {
+    timeout { fail "$subtest (timeout)" }
+    -re "main@.*$test\\.c" {
+      if {$match == 0} { pass $subtest; incr match }
+      exp_continue
+    }
+    eof { if {$match == 0} { fail $subtest } }
+  }
+  wait
+}
+
+proc run_one_test {flags bits} {
+    global test srcdir subdir
+
+    verbose -log "testing $bits-bit $test"
+    set source "$srcdir/$subdir/$test.c"
+    set target "[pwd]/$test.x$bits"
+    set flags "additional_flags=-g $flags"
+    set res [target_compile $source $target executable $flags]
+    if { $res != "" } {
+      verbose -log "$target failed: $res"
+      untested "$bits-bit $test"
+      return
+    }
+    run "$bits-bit $test direct" "process(\"$target\").function(\"$test\")"
+    run "$bits-bit $test wildcard" "process(\"$target\").function(\"$test*\")"
+    exec rm -f $target
+}
+
+set do_32_bit_pass 1
+set do_64_bit_pass 0
+set flags32 ""
+set flags64 ""
+switch -regexp $::tcl_platform(machine) {
+    ^ia64$ {
+        set do_32_bit_pass 0
+        set do_64_bit_pass 1
+    }
+    ^(x86_64|ppc64)$ {
+        set do_64_bit_pass 1
+        set flags32 "additional_flags=-m32"
+        set flags64 "additional_flags=-m64"
+    }
+    ^s390x$ {
+        set do_64_bit_pass 1
+        set flags32 "additional_flags=-m31"
+        set flags64 "additional_flags=-m64"
+    }
+}
+
+if {$do_64_bit_pass} { run_one_test $flags64 64 }
+if {$do_32_bit_pass} { run_one_test $flags32 32 }
This page took 0.03785 seconds and 5 git commands to generate.