[Lldb-commits] [lldb] r115397 - /lldb/trunk/test/foundation/TestDisassemble.py

Johnny Chen johnny.chen at apple.com
Fri Oct 1 18:23:40 PDT 2010


Author: johnny
Date: Fri Oct  1 20:23:40 2010
New Revision: 115397

URL: http://llvm.org/viewvc/llvm-project?rev=115397&view=rev
Log:
Use a more robust regexp to search for the 'Code' symbol.  Plus compile the
regexp once and use it within the for loop for some speedup.

Modified:
    lldb/trunk/test/foundation/TestDisassemble.py

Modified: lldb/trunk/test/foundation/TestDisassemble.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/foundation/TestDisassemble.py?rev=115397&r1=115396&r2=115397&view=diff
==============================================================================
--- lldb/trunk/test/foundation/TestDisassemble.py (original)
+++ lldb/trunk/test/foundation/TestDisassemble.py Fri Oct  1 20:23:40 2010
@@ -34,10 +34,19 @@
         self.assertTrue(match, "Foundation.framework path located")
         self.runCmd("image dump symtab %s" % foundation_framework)
         raw_output = self.res.GetOutput()
-        # Now, grab every 'Code' symbol and feed it into the 'disassemble -n func' command.
+        # Now, grab every 'Code' symbol and feed it into the command:
+        # 'disassemble -n func'.
+        #
+        # The symbol name is on the last column and trails the flag column which
+        # looks like '0xhhhhhhhh', i.e., 8 hexadecimal digits.
+        codeRE = re.compile(r"""
+                             \ Code\ {9}    # ' Code' followed by 9 SPCs,
+                             .*             # the wildcard chars,
+                             0x[0-9a-f]{8}  # the flag column, and
+                             \ (.+)$        # finally the function symbol.
+                             """, re.VERBOSE)
         for line in raw_output.split(os.linesep):
-            # The symbol name is on the last column and trails the flag column which ends with '0000'.
-            match = re.search(" Code         .+0000 (.+)$", line)
+            match = codeRE.search(line)
             if match:
                 func = match.group(1)
                 #print "line:", line





More information about the lldb-commits mailing list