From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17765 invoked by alias); 20 Jun 2008 14:37:52 -0000 Received: (qmail 17738 invoked by uid 9697); 20 Jun 2008 14:37:51 -0000 Date: Fri, 20 Jun 2008 14:37:00 -0000 Message-ID: <20080620143751.17722.qmail@sourceware.org> From: pmachata@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Support periods in ftrace symbol names X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: c69c6ceede39e0ffa06f94321447a25e0d0e2b4d X-Git-Newrev: 99f1e6c3225f69f6559e33ed19a00eb2e01ca745 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-q2/txt/msg00390.txt.bz2 The branch, master has been updated via 99f1e6c3225f69f6559e33ed19a00eb2e01ca745 (commit) from c69c6ceede39e0ffa06f94321447a25e0d0e2b4d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 99f1e6c3225f69f6559e33ed19a00eb2e01ca745 Author: Petr Machata Date: Fri Jun 20 16:37:27 2008 +0200 Support periods in ftrace symbol names * Not possible for C expressions, otherwise #MAIN#a.b would become a pain to write. In ftrace we don't care about expressions, and periods are occasionally used in low-level symbol names (e.g. __i686.get_pc_thunk.bx) * So glob for "all symbols with period" is *.* -- MS-DOS anyone? ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/expr/CExpr.g | 2 +- frysk-core/frysk/expr/ChangeLog | 10 +++++++ frysk-core/frysk/expr/FQIdentParser.java | 39 ++++++++++++++++++----------- 3 files changed, 35 insertions(+), 16 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/expr/CExpr.g b/frysk-core/frysk/expr/CExpr.g index 0f528be..2654a89 100644 --- a/frysk-core/frysk/expr/CExpr.g +++ b/frysk-core/frysk/expr/CExpr.g @@ -416,7 +416,7 @@ tokens { final FQIdentParser fqIdParser - = new FQIdentParser(this, true, false, true); + = new FQIdentParser(this, true, false, true, false); } AMPERSAND : '&' ; diff --git a/frysk-core/frysk/expr/ChangeLog b/frysk-core/frysk/expr/ChangeLog index 2257a31..9816cdf 100644 --- a/frysk-core/frysk/expr/ChangeLog +++ b/frysk-core/frysk/expr/ChangeLog @@ -1,3 +1,13 @@ +2008-06-20 Petr Machata + + * FQIdentParser.java (ctor): Take extra argument + allowPeriodInSymbol. + (parseFtraceIdentifier): Pass true for the new argument. + (parseFQIdentifier): Likewise. + (symbolPattern, globPattern): Unstatic. + (symbolRe): Kill. + * CExpr.g (fqIdParser): Pass false for the new argument. + 2008-06-13 Petr Machata * FQIdentParser.java (containsGlobChar): Rename to diff --git a/frysk-core/frysk/expr/FQIdentParser.java b/frysk-core/frysk/expr/FQIdentParser.java index de521f9..2aa9ce2 100644 --- a/frysk-core/frysk/expr/FQIdentParser.java +++ b/frysk-core/frysk/expr/FQIdentParser.java @@ -70,17 +70,8 @@ public class FQIdentParser { private final boolean allowGlobs; private final boolean expectMoreTokens; - // This pattern deliberately doesn't check for initial letter. - // Relevant code checks this explicitly. This way, if user makes - // a mistake and writes e.g. something#123+b, we recognize "123" - // as a typo, while leaving out the part after a "+", which is - // certainly irrelevant. - final static String symbolRe = "[a-zA-Z0-9_$]+"; - - private final static Pattern symbolPattern = Pattern.compile(symbolRe); - private final static Pattern globPattern - = Pattern.compile("(\\[(\\^?\\][^\\]]*|\\^[^\\]]+|[^^\\]][^\\]]*|\\^?\\[:[^:]+:\\])\\]|" - + symbolRe + "|\\*)+"); + private final Pattern symbolPattern; + private final Pattern globPattern; /** * @param allowDynamic Whether the [pid.tid#frame] portion of the @@ -101,12 +92,28 @@ public class FQIdentParser { FQIdentParser(CharScanner scanner, boolean allowDynamic, boolean allowGlobs, - boolean expectMoreTokens) { + boolean expectMoreTokens, + boolean allowPeriodInSymbol) { this.scanner = scanner; this.allowDynamic = allowDynamic; this.allowGlobs = allowGlobs; this.expectMoreTokens = expectMoreTokens; + + // This pattern deliberately doesn't check for initial letter. + // Relevant code checks this explicitly. This way, if user makes + // a mistake and writes e.g. something#123+b, we recognize "123" + // as a typo, while leaving out the part after a "+", which is + // certainly irrelevant. + String symbolRe = "[a-zA-Z0-9_$" + (allowPeriodInSymbol + ? "." : "") + "]+"; + this.symbolPattern = Pattern.compile(symbolRe); + this.globPattern + = Pattern.compile("(\\[(\\^?\\][^\\]]*" + // handles []abc] and [^]abc] + "|\\^[^\\]]+" + // handles [^abc] + "|[^^\\]][^\\]]*" + // handles [abc], and [ab^c] (cases where ^ isn't an operator) + "|\\^?\\[:[^:]+:\\]"+ // handles [[:abc:]] and [^[:abc:]] + ")\\]|" + symbolRe + "|\\*)+"); } private char fqLA(int i) throws CharStreamException { @@ -383,7 +390,8 @@ public class FQIdentParser { parseFQIdentifier(String str, boolean allowDynamic, boolean allowGlobs, - boolean expectMoreTokens) + boolean expectMoreTokens, + boolean allowPeriodInSymbol) throws ExtraGarbageException, InvalidTokenException { try { @@ -395,7 +403,8 @@ public class FQIdentParser { }; FQIdentParser parser = new FQIdentParser(scanner, allowDynamic, - allowGlobs, expectMoreTokens); + allowGlobs, expectMoreTokens, + allowPeriodInSymbol); FQIdentToken tok = parser.parse(""); if (scanner.LA(1) != CharScanner.EOF_CHAR) @@ -415,6 +424,6 @@ public class FQIdentParser { public static FQIdentifier parseFtraceIdentifier(String str) throws ExtraGarbageException, InvalidTokenException { - return parseFQIdentifier(str, false, true, false); + return parseFQIdentifier(str, false, true, false, true); } } hooks/post-receive -- frysk system monitor/debugger