From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31063 invoked by alias); 29 Feb 2008 17:39:55 -0000 Received: (qmail 31036 invoked by uid 9697); 29 Feb 2008 17:39:55 -0000 Date: Fri, 29 Feb 2008 17:39:00 -0000 Message-ID: <20080229173955.31020.qmail@sourceware.org> From: pmachata@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Signals and syscalls are case insensitive, leading "sig" is optional X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 71bf7fec6d61c9c72ab11f33e9c327e2e88ca5fc X-Git-Newrev: 75075802814e005513057faa5bb15441638ee327 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q1/txt/msg00290.txt.bz2 The branch, master has been updated via 75075802814e005513057faa5bb15441638ee327 (commit) via c805e006d8bc42d0daeae0088be510a65f0f2932 (commit) from 71bf7fec6d61c9c72ab11f33e9c327e2e88ca5fc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 75075802814e005513057faa5bb15441638ee327 Author: Petr Machata Date: Fri Feb 29 18:39:26 2008 +0100 Signals and syscalls are case insensitive, leading "sig" is optional commit c805e006d8bc42d0daeae0088be510a65f0f2932 Author: Petr Machata Date: Fri Feb 29 18:38:36 2008 +0100 Allow Pattern options to be passed to Glob compiler. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/bindir/ChangeLog | 6 ++++++ frysk-core/frysk/bindir/ftrace.java | 13 +++++++++---- frysk-core/frysk/bindir/ftrace.xml | 15 +++++++++------ frysk-core/frysk/util/ChangeLog | 4 ++++ frysk-core/frysk/util/Glob.java | 4 ++++ 5 files changed, 32 insertions(+), 10 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog index 629f309..70362ce 100644 --- a/frysk-core/frysk/bindir/ChangeLog +++ b/frysk-core/frysk/bindir/ChangeLog @@ -1,5 +1,11 @@ 2008-02-29 Petr Machata + * ftrace.java (parseSigSysRules): Produce case insensitive rules, + allow optional prefix for signals (i.e. sigkill == KILL). + * ftrace.xml: Update. + +2008-02-29 Petr Machata + * ftrace.java: Support signal tracing, cleanups. (SyscallRule): Deleted class. (ByNumberSyscallRule): Deleted class. diff --git a/frysk-core/frysk/bindir/ftrace.java b/frysk-core/frysk/bindir/ftrace.java index 35c76da..f886410 100644 --- a/frysk-core/frysk/bindir/ftrace.java +++ b/frysk-core/frysk/bindir/ftrace.java @@ -466,7 +466,9 @@ class ftrace String traceableName(Object traceable); } - private List parseSigSysRules(String arg, final TraceableExaminer examiner) { + private List parseSigSysRules(String arg, final TraceableExaminer examiner, + String optionalPrefix) + { String[] strs = arg.split(",", -1); Pattern sysnumPat = Pattern.compile("[0-9]+"); List rules = new ArrayList(); @@ -504,7 +506,10 @@ class ftrace } else if (!str.equals("")) { logger.log(Level.FINE, i + ": " + str + ": by name rule"); - final Pattern pattern = Glob.compile(str); + str = str.toLowerCase(); + if (optionalPrefix != null && !str.startsWith(optionalPrefix)) + str = optionalPrefix + str; + final Pattern pattern = Glob.compile(str, Pattern.CASE_INSENSITIVE); rule = new Rule(addition, stackTrace) { public boolean matches(final Object traceable) { String name = examiner.traceableName(traceable); @@ -677,7 +682,7 @@ class ftrace }; for (Iterator it = sysRules.iterator(); it.hasNext(); ) controller.gotSysRules(parseSigSysRules((String)it.next(), - syscallExaminer)); + syscallExaminer, null)); tracer.setTraceSyscalls(controller); } @@ -692,7 +697,7 @@ class ftrace }; for (Iterator it = sigRules.iterator(); it.hasNext(); ) controller.gotSigRules(parseSigSysRules((String)it.next(), - signalExaminer)); + signalExaminer, "sig")); tracer.setTraceSignals(controller); } diff --git a/frysk-core/frysk/bindir/ftrace.xml b/frysk-core/frysk/bindir/ftrace.xml index 1719f77..0beeabc 100644 --- a/frysk-core/frysk/bindir/ftrace.xml +++ b/frysk-core/frysk/bindir/ftrace.xml @@ -308,17 +308,18 @@ Event selection pattern syntax is then as follows: - syscall name|syscall number - SIGNAME|signal number + event name|event number When the pattern is empty, then it matches all events known to frysk. When the pattern is simple number (e.g. "12"), then the pattern matches the event with the given - number. Otherwise the pattern is considered to be written using - glob syntax, and matched against event names. + number. Otherwise the pattern is considered to be + case-insensitive glob, and matched against event names. Whole + name has to match for event to be part of working set. - Signal names have to be given in upper case and include the - leading "SIG". + Signal can be given both with and without leading + "sig" (e.g. "sigkill" as well as + "kill"). @@ -329,6 +330,8 @@ ftrace -sys= ls Trace variants of stat system call and moreover a system call #3: ftrace -sys='*stat*,3' ls + Various ways to tell ftrace that you want to stack trace on SIGUSR1: + ftrace -sig=#USR1,#usr1,#SIGUSR1,#sigusr1,#10 ~/sig Trace all library calls: ftrace -plt= ls Trace all library calls to functions that contain diff --git a/frysk-core/frysk/util/ChangeLog b/frysk-core/frysk/util/ChangeLog index a4de4ff..ba686d2 100644 --- a/frysk-core/frysk/util/ChangeLog +++ b/frysk-core/frysk/util/ChangeLog @@ -1,3 +1,7 @@ +2008-02-29 Petr Machata + + * Glob.java (compile(String, int)): New method. + 2008-02-29 Andrew Cagney * Glob.java: Extracted from frysk.bindir.ftrace. diff --git a/frysk-core/frysk/util/Glob.java b/frysk-core/frysk/util/Glob.java index 8cd8bdc..acf93d3 100644 --- a/frysk-core/frysk/util/Glob.java +++ b/frysk-core/frysk/util/Glob.java @@ -122,4 +122,8 @@ public class Glob { public static Pattern compile(String glob) { return Pattern.compile(toRegex(glob)); } + + public static Pattern compile(String glob, int flags) { + return Pattern.compile(toRegex(glob), flags); + } } hooks/post-receive -- frysk system monitor/debugger