From: Josh Stone Date: Sat, 12 Jun 2010 00:44:51 +0000 (-0700) Subject: PR10327: Fix and test alias matching X-Git-Tag: release-1.3~240^2~2 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=d1fa8b15783c94b1ba7aeeb9802b65c99aa76dfd;p=systemtap.git PR10327: Fix and test alias matching 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. --- diff --git a/dwflpp.cxx b/dwflpp.cxx index d38fbdc89..73e8ef29b 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -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 index 000000000..acc6b3008 --- /dev/null +++ b/testsuite/systemtap.base/func_alias.c @@ -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 index 000000000..49a29b607 --- /dev/null +++ b/testsuite/systemtap.base/func_alias.exp @@ -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 }