public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Support periods in ftrace symbol names
@ 2008-06-20 14:37 pmachata
  0 siblings, 0 replies; only message in thread
From: pmachata @ 2008-06-20 14:37 UTC (permalink / raw)
  To: frysk-cvs

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 <pmachata@redhat.com>
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  <pmachata@redhat.com>
+
+	* 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  <pmachata@redhat.com>
 
 	* 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


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

only message in thread, other threads:[~2008-06-20 14:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-20 14:37 [SCM] master: Support periods in ftrace symbol names 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).