public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Support -stack in ftrace
@ 2008-02-11 16:29 pmachata
  0 siblings, 0 replies; only message in thread
From: pmachata @ 2008-02-11 16:29 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  7cd0b6627235a9e66fe836693d83dc496a5c7a89 (commit)
       via  c92649be731ef76400fd4cebf5c049578f6dd254 (commit)
      from  8385f074781658054b44640914b94edeaf1e2c93 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 7cd0b6627235a9e66fe836693d83dc496a5c7a89
Author: Petr Machata <pmachata@redhat.com>
Date:   Mon Feb 11 17:29:10 2008 +0100

    Support -stack in ftrace

commit c92649be731ef76400fd4cebf5c049578f6dd254
Author: Petr Machata <pmachata@redhat.com>
Date:   Mon Feb 11 16:26:02 2008 +0100

    Update manual page of ftrace

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/bindir/ChangeLog   |    9 ++
 frysk-core/frysk/bindir/ftrace.java |   17 ++++-
 frysk-core/frysk/bindir/ftrace.xml  |  138 ++++++++++++++++++++--------------
 3 files changed, 105 insertions(+), 59 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog
index b4b46e0..7bf2104 100644
--- a/frysk-core/frysk/bindir/ChangeLog
+++ b/frysk-core/frysk/bindir/ChangeLog
@@ -1,5 +1,14 @@
 2008-02-11  Petr Machata  <pmachata@redhat.com>
 
+	* ftrace.java: Support -stack.
+	* ftrace.xml: Describe -stack.
+
+2008-02-11  Petr Machata  <pmachata@redhat.com>
+
+	* ftrace.xml: Describe -sys option, remove description of -S and -t.
+
+2008-02-11  Petr Machata  <pmachata@redhat.com>
+
 	* ftrace.java: Refactoring.
 	(Rule.checkVersionMatches): Moved from MyFtraceController.
 	(Rule.checkNameMatches): Likewise.
diff --git a/frysk-core/frysk/bindir/ftrace.java b/frysk-core/frysk/bindir/ftrace.java
index 281063d..e61329e 100644
--- a/frysk-core/frysk/bindir/ftrace.java
+++ b/frysk-core/frysk/bindir/ftrace.java
@@ -257,9 +257,15 @@ class MyFtraceController
 
     // Which symbols should yield a stack trace.
     private HashSet symbolsStackTraceSet = new HashSet();
+    private boolean stackTraceEverything = false;
+
+    public void stackTraceEverything() {
+	stackTraceEverything = true;
+    }
 
     public boolean shouldStackTraceOnSymbol(Symbol symbol) {
-	return symbolsStackTraceSet.contains(symbol);
+	return stackTraceEverything
+	    || symbolsStackTraceSet.contains(symbol);
     }
 
     public MyFtraceController() { }
@@ -306,7 +312,8 @@ class MyFtraceController
 	Map ret = new HashMap();
 	for (Iterator it = workingSet.iterator(); it.hasNext(); ) {
 	    Object syscall = it.next();
-	    ret.put(syscall, Boolean.valueOf(stackTraceSet.contains(syscall)));
+	    ret.put(syscall, Boolean.valueOf(stackTraceEverything
+					     || stackTraceSet.contains(syscall)));
 	}
 	return ret;
     }
@@ -596,6 +603,12 @@ class ftrace
 		    symRules.add(arg);
 		}
 	});
+
+	parser.add(new Option("stack", "stack trace on every traced entity") {
+		public void parsed(String arg) {
+		    controller.stackTraceEverything();
+		}
+	});
     }
 
     public void run(String[] args)
diff --git a/frysk-core/frysk/bindir/ftrace.xml b/frysk-core/frysk/bindir/ftrace.xml
index 30bb6b8..ab67392 100644
--- a/frysk-core/frysk/bindir/ftrace.xml
+++ b/frysk-core/frysk/bindir/ftrace.xml
@@ -73,12 +73,11 @@
       <arg choice="opt">-m</arg>
       <arg choice="opt">-o=<replaceable>FILE</replaceable></arg>
       <arg choice="opt" rep="repeat">-p=<replaceable>PID</replaceable></arg>
-      <arg choice="opt">-s=<replaceable>SYSCALL</replaceable>[,<replaceable>SYSCALL</replaceable>...]</arg>
-      <arg choice="opt">-S</arg>
-      <arg choice="opt">-t=<replaceable>SYSCALL</replaceable>[,<replaceable>SYSCALL</replaceable>...]</arg>
+      <arg choice="opt">-sys=<replaceable>SYSCALL</replaceable>[,<replaceable>SYSCALL</replaceable>...]</arg>
       <arg choice="opt">-plt=<replaceable>RULE</replaceable>[,<replaceable>RULE</replaceable>...]</arg>
       <arg choice="opt">-dyn=<replaceable>RULE</replaceable>[,<replaceable>RULE</replaceable>...]</arg>
       <arg choice="opt">-sym=<replaceable>RULE</replaceable>[,<replaceable>RULE</replaceable>...]</arg>
