Clean up the StateType and StopReason enums now that they reside in the lldb module.

llvm-svn: 115922
This commit is contained in:
Johnny Chen 2010-10-07 16:51:56 +00:00
parent ac1ffa27b6
commit c5b06ebe82
5 changed files with 25 additions and 78 deletions

View File

@ -114,7 +114,7 @@ class ArrayTypesTestCase(TestBase):
# 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.

View File

@ -93,7 +93,7 @@ class BitfieldsTestCase(TestBase):
# 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.

View File

@ -112,7 +112,7 @@ class ClassTypesTestCase(TestBase):
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 @@ class ClassTypesTestCase(TestBase):
# 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.

View File

@ -69,7 +69,7 @@ class HelloWorldTestCase(TestBase):
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.

View File

@ -164,106 +164,54 @@ def CMD_MSG(str, exe):
else:
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")