This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2] 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 <wenji.huang@oracle.com>
---
 tapsets.cxx |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/tapsets.cxx b/tapsets.cxx
index b424492..533d849 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -8529,6 +8529,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 ();
 };
@@ -8973,6 +8974,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<string>(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)
-- 
1.5.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]