+      <arg choice="opt">-stack</arg>
       <arg choice="opt">--</arg>
       <arg choice="plain"><replaceable>command</replaceable> <arg choice="opt"><replaceable>arguments</replaceable>...</arg></arg>
     </cmdsynopsis>
@@ -121,41 +120,31 @@
     <refsect2>
 	<title>System Call Tracing</title>
 
-	<para>System calls are traced by default.</para>
-
 	<variablelist>
-	    <varlistentry>
-		<term>-S</term>
-		<listitem>
-		    <para>Suppress system call tracing.</para>
-		</listitem>
-	    </varlistentry>
-
-	    <varlistentry>
-		<term>-s=<replaceable>SYSCALL</replaceable>[,<replaceable>SYSCALL</replaceable>...]</term>
-		<listitem>
-		    <para>Stack trace on this set of system calls.
-    		    When stack-traced syscall is encountered, a stack
-    		    trace of the calling task is printed out.  Each
-    		    <replaceable>SYSCALL</replaceable> entry is name
-    		    of one system call.</para>
-		</listitem>
-	    </varlistentry>
+	  <varlistentry>
+	    <term>-sys=<replaceable>SYSCALL</replaceable>[,<replaceable>SYSCALL</replaceable>...]</term>
+	    <listitem>
+	      <para>Trace system calls that match given
+	      <replaceable>SYSCALL</replaceable> ruleset are.  See
+	      below for description of
+	      <replaceable>SYSCALL</replaceable> syntax.</para>
+	    </listitem>
+	  </varlistentry>
 
-	    <varlistentry>
-		<term>-t=<replaceable>SYSCALL</replaceable>[,<replaceable>SYSCALL</replaceable>...]</term>
-		<listitem>
-		    <para>Explicitly define syscalls that should be
-    		    traced.  Each <replaceable>SYSCALL</replaceable>
-    		    entry is name of one system call.</para>
-		</listitem>
-    	    </varlistentry>
+	  <varlistentry>
+	    <term>-stack</term>
+	    <listitem>
+	      <para>Stack trace when traced system call is hit.  Note
+	      that this option also applies to traced symbols.  If you
+	      need to cherry-pick which event should stack trace, use
+	      # operator described in sections below.</para>
+	    </listitem>
+	  </varlistentry>
 	</variablelist>
     </refsect2>
 
-
     <refsect2>
-	<title>Entry Point Tracing</title>
+	<title>Symbol Tracing</title>
 
 	<variablelist>
 	  <varlistentry>
@@ -169,20 +158,21 @@
 	  </varlistentry>
 
 	  <varlistentry>
-	    <term>-plt=<replaceable>RULE</replaceable>[,<replaceable>RULE</replaceable>...]</term>
+	    <term>-plt=<replaceable>SYMBOL</replaceable>[,<replaceable>SYMBOL</replaceable>...]</term>
 	    <listitem>
-	      <para>Trace library calls done via PLT entries matching each
-	      given <replaceable>RULE</replaceable>.  By tracing PLT
-	      entry, you effectively trace calls done FROM given library
-	      or executable, and generally can't say which library the
-	      call leads TO.  (At least for now.  Ftrace may grow brains
-	      for this in future.)  See below for description of
-	      <replaceable>RULE</replaceable> syntax.</para>
+	      <para>Trace library calls done via PLT entries matching
+	      each given <replaceable>SYMBOL</replaceable> ruleset.
+	      By tracing PLT entry, you effectively trace calls done
+	      FROM given library or executable, and generally can't
+	      say which library the call leads TO.  (At least for now.
+	      Ftrace may grow brains for this in future.)  See below
+	      for description of <replaceable>SYMBOL</replaceable>
+	      rule syntax.</para>
 	    </listitem>
 	  </varlistentry>
 
 	  <varlistentry>
-	    <term>-dyn=<replaceable>RULE</replaceable>[,<replaceable>RULE</replaceable>...]</term>
+	    <term>-dyn=<replaceable>SYMBOL</replaceable>[,<replaceable>SYMBOL</replaceable>...]</term>
 	    <listitem>
 	      <para>Trace calls through the symbol entry points.  By
 	      tracing entry points, you catch all calls that end up at
@@ -193,19 +183,29 @@
 	      functions call each other in the library internals.  On the
 	      other hand, it may be useful to cherry pick few entry points
 	      to see when or if they are called, and with which arguments.
-	      See below for description of <replaceable>RULE</replaceable>
-	      syntax.</para>
+	      See below for description of <replaceable>SYMBOL</replaceable>
+	      rule syntax.</para>
 	    </listitem>
 	  </varlistentry>
 
 	  <varlistentry>
