From 6bed2a76ce80984bbdda54ddfbda9e41fc874442 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 22 Jul 2014 10:22:12 -0700 Subject: [PATCH] translator: propagate types to .return saved vars --- tapsets.cxx | 4 ++++ testsuite/semko/autocast11.stp | 17 +++++++++++++++++ testsuite/semok/autocast11.stp | 14 ++++++++++++++ 3 files changed, 35 insertions(+) create mode 100755 testsuite/semko/autocast11.stp create mode 100755 testsuite/semok/autocast11.stp diff --git a/tapsets.cxx b/tapsets.cxx index 510f5399e..7c51ef150 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3578,6 +3578,10 @@ dwarf_var_expanding_visitor::visit_target_symbol_saved_return (target_symbol* e) else exp = gen_mapped_saved_return(repl, e->sym_name()); + // Propagate the DWARF type to the expression in the return probe. + if (repl->type_details && !exp->type_details) + exp->type_details = repl->type_details; + // Provide the variable to our parent so it can be used as a // substitute for the target symbol. provide (exp); diff --git a/testsuite/semko/autocast11.stp b/testsuite/semko/autocast11.stp new file mode 100755 index 000000000..acea0fa9d --- /dev/null +++ b/testsuite/semko/autocast11.stp @@ -0,0 +1,17 @@ +#! stap -p2 + +probe kernel.function("schedule_tail").return ? +{ + // Test the type propagated from a value saved at entry, with an error + // (semok/autocast11.stp makes sure this normally works) + mm = $prev->mm + println(mm->no_such_member) +} + +probe process("stap").function("main").return ? +{ + // NB: if the access above fails as it should, we won't even get here, but + // this is still useful to give --runtime=dyninst something to test. + a = $argv + println(a->no_such_member) +} diff --git a/testsuite/semok/autocast11.stp b/testsuite/semok/autocast11.stp new file mode 100755 index 000000000..f4faf0e72 --- /dev/null +++ b/testsuite/semok/autocast11.stp @@ -0,0 +1,14 @@ +#! stap -p2 + +probe kernel.function("schedule_tail").return ? +{ + // Test the type propagated from a value saved at entry + mm = $prev->mm + println(mm->mmap) +} + +probe process("stap").function("main").return ? +{ + a = $argv + println((a)[0]) +} -- 2.43.5