Change the rest of lldbutil.py's function names to all lower case formats to be consistent.

And modify the test cases accordingly.

llvm-svn: 130314
This commit is contained in:
Johnny Chen 2011-04-27 17:43:07 +00:00
parent 71d3b895ba
commit de90f1dd93
13 changed files with 32 additions and 32 deletions

View File

@ -124,9 +124,9 @@ class ArrayTypesTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
thread = self.process.GetThreadAtIndex(0)
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
from lldbutil import StopReasonString
from lldbutil import stop_reason_to_str
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
StopReasonString(thread.GetStopReason()))
stop_reason_to_str(thread.GetStopReason()))
# Sanity check the print representation of thread.
thr = repr(thread)
@ -201,15 +201,15 @@ class ArrayTypesTestCase(TestBase):
# Last, check that "long_6" has a value type of eValueTypeVariableLocal
# and "argc" has eValueTypeVariableArgument.
from lldbutil import ValueTypeString
from lldbutil import value_type_to_str
self.assertTrue(variable.GetValueType() == lldb.eValueTypeVariableLocal,
"Variable 'long_6' should have '%s' value type." %
ValueTypeString(lldb.eValueTypeVariableLocal))
value_type_to_str(lldb.eValueTypeVariableLocal))
argc = frame.FindVariable("argc")
self.DebugSBValue(frame, argc)
self.assertTrue(argc.GetValueType() == lldb.eValueTypeVariableArgument,
"Variable 'argc' should have '%s' value type." %
ValueTypeString(lldb.eValueTypeVariableArgument))
value_type_to_str(lldb.eValueTypeVariableArgument))
if __name__ == '__main__':

View File

@ -100,9 +100,9 @@ class BitfieldsTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
thread = target.GetProcess().GetThreadAtIndex(0)
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
from lldbutil import StopReasonString
from lldbutil import stop_reason_to_str
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
StopReasonString(thread.GetStopReason()))
stop_reason_to_str(thread.GetStopReason()))
# The breakpoint should have a hit count of 1.
self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)

View File

@ -88,9 +88,9 @@ class StaticVariableTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
thread = self.process.GetThreadAtIndex(0)
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
from lldbutil import StopReasonString
from lldbutil import stop_reason_to_str
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
StopReasonString(thread.GetStopReason()))
stop_reason_to_str(thread.GetStopReason()))
# Get the SBValue of 'A::g_points' and 'g_points'.
frame = thread.GetFrameAtIndex(0)

View File

@ -129,14 +129,14 @@ class ClassTypesTestCase(TestBase):
if self.process.GetState() != lldb.eStateStopped:
self.fail("Process should be in the 'stopped' state, "
"instead the actual state is: '%s'" %
lldbutil.StateTypeString(self.process.GetState()))
lldbutil.state_type_to_str(self.process.GetState()))
# The stop reason of the thread should be breakpoint.
thread = self.process.GetThreadAtIndex(0)
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
from lldbutil import StopReasonString
from lldbutil import stop_reason_to_str
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
StopReasonString(thread.GetStopReason()))
stop_reason_to_str(thread.GetStopReason()))
# The filename of frame #0 should be 'main.cpp' and the line number
# should be 93.

View File

@ -109,14 +109,14 @@ class BasicExprCommandsTestCase(TestBase):
if self.process.GetState() != lldb.eStateStopped:
self.fail("Process should be in the 'stopped' state, "
"instead the actual state is: '%s'" %
lldbutil.StateTypeString(self.process.GetState()))
lldbutil.state_type_to_str(self.process.GetState()))
# The stop reason of the thread should be breakpoint.
thread = self.process.GetThreadAtIndex(0)
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
from lldbutil import StopReasonString
from lldbutil import stop_reason_to_str
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
StopReasonString(thread.GetStopReason()))
stop_reason_to_str(thread.GetStopReason()))
# The filename of frame #0 should be 'main.cpp' and function is main.
self.expect(lldbutil.get_filenames(thread)[0],

View File

@ -220,9 +220,9 @@ class FoundationTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
thread = self.process.GetThreadAtIndex(0)
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
from lldbutil import StopReasonString
from lldbutil import stop_reason_to_str
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
StopReasonString(thread.GetStopReason()))
stop_reason_to_str(thread.GetStopReason()))
# Make sure we stopped at the first breakpoint.

View File

@ -71,9 +71,9 @@ class HelloWorldTestCase(TestBase):
thread = self.process.GetThreadAtIndex(0)
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
from lldbutil import StopReasonString
from lldbutil import stop_reason_to_str
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
StopReasonString(thread.GetStopReason()))
stop_reason_to_str(thread.GetStopReason()))
# The breakpoint should have a hit count of 1.
self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)

View File

