diff options
Diffstat (limited to 'lldb/test/python_api/process')
-rw-r--r-- | lldb/test/python_api/process/TestProcessAPI.py | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/lldb/test/python_api/process/TestProcessAPI.py b/lldb/test/python_api/process/TestProcessAPI.py index 2c273e5b1ff..35bc0eba264 100644 --- a/lldb/test/python_api/process/TestProcessAPI.py +++ b/lldb/test/python_api/process/TestProcessAPI.py @@ -85,17 +85,11 @@ class ProcessAPITestCase(TestBase): val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal) self.DebugSBValue(val) - # If the variable does not have a load address, there's no sense continuing. - if not val.GetLocation().startswith("0x"): - return - - # OK, let's get the hex location of the variable. - location = int(val.GetLocation(), 16) - # Due to the typemap magic (see lldb.swig), we pass in 1 to ReadMemory and # expect to get a Python string as the result object! error = lldb.SBError() - content = process.ReadMemory(location, 1, error) + self.assertFalse(val.TypeIsPointerType()) + content = process.ReadMemory(val.AddressOf().GetValueAsUnsigned(), 1, error) if not error.Success(): self.fail("SBProcess.ReadMemory() failed") if self.TraceOn(): @@ -122,16 +116,10 @@ class ProcessAPITestCase(TestBase): val = frame.FindValue("my_cstring", lldb.eValueTypeVariableGlobal) self.DebugSBValue(val) - # If the variable does not have a load address, there's no sense continuing. - if not val.GetLocation().startswith("0x"): - return - - # OK, let's get the hex location of the variable. - location = int(val.GetLocation(), 16) - # Due to the typemap magic (see lldb.swig), we pass in 256 to read at most 256 bytes # from the address, and expect to get a Python string as the result object! - cstring = process.ReadCStringFromMemory(location, 256, error) + self.assertFalse(val.TypeIsPointerType()) + cstring = process.ReadCStringFromMemory(val.AddressOf().GetValueAsUnsigned(), 256, error) if not error.Success(): self.fail("SBProcess.ReadCStringFromMemory() failed") if self.TraceOn(): @@ -145,16 +133,10 @@ class ProcessAPITestCase(TestBase): val = frame.FindValue("my_uint32", lldb.eValueTypeVariableGlobal) self.DebugSBValue(val) - # If the variable does not have a load address, there's no sense continuing. - if not val.GetLocation().startswith("0x"): - return - - # OK, let's get the hex location of the variable. - location = int(val.GetLocation(), 16) - - # Due to the typemap magic (see lldb.swig), we pass in 4 to read at 4 bytes + # Due to the typemap magic (see lldb.swig), we pass in 4 to read 4 bytes # from the address, and expect to get an int as the result! - my_uint32 = process.ReadUnsignedFromMemory(location, 4, error) + self.assertFalse(val.TypeIsPointerType()) + my_uint32 = process.ReadUnsignedFromMemory(val.AddressOf().GetValueAsUnsigned(), 4, error) if not error.Success(): self.fail("SBProcess.ReadCStringFromMemory() failed") if self.TraceOn(): |