Add a test sequence of SBProcess.ReadCStringFromMemory() with (char *)my_char_ptr as the address to read from.

char *my_char_ptr = (char *)"Does it work?";

llvm-svn: 146716
This commit is contained in:
Johnny Chen
2011-12-16 00:25:30 +00:00
parent caa69f0570
commit e7e8af807a
2 changed files with 14 additions and 0 deletions

View File

@@ -105,6 +105,19 @@ class ProcessAPITestCase(TestBase):
exe=False,
startstr = 'x')
# Read (char *)my_char_ptr.
val = frame.FindValue("my_char_ptr", lldb.eValueTypeVariableGlobal)
self.DebugSBValue(val)
cstring = process.ReadCStringFromMemory(val.GetValueAsUnsigned(), 256, error)
if not error.Success():
self.fail("SBProcess.ReadCStringFromMemory() failed")
if self.TraceOn():
print "cstring read is:", cstring
self.expect(cstring, "Result from SBProcess.ReadCStringFromMemory() matches our expected output",
exe=False,
startstr = 'Does it work?')
# Get the SBValue for the global variable 'my_cstring'.
val = frame.FindValue("my_cstring", lldb.eValueTypeVariableGlobal)
self.DebugSBValue(val)