@ -64,7 +64,7 @@ class CrashingInferiorTestCase(TestBase):
if self.process.GetState() != lldb.eStateStopped:
self.fail("Process should be in the 'stopped' state, "
"instead the actual state is: '%s'" %
lldbutil.StateTypeString(self.process.GetState()))
lldbutil.state_type_to_str(self.process.GetState()))
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonException)
if not thread:

View File

@ -863,7 +863,7 @@ class TestBase(unittest2.TestCase):
thread = process.GetThreadAtIndex(0)
SR = thread.GetStopReason()
with recording(self, trace) as sbuf:
print >> sbuf, "StopReason =", StopReasonString(SR)
print >> sbuf, "StopReason =", stop_reason_to_str(SR)
if SR == StopReasonEnum("Breakpoint"):
frame = thread.GetFrameAtIndex(0)
@ -932,7 +932,7 @@ class TestBase(unittest2.TestCase):
def DebugSBValue(self, frame, val):
"""Debug print a SBValue object, if traceAlways is True."""
from lldbutil import ValueTypeString
from lldbutil import value_type_to_str
if not traceAlways:
return
@ -943,7 +943,7 @@ class TestBase(unittest2.TestCase):
err.write('\t' + "ByteSize -> " + str(val.GetByteSize()) + '\n')
err.write('\t' + "NumChildren -> " + str(val.GetNumChildren()) + '\n')
err.write('\t' + "Value -> " + str(val.GetValue(frame)) + '\n')
err.write('\t' + "ValueType -> " + ValueTypeString(val.GetValueType()) + '\n')
err.write('\t' + "ValueType -> " + value_type_to_str(val.GetValueType()) + '\n')
err.write('\t' + "Summary -> " + str(val.GetSummary(frame)) + '\n')
err.write('\t' + "IsPointerType -> " + str(val.TypeIsPointerType()) + '\n')
err.write('\t' + "Location -> " + val.GetLocation(frame) + '\n')

View File

@ -166,7 +166,7 @@ def get_description(obj, option=None):
# Convert some enum value to its string counterpart
# =================================================
def StateTypeString(enum):
def state_type_to_str(enum):
"""Returns the stateType string given an enum."""
if enum == lldb.eStateInvalid:
return "invalid"
@ -195,7 +195,7 @@ def StateTypeString(enum):
else:
raise Exception("Unknown StateType enum")
def StopReasonString(enum):
def stop_reason_to_str(enum):
"""Returns the stopReason string given an enum."""
if enum == lldb.eStopReasonInvalid:
return "invalid"
@ -216,7 +216,7 @@ def StopReasonString(enum):
else:
raise Exception("Unknown StopReason enum")
def ValueTypeString(enum):
def value_type_to_str(enum):
"""Returns the valueType string given an enum."""
if enum == lldb.eValueTypeInvalid:
return "invalid"
@ -404,7 +404,7 @@ def print_stacktrace(thread, string_buffer = False):
addrs = get_pc_addresses(thread)
if thread.GetStopReason() != lldb.eStopReasonInvalid:
desc = "stop reason=" + StopReasonString(thread.GetStopReason())
desc = "stop reason=" + stop_reason_to_str(thread.GetStopReason())
else:
desc = ""
print >> output, "Stack trace for thread id={0:#x} name={1} queue={2} ".format(

View File

@ -71,9 +71,9 @@ class TestObjCStepping(TestBase):
# The stop reason of the thread should be breakpoint.
thread = self.process.GetThreadAtIndex(0)
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
from lldbutil import StopReasonString
from lldbutil import stop_reason_to_str
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
StopReasonString(thread.GetStopReason()))
stop_reason_to_str(thread.GetStopReason()))
# Make sure we stopped at the first breakpoint.

View File

@ -44,7 +44,7 @@ class ThreadsStackTracesTestCase(TestBase):
if self.process.GetState() != lldb.eStateStopped:
self.fail("Process should be in the 'stopped' state, "
"instead the actual state is: '%s'" %
lldbutil.StateTypeString(self.process.GetState()))
lldbutil.state_type_to_str(self.process.GetState()))
if self.TraceOn():
lldbutil.print_stacktraces(self.process)

View File

@ -5,7 +5,7 @@ Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others.
import os, time
import unittest2
import lldb
from lldbutil import get_stopped_thread, StateTypeString
from lldbutil import get_stopped_thread, state_type_to_str
from lldbtest import *
class ProcessAPITestCase(TestBase):
@ -258,7 +258,7 @@ class ProcessAPITestCase(TestBase):
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
if self.TraceOn():
print "process state:", StateTypeString(process.GetState())
print "process state:", state_type_to_str(process.GetState())
self.assertTrue(process.GetState() != lldb.eStateConnected)
success = process.RemoteLaunch(None, None, None, None, None, None, 0, False, error)