From 89f3a1254ccf16a6828671c6e5bc407bc061f040 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 9 Mar 2009 10:05:42 -0400 Subject: [PATCH] Make marker probe support listing mode -L This patch is to enable displaying the arguments of marker probe for listing mode -L. The output is like, $stap -L 'kernel.mark("*")' kernel.mark("core_marker_format").format("name %s format %s") $arg1:string $arg2:string kernel.mark("jbd2_checkpoint").format("dev %s need_checkpoint %d") $arg1:string $arg2:long kernel.mark("jbd2_end_commit").format("dev %s transaction %d head %d") $arg1:string $arg2:long $arg3:long kernel.mark("jbd2_start_commit").format("dev %s transaction %d") $arg1:string $arg2:long Note: It's also possible to figure out the arguments according to the format. Signed-off-by: Wenji Huang --- tapsets.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tapsets.cxx b/tapsets.cxx index 71a9a7685..b1d0b04e9 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -8523,6 +8523,7 @@ struct mark_derived_probe: public derived_probe void join_group (systemtap_session& s); void emit_probe_context_vars (translator_output* o); void initialize_probe_context_vars (translator_output* o); + void printargs (std::ostream &o) const; void parse_probe_format (); }; @@ -8967,6 +8968,27 @@ mark_derived_probe::initialize_probe_context_vars (translator_output* o) o->newline() << "deref_fault: ;"; } +void +mark_derived_probe::printargs(std::ostream &o) const +{ + for (unsigned i = 0; i < mark_args.size(); i++) + { + string localname = "$arg" + lex_cast(i+1); + switch (mark_args[i]->stp_type) + { + case pe_long: + o << " " << localname << ":long"; + break; + case pe_string: + o << " " << localname << ":string"; + break; + default: + o << " " << localname << ":unknown"; + break; + } + } +} + void mark_derived_probe_group::emit_module_decls (systemtap_session& s) -- 2.43.5