public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Make tracepoint probe support listing mode -L
@ 2009-03-10  6:50 Wenji Huang
  2009-03-10  6:51 ` Josh Stone
  0 siblings, 1 reply; 2+ messages in thread
From: Wenji Huang @ 2009-03-10  6:50 UTC (permalink / raw)
  To: systemtap; +Cc: Wenji Huang

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] Make tracepoint probe support listing mode -L
  2009-03-10  6:50 [PATCH 1/1] Make tracepoint probe support listing mode -L Wenji Huang
@ 2009-03-10  6:51 ` Josh Stone
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Stone @ 2009-03-10  6:51 UTC (permalink / raw)
  To: Wenji Huang; +Cc: systemtap

Wenji Huang wrote:
> 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*

Very nice!


Josh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-10  3:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-10  6:50 [PATCH 1/1] Make tracepoint probe support listing mode -L Wenji Huang
2009-03-10  6:51 ` Josh Stone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).