[Lldb-commits] [lldb] r115922 - in /lldb/trunk/test: array_types/TestArrayTypes.py bitfields/TestBitfields.py class_types/TestClassTypes.py hello_world/TestHelloWorld.py lldbtest.py

Johnny Chen johnny.chen at apple.com
Thu Oct 7 09:51:56 PDT 2010


Author: johnny
Date: Thu Oct  7 11:51:56 2010
New Revision: 115922

URL: http://llvm.org/viewvc/llvm-project?rev=115922&view=rev
Log:
Clean up the StateType and StopReason enums now that they reside in the lldb module.

Modified:
    lldb/trunk/test/array_types/TestArrayTypes.py
    lldb/trunk/test/bitfields/TestBitfields.py
    lldb/trunk/test/class_types/TestClassTypes.py
    lldb/trunk/test/hello_world/TestHelloWorld.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/array_types/TestArrayTypes.py?rev=115922&r1=115921&r2=115922&view=diff
==============================================================================
--- lldb/trunk/test/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/array_types/TestArrayTypes.py Thu Oct  7 11:51:56 2010
@@ -114,7 +114,7 @@
 
         # The stop reason of the thread should be breakpoint.
         thread = self.process.GetThreadAtIndex(0)
-        self.assertTrue(thread.GetStopReason() == StopReasonEnum("Breakpoint"),
+        self.assertTrue(thread.GetStopReason() == lldb.eStopReasonBreakpoint,
                         STOPPED_DUE_TO_BREAKPOINT)
 
         # Sanity check the print representation of thread.

Modified: lldb/trunk/test/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/bitfields/TestBitfields.py?rev=115922&r1=115921&r2=115922&view=diff
==============================================================================
--- lldb/trunk/test/bitfields/TestBitfields.py (original)
+++ lldb/trunk/test/bitfields/TestBitfields.py Thu Oct  7 11:51:56 2010
@@ -93,7 +93,7 @@
 
         # The stop reason of the thread should be breakpoint.
         thread = target.GetProcess().GetThreadAtIndex(0)
-        self.assertTrue(thread.GetStopReason() == StopReasonEnum("Breakpoint"),
+        self.assertTrue(thread.GetStopReason() == lldb.eStopReasonBreakpoint,
                         STOPPED_DUE_TO_BREAKPOINT)
 
         # The breakpoint should have a hit count of 1.

Modified: lldb/trunk/test/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypes.py?rev=115922&r1=115921&r2=115922&view=diff
==============================================================================
--- lldb/trunk/test/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/class_types/TestClassTypes.py Thu Oct  7 11:51:56 2010
@@ -112,7 +112,7 @@
         if not rc.Success() or not self.process.IsValid():
             self.fail("SBTarget.LaunchProcess() failed")
 
-        if self.process.GetState() != StateTypeEnum("Stopped"):
+        if self.process.GetState() != lldb.eStateStopped:
             self.fail("Process should be in the 'Stopped' state, "
                       "instead the actual state is: '%s'" %
                       StateTypeString(self.process.GetState()))
@@ -120,9 +120,8 @@
         # The stop reason of the thread should be breakpoint.
         thread = self.process.GetThreadAtIndex(0)
 
-        self.expect(StopReasonString(thread.GetStopReason()),
-                    STOPPED_DUE_TO_BREAKPOINT, exe=False,
-            startstr = "Breakpoint")
+        self.assertTrue(thread.GetStopReason() == lldb.eStopReasonBreakpoint,
+                        STOPPED_DUE_TO_BREAKPOINT)
 
         # The filename of frame #0 should be 'main.cpp' and the line number
         # should be 93.

Modified: lldb/trunk/test/hello_world/TestHelloWorld.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/hello_world/TestHelloWorld.py?rev=115922&r1=115921&r2=115922&view=diff
==============================================================================
--- lldb/trunk/test/hello_world/TestHelloWorld.py (original)
+++ lldb/trunk/test/hello_world/TestHelloWorld.py Thu Oct  7 11:51:56 2010
@@ -69,7 +69,7 @@
         self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID)
 
         thread = self.process.GetThreadAtIndex(0)
-        self.assertTrue(thread.GetStopReason() == StopReasonEnum("Breakpoint"),
+        self.assertTrue(thread.GetStopReason() == lldb.eStopReasonBreakpoint,
                         STOPPED_DUE_TO_BREAKPOINT)
 
         # The breakpoint should have a hit count of 1.

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=115922&r1=115921&r2=115922&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Oct  7 11:51:56 2010
@@ -165,105 +165,53 @@
         return "'%s' compares successfully" % str
 
 #
-# Returns the enum from the input string.
-#
-def StateTypeEnum(string):
-    if string == "Invalid":
-        return 0
-    elif string == "Unloaded":
-        return 1
-    elif string == "Attaching":
-        return 2
-    elif string == "Launching":
-        return 3
-    elif string == "Stopped":
-        return 4
-    elif string == "Running":
-        return 5
-    elif string == "Stepping":
-        return 6
-    elif string == "Crashed":
-        return 7
-    elif string == "Detached":
-        return 8
-    elif string == "Exited":
-        return 9
-    elif string == "Suspended":
-        return 10
-    else:
-        raise Exception("Unknown stateType string")
-
-#
 # Returns the stateType string given an enum.
 #
 def StateTypeString(enum):
-    if enum == 0:
+    if enum == lldb.eStateInvalid:
         return "Invalid"
-    elif enum == 1:
+    elif enum == lldb.eStateUnloaded:
         return "Unloaded"
-    elif enum == 2:
+    elif enum == lldb.eStateAttaching:
         return "Attaching"
-    elif enum == 3:
+    elif enum == lldb.eStateLaunching:
         return "Launching"
-    elif enum == 4:
+    elif enum == lldb.eStateStopped:
         return "Stopped"
-    elif enum == 5:
+    elif enum == lldb.eStateRunning:
         return "Running"
-    elif enum == 6:
+    elif enum == lldb.eStateStepping:
         return "Stepping"
-    elif enum == 7:
+    elif enum == lldb.eStateCrashed:
         return "Crashed"
-    elif enum == 8:
+    elif enum == lldb.eStateDetached:
         return "Detached"
-    elif enum == 9:
+    elif enum == lldb.eStateExited:
         return "Exited"
-    elif enum == 10:
+    elif enum == lldb.eStateSuspended:
         return "Suspended"
     else:
         raise Exception("Unknown stopReason enum")
 
 #
-# Returns the enum from the input string.
-#
-def StopReasonEnum(string):
-    if string == "Invalid":
-        return 0
-    elif string == "None":
-        return 1
-    elif string == "Trace":
-        return 2
-    elif string == "Breakpoint":
-        return 3
-    elif string == "Watchpoint":
-        return 4
-    elif string == "Signal":
-        return 5
-    elif string == "Exception":
-        return 6
-    elif string == "PlanComplete":
-        return 7
-    else:
-        raise Exception("Unknown stopReason string")
-
-#
 # Returns the stopReason string given an enum.
 #
 def StopReasonString(enum):
-    if enum == 0:
+    if enum == lldb.eStopReasonInvalid:
         return "Invalid"
-    elif enum == 1:
+    elif enum == lldb.eStopReasonNone:
         return "None"
-    elif enum == 2:
+    elif enum == lldb.eStopReasonTrace:
         return "Trace"
-    elif enum == 3:
+    elif enum == lldb.eStopReasonBreakpoint:
         return "Breakpoint"
-    elif enum == 4:
+    elif enum == lldb.eStopReasonWatchpoint:
         return "Watchpoint"
-    elif enum == 5:
+    elif enum == lldb.eStopReasonSignal:
         return "Signal"
-    elif enum == 6:
+    elif enum == lldb.eStopReasonException:
         return "Exception"
-    elif enum == 7:
+    elif enum == lldb.eStopReasonPlanComplete:
         return "PlanComplete"
     else:
         raise Exception("Unknown stopReason enum")





More information about the lldb-commits mailing list