[Lldb-commits] [lldb] r115995 - in /lldb/trunk/test: class_types/TestClassTypes.py lldbtest.py lldbutil.py threads/TestPrintStackTraces.py
Johnny Chen
johnny.chen at apple.com
Thu Oct 7 15:15:59 PDT 2010
Author: johnny
Date: Thu Oct 7 17:15:58 2010
New Revision: 115995
URL: http://llvm.org/viewvc/llvm-project?rev=115995&view=rev
Log:
Move the enum to string utility functions from lldbtest.py to lldbuti.py and
update the affected API clients.
Modified:
lldb/trunk/test/class_types/TestClassTypes.py
lldb/trunk/test/lldbtest.py
lldb/trunk/test/lldbutil.py
lldb/trunk/test/threads/TestPrintStackTraces.py
Modified: lldb/trunk/test/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypes.py?rev=115995&r1=115994&r2=115995&view=diff
==============================================================================
--- lldb/trunk/test/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/class_types/TestClassTypes.py Thu Oct 7 17:15:58 2010
@@ -115,7 +115,7 @@
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()))
+ lldbutil.StateTypeString(self.process.GetState()))
# The stop reason of the thread should be breakpoint.
thread = self.process.GetThreadAtIndex(0)
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=115995&r1=115994&r2=115995&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Oct 7 17:15:58 2010
@@ -165,58 +165,6 @@
return "'%s' compares successfully" % str
#
-# Returns the stateType string given an enum.
-#
-def StateTypeString(enum):
- if enum == lldb.eStateInvalid:
- return "Invalid"
- elif enum == lldb.eStateUnloaded:
- return "Unloaded"
- elif enum == lldb.eStateAttaching:
- return "Attaching"
- elif enum == lldb.eStateLaunching:
- return "Launching"
- elif enum == lldb.eStateStopped:
- return "Stopped"
- elif enum == lldb.eStateRunning:
- return "Running"
- elif enum == lldb.eStateStepping:
- return "Stepping"
- elif enum == lldb.eStateCrashed:
- return "Crashed"
- elif enum == lldb.eStateDetached:
- return "Detached"
- elif enum == lldb.eStateExited:
- return "Exited"
- elif enum == lldb.eStateSuspended:
- return "Suspended"
- else:
- raise Exception("Unknown stopReason enum")
-
-#
-# Returns the stopReason string given an enum.
-#
-def StopReasonString(enum):
- if enum == lldb.eStopReasonInvalid:
- return "Invalid"
- elif enum == lldb.eStopReasonNone:
- return "None"
- elif enum == lldb.eStopReasonTrace:
- return "Trace"
- elif enum == lldb.eStopReasonBreakpoint:
- return "Breakpoint"
- elif enum == lldb.eStopReasonWatchpoint:
- return "Watchpoint"
- elif enum == lldb.eStopReasonSignal:
- return "Signal"
- elif enum == lldb.eStopReasonException:
- return "Exception"
- elif enum == lldb.eStopReasonPlanComplete:
- return "PlanComplete"
- else:
- raise Exception("Unknown stopReason enum")
-
-#
# Returns an env variable array from the os.environ map object.
#
def EnvArray():
Modified: lldb/trunk/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=115995&r1=115994&r2=115995&view=diff
==============================================================================
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py Thu Oct 7 17:15:58 2010
@@ -6,6 +6,67 @@
import sys
import StringIO
+########################################################
+# #
+# Convert some enum value to its string's counterpart. #
+# #
+########################################################
+
+def StateTypeString(enum):
+ """Returns the stateType string given an enum."""
+ if enum == lldb.eStateInvalid:
+ return "Invalid"
+ elif enum == lldb.eStateUnloaded:
+ return "Unloaded"
+ elif enum == lldb.eStateAttaching:
+ return "Attaching"
+ elif enum == lldb.eStateLaunching:
+ return "Launching"
+ elif enum == lldb.eStateStopped:
+ return "Stopped"
+ elif enum == lldb.eStateRunning:
+ return "Running"
+ elif enum == lldb.eStateStepping:
+ return "Stepping"
+ elif enum == lldb.eStateCrashed:
+ return "Crashed"
+ elif enum == lldb.eStateDetached:
+ return "Detached"
+ elif enum == lldb.eStateExited:
+ return "Exited"
+ elif enum == lldb.eStateSuspended:
+ return "Suspended"
+ else:
+ raise Exception("Unknown stopReason enum")
+
+def StopReasonString(enum):
+ """Returns the stopReason string given an enum."""
+ if enum == lldb.eStopReasonInvalid:
+ return "Invalid"
+ elif enum == lldb.eStopReasonNone:
+ return "None"
+ elif enum == lldb.eStopReasonTrace:
+ return "Trace"
+ elif enum == lldb.eStopReasonBreakpoint:
+ return "Breakpoint"
+ elif enum == lldb.eStopReasonWatchpoint:
+ return "Watchpoint"
+ elif enum == lldb.eStopReasonSignal:
+ return "Signal"
+ elif enum == lldb.eStopReasonException:
+ return "Exception"
+ elif enum == lldb.eStopReasonPlanComplete:
+ return "PlanComplete"
+ else:
+ raise Exception("Unknown stopReason enum")
+
+
+#######################################################
+# #
+# Utility functions related to Threads and Processes. #
+# #
+#######################################################
+
def GetFunctionNames(thread):
"""
Returns a sequence of function names from the stack frames of this thread.
Modified: lldb/trunk/test/threads/TestPrintStackTraces.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/threads/TestPrintStackTraces.py?rev=115995&r1=115994&r2=115995&view=diff
==============================================================================
--- lldb/trunk/test/threads/TestPrintStackTraces.py (original)
+++ lldb/trunk/test/threads/TestPrintStackTraces.py Thu Oct 7 17:15:58 2010
@@ -37,7 +37,7 @@
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()))
+ lldbutil.StateTypeString(self.process.GetState()))
import lldbutil
lldbutil.PrintStackTraces(self.process)
More information about the lldb-commits
mailing list