As noted in bug 11769 comment 1, we rely on derived_probe::getargs() to list the available args, but uprobe_derived_probe doesn't know about SDT's debuginfoless $arg1, $arg2. (Nor $$name or $$provider, for that matter). The args still work in a normal script though. $ stap -L 'process("stap").mark("*")'process("stap").mark("cache__add__module") process("stap").mark("cache__add__source") process("stap").mark("cache__clean") process("stap").mark("cache__get") process("stap").mark("pass0__end") process("stap").mark("pass0__start") process("stap").mark("pass1__end") process("stap").mark("pass1a__start") process("stap").mark("pass1b__start") process("stap").mark("pass2__end") process("stap").mark("pass2__start") process("stap").mark("pass3__end") process("stap").mark("pass3__start") process("stap").mark("pass4__end") process("stap").mark("pass4__start") process("stap").mark("pass5__end") process("stap").mark("pass5__start") process("stap").mark("pass6__end") process("stap").mark("pass6__start") process("stap").mark("stap_system__complete") process("stap").mark("stap_system__spawn") process("stap").mark("stap_system__start")
How about this? --- a/tapsets.cxx +++ b/tapsets.cxx @@ -396,2 +396,3 @@ struct dwarf_derived_probe: public derived_probe void print_dupe_stamp(ostream& o); + void savesdtargs(int nargs); @@ -3914,2 +3915,10 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex void +dwarf_derived_probe::savesdtargs(int nargs) +{ + for (int i = 1; i <= nargs; i++) + args.push_back("$arg" + lex_cast (i) + ":long"); +} + + +void dwarf_derived_probe::getargs(std::list<std::string> &arg_set) const @@ -5111,2 +5120,3 @@ sdt_query::handle_query_module() q.statement_num_val, reloc_addr, q, 0); + p->savesdtargs (arg_count); results.push_back (p); stap -L 'process("../../install/bin/stap").mark("*")' process("../../install/bin/stap").mark("cache__add__module") $arg1:long $arg2:long process("../../install/bin/stap").mark("cache__add__source") $arg1:long $arg2:long process("../../install/bin/stap").mark("cache__clean") $arg1:long ...
> How about this? A good start, but "savesdtargs" is an awfully specific hook for what is a general dwarf class, and it is not clear whether these $arg* vars are resolvability-checked properly. A $argN that is unresolvable in the current case should not be listed.
Similar but handled in the more apropos uprobe_derived_probe. uprobe_derived_probe.args is set from sdt_query.arg_count which is the number of asm operands defined for a probe. stap -L 'process("../../install/bin/stap").mark("*")' process("../../install/bin/stap").mark("cache__add__module") $arg1:long $arg2:long process("../../install/bin/stap").mark("cache__add__source") $arg1:long $arg2:long process("../../install/bin/stap").mark("cache__clean") $arg1:long process("../../install/bin/stap").mark("cache__get") $arg1:long $arg2:long process("../../install/bin/stap").mark("client__end") $arg1:long ... diff --git a/tapsets.cxx b/tapsets.cxx @@ -455,2 +455,6 @@ struct uprobe_derived_probe: public dwarf_derived_probe void print_dupe_stamp(ostream& o) { print_dupe_stamp_unprivileged_process_owner (o); } + void getargs(std::list<std::string> &arg_set) const; + void savesdtargs(int nargs); +private: + list<string> args; }; @@ -5111,2 +5115,3 @@ sdt_query::handle_query_module() q.statement_num_val, reloc_addr, q, 0); + p->savesdtargs (arg_count); results.push_back (p); @@ -5956,2 +5961,16 @@ uprobe_derived_probe::emit_unprivileged_assertion (translator_output* o) +void +uprobe_derived_probe::getargs(std::list<std::string> &arg_set) const +{ + arg_set.insert(arg_set.end(), args.begin(), args.end()); +} + +void +uprobe_derived_probe::savesdtargs(int nargs) +{ + for (int i = 1; i <= nargs; i++) + args.push_back("$arg" + lex_cast (i) + ":long"); +}
uprobe_derived_probe::getargs needs to also call the parent dwarf_derived_probe, or else normal uprobes won't get any arg listing. Perhaps instead of getting more specific, we could make this more generic by adding derived_probe::saveargs(list<string>). Then derived_probe::getargs would have something to return. Don't forget to make each *_derived_probe subclass with their own getargs still call the parent class. Bonus points for only building the args when listing_mode_vars is true.
commit: c0f84e7bdb Support -L for nodebuginfo sdt.