From e2086848b3b1e010249f68857ec10d6b9382446e Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 9 Mar 2009 08:17:27 -0400 Subject: [PATCH] Make tracepoint probe support listing mode -L This patch is to enable displaying arguments of tracepoint probe in listing mode -L. The example output is like $stap -L 'kernel.trace("block_bio*")' kernel.trace("block_bio_bounce") $q:struct request_queue* $bio:struct bio* kernel.trace("block_bio_backmerge") $q:struct request_queue* $bio:struct bio* kernel.trace("block_bio_complete") $q:struct request_queue* $bio:struct bio* kernel.trace("block_bio_queue") $q:struct request_queue* $bio:struct bio* kernel.trace("block_bio_frontmerge") $q:struct request_queue* $bio:struct bio* Signed-off-by: Wenji Huang --- elaborate.h | 2 ++ main.cxx | 5 ++++- tapsets.cxx | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/elaborate.h b/elaborate.h index 1e05444f8..0ad5b4b28 100644 --- a/elaborate.h +++ b/elaborate.h @@ -124,6 +124,8 @@ struct derived_probe: public probe virtual void join_group (systemtap_session& s) = 0; virtual probe_point* sole_location () const; virtual void printsig (std::ostream &o) const; + //for print arguments of probe if there + virtual void printargs (std::ostream &o) const {} void printsig_nested (std::ostream &o) const; virtual void collect_derivation_chain (std::vector &probes_list); diff --git a/main.cxx b/main.cxx index dbb2a306f..b494ba2b4 100644 --- a/main.cxx +++ b/main.cxx @@ -187,13 +187,16 @@ printscript(systemtap_session& s, ostream& o) { o << pp; // Print the locals for -L mode only - if (s.unoptimized) + if (s.unoptimized) { for (unsigned j=0; jlocals.size(); j++) { o << " "; vardecl* v = p->locals[j]; v->printsig (o); } + // Print arguments of probe if there + p->printargs(o); + } o << endl; seen.insert (pp); } diff --git a/tapsets.cxx b/tapsets.cxx index b66dd123f..71a9a7685 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -9217,6 +9217,7 @@ struct tracepoint_derived_probe: public derived_probe vector args; void build_args(dwflpp& dw, Dwarf_Die& func_die); + void printargs (std::ostream &o) const; void join_group (systemtap_session& s); void emit_probe_context_vars (translator_output* o); }; @@ -9665,6 +9666,12 @@ tracepoint_derived_probe::build_args(dwflpp& dw, Dwarf_Die& func_die) while (dwarf_siblingof(&arg, &arg) == 0); } +void +tracepoint_derived_probe::printargs(std::ostream &o) const +{ + for (unsigned i = 0; i < args.size(); ++i) + o << " $" << args[i].name << ":" << args[i].c_type; +} void tracepoint_derived_probe::join_group (systemtap_session& s) -- 2.43.5