2011-03-01 10:20:14 +08:00
|
|
|
"""
|
2011-03-02 02:51:47 +08:00
|
|
|
Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others.
|
2011-03-01 10:20:14 +08:00
|
|
|
"""
|
|
|
|
|
|
|
|
import os, time
|
|
|
|
import unittest2
|
|
|
|
import lldb
|
2011-04-28 01:43:07 +08:00
|
|
|
from lldbutil import get_stopped_thread, state_type_to_str
|
2011-03-01 10:20:14 +08:00
|
|
|
from lldbtest import *
|
|
|
|
|
|
|
|
class ProcessAPITestCase(TestBase):
|
|
|
|
|
2013-12-11 07:19:29 +08:00
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
2011-03-01 10:20:14 +08:00
|
|
|
|
2015-03-30 22:12:17 +08:00
|
|
|
@skipUnlessDarwin
|
2011-03-02 02:51:47 +08:00
|
|
|
@python_api_test
|
2012-04-07 03:54:10 +08:00
|
|
|
@dsym_test
|
2011-03-02 02:51:47 +08:00
|
|
|
def test_read_memory_with_dsym(self):
|
|
|
|
"""Test Python SBProcess.ReadMemory() API."""
|
|
|
|
self.buildDsym()
|
|
|
|
self.read_memory()
|
|
|
|
|
|
|
|
@python_api_test
|
2012-04-07 03:54:10 +08:00
|
|
|
@dwarf_test
|
2011-03-02 02:51:47 +08:00
|
|
|
def test_read_memory_with_dwarf(self):
|
|
|
|
"""Test Python SBProcess.ReadMemory() API."""
|
|
|
|
self.buildDwarf()
|
|
|
|
self.read_memory()
|
2011-03-01 10:20:14 +08:00
|
|
|
|
2015-03-30 22:12:17 +08:00
|
|
|
@skipUnlessDarwin
|
2011-03-01 10:20:14 +08:00
|
|
|
@python_api_test
|
2012-04-07 03:54:10 +08:00
|
|
|
@dsym_test
|
2011-03-02 02:51:47 +08:00
|
|
|
def test_write_memory_with_dsym(self):
|
|
|
|
"""Test Python SBProcess.WriteMemory() API."""
|
2011-03-01 10:20:14 +08:00
|
|
|
self.buildDsym()
|
2011-03-02 02:51:47 +08:00
|
|
|
self.write_memory()
|
2011-03-01 10:20:14 +08:00
|
|
|
|
|
|
|
@python_api_test
|
2012-04-07 03:54:10 +08:00
|
|
|
@dwarf_test
|
2011-03-02 02:51:47 +08:00
|
|
|
def test_write_memory_with_dwarf(self):
|
|
|
|
"""Test Python SBProcess.WriteMemory() API."""
|
2011-03-01 10:20:14 +08:00
|
|
|
self.buildDwarf()
|
2011-03-02 02:51:47 +08:00
|
|
|
self.write_memory()
|
2011-03-01 10:20:14 +08:00
|
|
|
|
2015-03-30 22:12:17 +08:00
|
|
|
@skipUnlessDarwin
|
2011-03-02 06:56:31 +08:00
|
|
|
@python_api_test
|
2012-04-07 03:54:10 +08:00
|
|
|
@dsym_test
|
2011-03-02 06:56:31 +08:00
|
|
|
def test_access_my_int_with_dsym(self):
|
|
|
|
"""Test access 'my_int' using Python SBProcess.GetByteOrder() and other APIs."""
|
|
|
|
self.buildDsym()
|
|
|
|
self.access_my_int()
|
|
|
|
|
|
|
|
@python_api_test
|
2012-04-07 03:54:10 +08:00
|
|
|
@dwarf_test
|
2011-03-02 06:56:31 +08:00
|
|
|
def test_access_my_int_with_dwarf(self):
|
|
|
|
"""Test access 'my_int' using Python SBProcess.GetByteOrder() and other APIs."""
|
|
|
|
self.buildDwarf()
|
|
|
|
self.access_my_int()
|
|
|
|
|
2011-03-05 09:20:11 +08:00
|
|
|
@python_api_test
|
|
|
|
def test_remote_launch(self):
|
|
|
|
"""Test SBProcess.RemoteLaunch() API with a process not in eStateConnected, and it should fail."""
|
|
|
|
self.buildDefault()
|
|
|
|
self.remote_launch_should_fail()
|
|
|
|
|
2012-05-24 06:34:34 +08:00
|
|
|
@python_api_test
|
|
|
|
def test_get_num_supported_hardware_watchpoints(self):
|
|
|
|
"""Test SBProcess.GetNumSupportedHardwareWatchpoints() API with a process."""
|
|
|
|
self.buildDefault()
|
|
|
|
self.get_num_supported_hardware_watchpoints()
|
|
|
|
|
2011-03-01 10:20:14 +08:00
|
|
|
def setUp(self):
|
|
|
|
# Call super's setUp().
|
|
|
|
TestBase.setUp(self)
|
|
|
|
# Find the line number to break inside main().
|
|
|
|
self.line = line_number("main.cpp", "// Set break point at this line and check variable 'my_char'.")
|
|
|
|
|
2011-03-02 02:51:47 +08:00
|
|
|
def read_memory(self):
|
|
|
|
"""Test Python SBProcess.ReadMemory() API."""
|
2011-03-01 10:20:14 +08:00
|
|
|
exe = os.path.join(os.getcwd(), "a.out")
|
|
|
|
|
|
|
|
target = self.dbg.CreateTarget(exe)
|
2011-05-25 02:22:45 +08:00
|
|
|
self.assertTrue(target, VALID_TARGET)
|
2011-03-01 10:20:14 +08:00
|
|
|
|
|
|
|
breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
|
2011-05-25 02:22:45 +08:00
|
|
|
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
2011-03-01 10:20:14 +08:00
|
|
|
|
|
|
|
# Launch the process, and do not stop at the entry point.
|
2013-12-14 03:18:59 +08:00
|
|
|
process = target.LaunchSimple (None, None, self.get_process_working_directory())
|
2011-03-01 10:20:14 +08:00
|
|
|
|
2011-06-16 06:14:12 +08:00
|
|
|
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
2013-03-20 01:59:30 +08:00
|
|
|
self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
|
2011-03-03 09:41:57 +08:00
|
|
|
frame = thread.GetFrameAtIndex(0)
|
2011-03-01 10:20:14 +08:00
|
|
|
|
|
|
|
# Get the SBValue for the global variable 'my_char'.
|
|
|
|
val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal)
|
2011-07-12 04:06:28 +08:00
|
|
|
self.DebugSBValue(val)
|
2011-03-01 10:20:14 +08:00
|
|
|
|
|
|
|
# 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!
|
2011-07-12 07:38:23 +08:00
|
|
|
error = lldb.SBError()
|
2011-12-16 09:56:27 +08:00
|
|
|
self.assertFalse(val.TypeIsPointerType())
|
|
|
|
content = process.ReadMemory(val.AddressOf().GetValueAsUnsigned(), 1, error)
|
2011-03-02 02:51:47 +08:00
|
|
|
if not error.Success():
|
|
|
|
self.fail("SBProcess.ReadMemory() failed")
|
2011-04-20 03:49:09 +08:00
|
|
|
if self.TraceOn():
|
|
|
|
print "memory content:", content
|
2011-03-01 10:20:14 +08:00
|
|
|
|
|
|
|
self.expect(content, "Result from SBProcess.ReadMemory() matches our expected output: 'x'",
|
|
|
|
exe=False,
|
|
|
|
startstr = 'x')
|
|
|
|
|
2011-12-16 08:25:30 +08:00
|
|
|
# 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?')
|
|
|
|
|
2011-12-16 07:30:05 +08:00
|
|
|
# Get the SBValue for the global variable 'my_cstring'.
|
|
|
|
val = frame.FindValue("my_cstring", lldb.eValueTypeVariableGlobal)
|
|
|
|
self.DebugSBValue(val)
|
|
|
|
|
|
|
|
# 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!
|
2011-12-16 09:56:27 +08:00
|
|
|
self.assertFalse(val.TypeIsPointerType())
|
|
|
|
cstring = process.ReadCStringFromMemory(val.AddressOf().GetValueAsUnsigned(), 256, error)
|
2011-12-16 07:30:05 +08:00
|
|
|
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 = 'lldb.SBProcess.ReadCStringFromMemory() works!')
|
|
|
|
|
|
|
|
# Get the SBValue for the global variable 'my_uint32'.
|
|
|
|
val = frame.FindValue("my_uint32", lldb.eValueTypeVariableGlobal)
|
|
|
|
self.DebugSBValue(val)
|
|
|
|
|
2011-12-16 09:56:27 +08:00
|
|
|
# Due to the typemap magic (see lldb.swig), we pass in 4 to read 4 bytes
|
2011-12-16 07:30:05 +08:00
|
|
|
# from the address, and expect to get an int as the result!
|
2011-12-16 09:56:27 +08:00
|
|
|
self.assertFalse(val.TypeIsPointerType())
|
|
|
|
my_uint32 = process.ReadUnsignedFromMemory(val.AddressOf().GetValueAsUnsigned(), 4, error)
|
2011-12-16 07:30:05 +08:00
|
|
|
if not error.Success():
|
|
|
|
self.fail("SBProcess.ReadCStringFromMemory() failed")
|
|
|
|
if self.TraceOn():
|
|
|
|
print "uint32 read is:", my_uint32
|
|
|
|
|
|
|
|
if my_uint32 != 12345:
|
|
|
|
self.fail("Result from SBProcess.ReadUnsignedFromMemory() does not match our expected output")
|
|
|
|
|
2011-03-02 02:51:47 +08:00
|
|
|
def write_memory(self):
|
|
|
|
"""Test Python SBProcess.WriteMemory() API."""
|
|
|
|
exe = os.path.join(os.getcwd(), "a.out")
|
|
|
|
|
|
|
|
target = self.dbg.CreateTarget(exe)
|
2011-05-25 02:22:45 +08:00
|
|
|
self.assertTrue(target, VALID_TARGET)
|
2011-03-02 02:51:47 +08:00
|
|
|
|
|
|
|
breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
|
2011-05-25 02:22:45 +08:00
|
|
|
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
2011-03-02 02:51:47 +08:00
|
|
|
|
|
|
|
# Launch the process, and do not stop at the entry point.
|
2013-12-14 03:18:59 +08:00
|
|
|
process = target.LaunchSimple (None, None, self.get_process_working_directory())
|
2011-03-02 02:51:47 +08:00
|
|
|
|
2011-06-16 06:14:12 +08:00
|
|
|
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
2013-03-20 01:59:30 +08:00
|
|
|
self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
|
2011-03-03 09:41:57 +08:00
|
|
|
frame = thread.GetFrameAtIndex(0)
|
2011-03-02 02:51:47 +08:00
|
|
|
|
|
|
|
# Get the SBValue for the global variable 'my_char'.
|
|
|
|
val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal)
|
2011-07-12 04:06:28 +08:00
|
|
|
self.DebugSBValue(val)
|
2011-03-02 02:51:47 +08:00
|
|
|
|
|
|
|
# If the variable does not have a load address, there's no sense continuing.
|
2011-08-04 06:57:10 +08:00
|
|
|
if not val.GetLocation().startswith("0x"):
|
2011-03-02 02:51:47 +08:00
|
|
|
return
|
|
|
|
|
|
|
|
# OK, let's get the hex location of the variable.
|
2011-08-04 06:57:10 +08:00
|
|
|
location = int(val.GetLocation(), 16)
|
2011-03-02 02:51:47 +08:00
|
|
|
|
|
|
|
# The program logic makes the 'my_char' variable to have memory content as 'x'.
|
|
|
|
# But we want to use the WriteMemory() API to assign 'a' to the variable.
|
|
|
|
|
|
|
|
# Now use WriteMemory() API to write 'a' into the global variable.
|
2011-07-12 07:38:23 +08:00
|
|
|
error = lldb.SBError()
|
2011-06-16 06:14:12 +08:00
|
|
|
result = process.WriteMemory(location, 'a', error)
|
2011-03-02 02:51:47 +08:00
|
|
|
if not error.Success() or result != 1:
|
|
|
|
self.fail("SBProcess.WriteMemory() failed")
|
|
|
|
|
|
|
|
# Read from the memory location. This time it should be 'a'.
|
|
|
|
# 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!
|
2011-06-16 06:14:12 +08:00
|
|
|
content = process.ReadMemory(location, 1, error)
|
2011-03-02 02:51:47 +08:00
|
|
|
if not error.Success():
|
|
|
|
self.fail("SBProcess.ReadMemory() failed")
|
2011-04-20 03:49:09 +08:00
|
|
|
if self.TraceOn():
|
|
|
|
print "memory content:", content
|
2011-03-02 02:51:47 +08:00
|
|
|
|
|
|
|
self.expect(content, "Result from SBProcess.ReadMemory() matches our expected output: 'a'",
|
|
|
|
exe=False,
|
|
|
|
startstr = 'a')
|
2011-03-01 10:20:14 +08:00
|
|
|
|
2011-03-02 06:56:31 +08:00
|
|
|
def access_my_int(self):
|
|
|
|
"""Test access 'my_int' using Python SBProcess.GetByteOrder() and other APIs."""
|
|
|
|
exe = os.path.join(os.getcwd(), "a.out")
|
|
|
|
|
|
|
|
target = self.dbg.CreateTarget(exe)
|
2011-05-25 02:22:45 +08:00
|
|
|
self.assertTrue(target, VALID_TARGET)
|
2011-03-02 06:56:31 +08:00
|
|
|
|
|
|
|
breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
|
2011-05-25 02:22:45 +08:00
|
|
|
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
2011-03-02 06:56:31 +08:00
|
|
|
|
|
|
|
# Launch the process, and do not stop at the entry point.
|
2013-12-14 03:18:59 +08:00
|
|
|
process = target.LaunchSimple (None, None, self.get_process_working_directory())
|
2011-03-02 06:56:31 +08:00
|
|
|
|
2011-06-16 06:14:12 +08:00
|
|
|
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
2013-03-20 01:59:30 +08:00
|
|
|
self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
|
2011-03-03 09:41:57 +08:00
|
|
|
frame = thread.GetFrameAtIndex(0)
|
2011-03-02 06:56:31 +08:00
|
|
|
|
|
|
|
# Get the SBValue for the global variable 'my_int'.
|
|
|
|
val = frame.FindValue("my_int", lldb.eValueTypeVariableGlobal)
|
2011-07-12 04:06:28 +08:00
|
|
|
self.DebugSBValue(val)
|
2011-03-02 06:56:31 +08:00
|
|
|
|
|
|
|
# If the variable does not have a load address, there's no sense continuing.
|
2011-08-04 06:57:10 +08:00
|
|
|
if not val.GetLocation().startswith("0x"):
|
2011-03-02 06:56:31 +08:00
|
|
|
return
|
|
|
|
|
|
|
|
# OK, let's get the hex location of the variable.
|
2011-08-04 06:57:10 +08:00
|
|
|
location = int(val.GetLocation(), 16)
|
2011-03-02 06:56:31 +08:00
|
|
|
|
2011-03-03 03:49:27 +08:00
|
|
|
# Note that the canonical from of the bytearray is little endian.
|
2011-03-02 09:36:45 +08:00
|
|
|
from lldbutil import int_to_bytearray, bytearray_to_int
|
2011-03-03 03:49:27 +08:00
|
|
|
|
2011-03-02 06:56:31 +08:00
|
|
|
byteSize = val.GetByteSize()
|
2011-03-02 09:36:45 +08:00
|
|
|
bytes = int_to_bytearray(256, byteSize)
|
2011-03-02 06:56:31 +08:00
|
|
|
|
2011-06-16 06:14:12 +08:00
|
|
|
byteOrder = process.GetByteOrder()
|
2011-03-02 06:56:31 +08:00
|
|
|
if byteOrder == lldb.eByteOrderBig:
|
2011-03-02 09:36:45 +08:00
|
|
|
bytes.reverse()
|
2011-03-02 06:56:31 +08:00
|
|
|
elif byteOrder == lldb.eByteOrderLittle:
|
2011-03-02 09:36:45 +08:00
|
|
|
pass
|
2011-03-02 06:56:31 +08:00
|
|
|
else:
|
|
|
|
# Neither big endian nor little endian? Return for now.
|
2011-03-02 09:36:45 +08:00
|
|
|
# Add more logic here if we want to handle other types.
|
2011-03-02 06:56:31 +08:00
|
|
|
return
|
|
|
|
|
|
|
|
# The program logic makes the 'my_int' variable to have int type and value of 0.
|
|
|
|
# But we want to use the WriteMemory() API to assign 256 to the variable.
|
|
|
|
|
|
|
|
# Now use WriteMemory() API to write 256 into the global variable.
|
|
|
|
new_value = str(bytes)
|
2011-07-12 07:38:23 +08:00
|
|
|
error = lldb.SBError()
|
2011-06-16 06:14:12 +08:00
|
|
|
result = process.WriteMemory(location, new_value, error)
|
2011-03-02 06:56:31 +08:00
|
|
|
if not error.Success() or result != byteSize:
|
|
|
|
self.fail("SBProcess.WriteMemory() failed")
|
|
|
|
|
2011-04-16 08:01:13 +08:00
|
|
|
# Make sure that the val we got originally updates itself to notice the change:
|
2011-08-04 06:57:10 +08:00
|
|
|
self.expect(val.GetValue(),
|
2011-04-16 08:01:13 +08:00
|
|
|
"SBProcess.ReadMemory() successfully writes (int)256 to the memory location for 'my_int'",
|
|
|
|
exe=False,
|
|
|
|
startstr = '256')
|
|
|
|
|
|
|
|
# And for grins, get the SBValue for the global variable 'my_int' again, to make sure that also tracks the new value:
|
2011-03-02 06:56:31 +08:00
|
|
|
val = frame.FindValue("my_int", lldb.eValueTypeVariableGlobal)
|
2011-08-04 06:57:10 +08:00
|
|
|
self.expect(val.GetValue(),
|
2011-03-02 06:56:31 +08:00
|
|
|
"SBProcess.ReadMemory() successfully writes (int)256 to the memory location for 'my_int'",
|
|
|
|
exe=False,
|
|
|
|
startstr = '256')
|
|
|
|
|
|
|
|
# Now read the memory content. The bytearray should have (byte)1 as the second element.
|
2011-06-16 06:14:12 +08:00
|
|
|
content = process.ReadMemory(location, byteSize, error)
|
2011-03-02 06:56:31 +08:00
|
|
|
if not error.Success():
|
|
|
|
self.fail("SBProcess.ReadMemory() failed")
|
2011-03-03 03:49:27 +08:00
|
|
|
|
|
|
|
# Use "ascii" as the encoding because each element of 'content' is in the range [0..255].
|
2011-03-02 06:56:31 +08:00
|
|
|
new_bytes = bytearray(content, "ascii")
|
2011-03-02 09:36:45 +08:00
|
|
|
|
|
|
|
# The bytearray_to_int utility function expects a little endian bytearray.
|
2011-03-02 06:56:31 +08:00
|
|
|
if byteOrder == lldb.eByteOrderBig:
|
2011-03-02 09:36:45 +08:00
|
|
|
new_bytes.reverse()
|
|
|
|
|
|
|
|
new_value = bytearray_to_int(new_bytes, byteSize)
|
|
|
|
if new_value != 256:
|
|
|
|
self.fail("Memory content read from 'my_int' does not match (int)256")
|
2011-03-02 06:56:31 +08:00
|
|
|
|
|
|
|
# Dump the memory content....
|
2011-04-20 03:49:09 +08:00
|
|
|
if self.TraceOn():
|
|
|
|
for i in new_bytes:
|
|
|
|
print "byte:", i
|
2011-03-02 06:56:31 +08:00
|
|
|
|
2011-03-05 09:20:11 +08:00
|
|
|
def remote_launch_should_fail(self):
|
|
|
|
"""Test SBProcess.RemoteLaunch() API with a process not in eStateConnected, and it should fail."""
|
|
|
|
exe = os.path.join(os.getcwd(), "a.out")
|
|
|
|
|
|
|
|
target = self.dbg.CreateTarget(exe)
|
2011-05-25 02:22:45 +08:00
|
|
|
self.assertTrue(target, VALID_TARGET)
|
2011-03-05 09:20:11 +08:00
|
|
|
|
|
|
|
# Launch the process, and do not stop at the entry point.
|
2013-12-14 03:18:59 +08:00
|
|
|
process = target.LaunchSimple (None, None, self.get_process_working_directory())
|
2011-03-05 09:20:11 +08:00
|
|
|
|
2011-04-20 03:49:09 +08:00
|
|
|
if self.TraceOn():
|
2011-04-28 01:43:07 +08:00
|
|
|
print "process state:", state_type_to_str(process.GetState())
|
2011-03-05 09:20:11 +08:00
|
|
|
self.assertTrue(process.GetState() != lldb.eStateConnected)
|
|
|
|
|
2011-07-12 07:38:23 +08:00
|
|
|
error = lldb.SBError()
|
2011-03-05 09:20:11 +08:00
|
|
|
success = process.RemoteLaunch(None, None, None, None, None, None, 0, False, error)
|
|
|
|
self.assertTrue(not success, "RemoteLaunch() should fail for process state != eStateConnected")
|
|
|
|
|
2012-05-24 06:34:34 +08:00
|
|
|
def get_num_supported_hardware_watchpoints(self):
|
|
|
|
"""Test SBProcess.GetNumSupportedHardwareWatchpoints() API with a process."""
|
|
|
|
exe = os.path.join(os.getcwd(), "a.out")
|
|
|
|
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
|
|
|
|
|
|
|
target = self.dbg.CreateTarget(exe)
|
|
|
|
self.assertTrue(target, VALID_TARGET)
|
|
|
|
|
|
|
|
breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
|
|
|
|
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
|
|
|
|
|
|
|
# Launch the process, and do not stop at the entry point.
|
2013-12-14 03:18:59 +08:00
|
|
|
process = target.LaunchSimple (None, None, self.get_process_working_directory())
|
2012-05-24 06:34:34 +08:00
|
|
|
|
|
|
|
error = lldb.SBError();
|
|
|
|
num = process.GetNumSupportedHardwareWatchpoints(error)
|
|
|
|
if self.TraceOn() and error.Success():
|
|
|
|
print "Number of supported hardware watchpoints: %d" % num
|
|
|
|
|
2011-03-01 10:20:14 +08:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import atexit
|
|
|
|
lldb.SBDebugger.Initialize()
|
|
|
|
atexit.register(lambda: lldb.SBDebugger.Terminate())
|
|
|
|
unittest2.main()
|