This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 1/1] Make tracepoint probe support listing mode -L
- From: Wenji Huang <wenji dot huang at oracle dot com>
- To: systemtap at sourceware dot org
- Cc: Wenji Huang <wenji dot huang at oracle dot com>
- Date: Mon, 9 Mar 2009 17:43:31 -0400
- Subject: [PATCH 1/1] 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 <wenji.huang@oracle.com>
---
elaborate.h | 2 ++
main.cxx | 5 ++++-
tapsets.cxx | 7 +++++++
3 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/elaborate.h b/elaborate.h
index 1e05444..0ad5b4b 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<probe*> &probes_list);
diff --git a/main.cxx b/main.cxx
index dbb2a30..b494ba2 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; j<p->locals.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 b748a48..b424492 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -9223,6 +9223,7 @@ struct tracepoint_derived_probe: public derived_probe
vector <struct tracepoint_arg> 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);
};
@@ -9671,6 +9672,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)
--
1.5.6