diff options
Diffstat (limited to 'lldb/test/API/python_api/process/TestProcessAPI.py')
| -rw-r--r-- | lldb/test/API/python_api/process/TestProcessAPI.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/process/TestProcessAPI.py b/lldb/test/API/python_api/process/TestProcessAPI.py index c56053dad0cf..edb507057283 100644 --- a/lldb/test/API/python_api/process/TestProcessAPI.py +++ b/lldb/test/API/python_api/process/TestProcessAPI.py @@ -186,6 +186,32 @@ class ProcessAPITestCase(TestBase): exe=False, startstr=b'a') + # Get the SBValue for the global variable 'my_cstring'. + val = frame.FindValue("my_cstring", lldb.eValueTypeVariableGlobal) + self.DebugSBValue(val) + + addr = val.AddressOf().GetValueAsUnsigned() + + # Write an empty string to memory + bytes_written = process.WriteMemoryAsCString(addr, "", error) + self.assertEqual(bytes_written, 0) + if not error.Success(): + self.fail("SBProcess.WriteMemoryAsCString() failed") + + message = "Hello!" + bytes_written = process.WriteMemoryAsCString(addr, message, error) + self.assertEqual(bytes_written, len(message) + 1) + if not error.Success(): + self.fail("SBProcess.WriteMemoryAsCString() failed") + + cstring = process.ReadCStringFromMemory( + val.AddressOf().GetValueAsUnsigned(), 256, error) + if not error.Success(): + self.fail("SBProcess.ReadCStringFromMemory() failed") + + self.assertEqual(cstring, message) + + def test_access_my_int(self): """Test access 'my_int' using Python SBProcess.GetByteOrder() and other APIs.""" self.build() |
