public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: swagiaal@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: swagiaal: ferror patch by pmuldoon for regex support.
Date: Thu, 06 Mar 2008 22:03:00 -0000	[thread overview]
Message-ID: <20080306220312.13259.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  1a52324c946bd9575b40dd5100b10ebbfd80495f (commit)
       via  3b92ab85fc2f8c02782c16a49eb6294594469cf1 (commit)
      from  225b857e68be8aaace9cc2736e330f3b3b471809 (commit)

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

- Log -----------------------------------------------------------------
commit 1a52324c946bd9575b40dd5100b10ebbfd80495f
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Thu Mar 6 17:02:23 2008 -0500

    swagiaal: ferror patch by pmuldoon for regex support.
    
    frysk-core/frysk/bindir/ChangeLog
    +2008-03-06  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	* TestFerror.java: Added test for regext argument matching.
    +
    +2008-03-06  Phil Muldoon  <pmuldoon@redhat.com>
    +
    +       * ferror.java (main): Update option text.
    +       (parsed): Do not store argument. Compile into pattern.
    +       (updateSyscallEnter): Use Matcher instead of contains.
    +
     2008-03-06  Sami Wagiaalla  <swagiaal@redhat.com>
    
     	* ferror.java: Now reads entire length of string

commit 3b92ab85fc2f8c02782c16a49eb6294594469cf1
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Thu Mar 6 15:50:39 2008 -0500

    swagiaal: Fixed 5848: ferror prints duplicate stack traces and errors.
    
    frysk-core/frysk/bindir/ChangeLog
    +2008-03-06  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	* ferror.java: Now reads entire length of string
    +	being outputed.
    +

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

Summary of changes:
 frysk-core/frysk/bindir/ChangeLog       |   15 +++++++++++++++
 frysk-core/frysk/bindir/TestFerror.java |   21 ++++++++++++++++++---
 frysk-core/frysk/bindir/ferror.java     |   23 +++++++++++++++--------
 3 files changed, 48 insertions(+), 11 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog
index 8cc896a..bd3b200 100644
--- a/frysk-core/frysk/bindir/ChangeLog
+++ b/frysk-core/frysk/bindir/ChangeLog
@@ -1,3 +1,18 @@
+2008-03-06  Sami Wagiaalla  <swagiaal@redhat.com> 
+
+	* TestFerror.java: Added test for regext argument matching.
+
+2008-03-06  Phil Muldoon  <pmuldoon@redhat.com>
+ 
+       * ferror.java (main): Update option text.
+       (parsed): Do not store argument. Compile into pattern.
+       (updateSyscallEnter): Use Matcher instead of contains. 
+
+2008-03-06  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* ferror.java: Now reads entire length of string
+	being outputed.
+
 2008-03-04  Andrew Cagney  <cagney@redhat.com>
 
 	* TestFexe.java testExePath()): New.
diff --git a/frysk-core/frysk/bindir/TestFerror.java b/frysk-core/frysk/bindir/TestFerror.java
index 8ca1ec8..307a46b 100644
--- a/frysk-core/frysk/bindir/TestFerror.java
+++ b/frysk-core/frysk/bindir/TestFerror.java
@@ -55,7 +55,7 @@ public class TestFerror extends TestLib {
 		"--",
 		Config.getPkgLibFile("funit-3forks").getAbsolutePath()});
 	e.expect("Tracing");
-	e.expect(".*main.*");
+	e.expect("main");
     }
 
     public void testFerrorTracesPID () {
@@ -69,7 +69,7 @@ public class TestFerror extends TestLib {
 		Integer.toString(task.getProc().getPid())});
 	e.expect("Tracing");
 	child.assertSendAddCloneWaitForAcks();
-	e.expect(".*main.*");
+	e.expect("main");
     }
 
     public void testFerrorFollowsForks() {
@@ -80,7 +80,22 @@ public class TestFerror extends TestLib {
 		"--",
 		Config.getPkgLibFile("funit-3forks").getAbsolutePath()});
 	e.expect("Tracing");
-	e.expect(".*main.*");
+	e.expect("main");
     }
+    
+    public void testFerrorUnderstandsRegex() {
+	TearDownExpect e = new TearDownExpect(new String[] {
+		Config.getBinFile("ferror").getAbsolutePath(),
+		"-e",
+		"fork*",
+		"--",
+		Config.getPkgLibFile("funit-3forks").getAbsolutePath()});
+	e.expect("Tracing");
+	e.expect("main");
+	e.expect("main");
+	e.expect("main");
+    }
+    
+    
 
 }
diff --git a/frysk-core/frysk/bindir/ferror.java b/frysk-core/frysk/bindir/ferror.java
index 52906bc..223adb6 100644
--- a/frysk-core/frysk/bindir/ferror.java
+++ b/frysk-core/frysk/bindir/ferror.java
@@ -10,20 +10,22 @@ import frysk.proc.TaskObserver.Syscalls;
 import frysk.util.ProcRunningUtil;
 import gnu.classpath.tools.getopt.Option;
 import gnu.classpath.tools.getopt.OptionException;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
 
 import java.io.PrintWriter;
 
 public class ferror {
     
     static final PrintWriter printWriter = new PrintWriter(System.out);
+    static Pattern writePattern;
     
-    private static String errorString;
     public static void main (String[] args)
     {
-       Option option = new Option('e', "--error", "error string to catch in double quotes -e \"<error string>\""){
+       Option option = new Option('e', "--error", "error regex to catch in double quotes -e \"<error string>\""){
 
 	public void parsed(String argument) throws OptionException {
-	    errorString = argument;
+	    writePattern = Pattern.compile(argument);
 	}  
        };
 	
@@ -54,14 +56,19 @@ public class ferror {
       public Action updateSyscallEnter(Task task, Syscall syscall) {
   	if(syscall.getName().equals("write")){
   	        long address = syscall.getArguments(task, 2);
-  	        
+  	        long length = syscall.getArguments(task, 3);
+  	      
   	        StringBuffer x = new StringBuffer ();
-  	        task.getMemory().get (address, 200, x);
+  	        task.getMemory().get (address, length, x);
   	        String xString = new String(x);
   	        
-  	        if(xString.contains(errorString)){
-  	          printWriter.println("Process is trying to output " + errorString);
-  	          
+		Matcher match = writePattern.matcher(xString);
+		if (match.find()) {
+		   printWriter.println("Process is trying to output: " +
+				       xString + 
+				       " which matches pattern: " + 
+				       writePattern.pattern());
+		    
   	          printWriter.println("Stack trace:\n");
   	          PrintStackOptions options = new PrintStackOptions();
 


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


                 reply	other threads:[~2008-03-06 22:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080306220312.13259.qmail@sourceware.org \
    --to=swagiaal@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).