diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog index 8cc896a..4e114f9 100644 --- a/frysk-core/frysk/bindir/ChangeLog +++ b/frysk-core/frysk/bindir/ChangeLog @@ -1,3 +1,9 @@ +2008-03-06 Phil Muldoon + + * ferror.java (main): Update option text. + (parsed): Do not store argument. Compile into pattern. + (updateSyscallEnter): Use Matcher instead of contains. + 2008-03-04 Andrew Cagney * TestFexe.java testExePath()): New. diff --git a/frysk-core/frysk/bindir/ferror.java b/frysk-core/frysk/bindir/ferror.java index 52906bc..901ccf2 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 \"\""){ + Option option = new Option('e', "--error", "error regex to catch in double quotes -e \"\""){ public void parsed(String argument) throws OptionException { - errorString = argument; + writePattern = Pattern.compile(argument); } }; @@ -59,9 +61,13 @@ public class ferror { task.getMemory().get (address, 200, 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();