-	    <term>-sym=<replaceable>RULE</replaceable>[,<replaceable>RULE</replaceable>...]</term>
+	    <term>-sym=<replaceable>SYMBOL</replaceable>[,<replaceable>SYMBOL</replaceable>...]</term>
 	    <listitem>
 	      <para>Just like <option>-dyn</option>, but doesn't look for
 	      symbols in dynamic symbol table, but normal symbol table.
 	      (Which doesn't have to be present, e.g. when a binary is
 	      stripped.)  See below for description of
-	      <replaceable>RULE</replaceable> syntax.</para>
+	      <replaceable>SYMBOL</replaceable> rule syntax.</para>
+	    </listitem>
+	  </varlistentry>
+
+	  <varlistentry>
+	    <term>-stack</term>
+	    <listitem>
+	      <para>Stack trace when traced symbol is hit.  Note that
+	      this option also applies to traced system calls.  If you
+	      need to cherry-pick which event should stack trace, use
+	      # operator described in sections below.</para>
 	    </listitem>
 	  </varlistentry>
 
@@ -228,7 +228,7 @@
   </refsect1>
 
   <refsect1>
-    <title>RULE SYNTAX</title>
+    <title>SYMBOL RULE SYNTAX</title>
 
     <para>To decide which PLT slots or entry points should be traced,
     following process takes place.  Initial working set is empty.
@@ -277,15 +277,44 @@
     "foo@@".)</para>
 
     <para>Empty rule is considered to miss all components.  If you
-    need to match empty symbol, use regular expression "^$".</para>
+    need to match an empty symbol, use regular expression "^$".</para>
+  </refsect1>
+
+  <refsect1>
+    <title>SYSCALL RULE SYNTAX</title>
+
+    <para>Under the presence of the <option>-sys</option> option, all
+    system calls are always traced.  This is a limitation of the
+    ptrace layer.  The system call rules however serve as a simple way
+    of filtering the output.</para>
+
+    <para>System call rule syntax and semantics are the same as the
+    symbol rule syntax:</para>
 
+    <para>[-][#]<replaceable>pattern</replaceable></para>
+
+    <para>System call selection pattern syntax is then as
+    follows:</para>
+
+    <para><optional><replaceable>syscall name</replaceable>|<replaceable>syscall number</replaceable></optional></para>
+
+    <para>When the pattern is empty, then it matches all system calls
+    known to frysk.  When the pattern is simple number
+    (e.g. &quot;12&quot;), then the pattern matches system call with
+    the given number.  Otherwise the pattern is considered to be
+    written using extended regular expression syntax, and matched
+    agains system call names.</para>
   </refsect1>
 
   <refsect1>
     <title>EXAMPLES</title>
 
     <informalexample>
-      <para>Trace all plt library calls:</para>
+      <para>Trace all system calls:</para>
+      <cmdsynopsis><command>ftrace -sys= ls</command></cmdsynopsis>
+      <para>Trace variants of stat system call and moreover a system call #3:</para>
+      <cmdsynopsis><command>ftrace -sys=&quot;.*stat.*&quot;,3 ls</command></cmdsynopsis>
+      <para>Trace all library calls:</para>
       <cmdsynopsis><command>ftrace -plt= ls</command></cmdsynopsis>
       <para>Trace all library calls to functions that contain
       substring "write" in their names:</para>
@@ -352,22 +381,17 @@
   
   <refsect1>
     <title>BUGS</title>
-    <para> The option parser is greedy when looking for options so running ftrace on a program that uses options can be a problem, use -- to split between ftrace and the program. So change from:</para>
+    <para>I think ftrace doesn't handle tracing one function through both entry point and plt.</para>
+    <para>The option parser is greedy when looking for options so running ftrace on a program that uses options can be a problem, use -- to split between ftrace and the program. So change from:</para>
     <screen>~/prefix/bin/ftrace ~/prefix/lib64/frysk/funit --arch 32 frysk.proc.TestAbandon</screen>
     <para>to</para>
     <screen>~/prefix/bin/ftrace -- ~/prefix/lib64/frysk/funit --arch 32 frysk.proc.TestAbandon</screen>
-    <para>Report bugs to <ulink url="http:/sources.redhat.com/ftrace">
-    http://sources.redhat.com/ftrace/ </ulink>. </para>
+    <para>Report bugs to <ulink url="http:/sources.redhat.com/frysk">
+    http://sources.redhat.com/frysk/ </ulink>. </para>
   </refsect1>
   
   <!-- refsect1>
     <title>SECURITY CONSIDERATIONS</title>
   </refsect1 -->
 
-  <refsect1>
-    <title>BUGS</title>
-    <para>I think ftrace doesn't handle tracing one function through both entry point and plt.</para>
-    <para>Report bugs to <ulink url="http:/sources.redhat.com/frysk">http://sources.redhat.com/frysk</ulink>.</para>
-  </refsect1>
-
 </refentry>


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-11 16:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-11 16:29 [SCM] master: Support -stack in ftrace pmachata

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).