forked from OSchip/llvm-project
The extra burden for the Python API test case to assign its process object to self.process
in order to have its process cleaned up (terminated) upon tearDown is gone for good. Let's simplify a bunch of Python API test cases. llvm-svn: 133097
This commit is contained in:
parent
c20b1393e1
commit
5a0bee7c5f
|
@ -110,19 +110,17 @@ class ArrayTypesTestCase(TestBase):
|
|||
substrs = ["resolved = 1"])
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Sanity check the print representation of process.
|
||||
proc = repr(self.process)
|
||||
proc = repr(process)
|
||||
self.expect(proc, msg="Process looks good", exe=False,
|
||||
substrs = ["state = stopped",
|
||||
"executable = a.out"])
|
||||
|
||||
# The stop reason of the thread should be breakpoint.
|
||||
thread = self.process.GetThreadAtIndex(0)
|
||||
thread = process.GetThreadAtIndex(0)
|
||||
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
|
||||
from lldbutil import stop_reason_to_str
|
||||
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
|
||||
|
|
|
@ -94,8 +94,8 @@ class BitfieldsTestCase(TestBase):
|
|||
breakpoint = target.BreakpointCreateByLocation("main.c", self.line)
|
||||
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
||||
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# The stop reason of the thread should be breakpoint.
|
||||
thread = target.GetProcess().GetThreadAtIndex(0)
|
||||
|
|
|
@ -139,14 +139,12 @@ class BreakpointConditionsTestCase(TestBase):
|
|||
startstr = 'val == 3')
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Frame #0 should be on self.line1 and the break condition should hold.
|
||||
from lldbutil import get_stopped_thread
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonPlanComplete)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonPlanComplete)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
var = frame0.FindValue('val', lldb.eValueTypeVariableArgument)
|
||||
|
@ -156,7 +154,7 @@ class BreakpointConditionsTestCase(TestBase):
|
|||
# The hit count for the breakpoint should be 3.
|
||||
self.assertTrue(breakpoint.GetHitCount() == 3)
|
||||
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -101,16 +101,14 @@ class BreakpointIgnoreCountTestCase(TestBase):
|
|||
"SetIgnoreCount() works correctly")
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Frame#0 should be on main.c:37, frame#1 should be on main.c:25, and
|
||||
# frame#2 should be on main.c:48.
|
||||
#lldbutil.print_stacktraces(self.process)
|
||||
#lldbutil.print_stacktraces(process)
|
||||
from lldbutil import get_stopped_thread
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
frame1 = thread.GetFrameAtIndex(1)
|
||||
|
@ -123,7 +121,7 @@ class BreakpointIgnoreCountTestCase(TestBase):
|
|||
# The hit count for the breakpoint should be 3.
|
||||
self.assertTrue(breakpoint.GetHitCount() == 3)
|
||||
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -80,13 +80,11 @@ class StaticVariableTestCase(TestBase):
|
|||
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# The stop reason of the thread should be breakpoint.
|
||||
thread = self.process.GetThreadAtIndex(0)
|
||||
thread = process.GetThreadAtIndex(0)
|
||||
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
|
||||
from lldbutil import stop_reason_to_str
|
||||
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
|
||||
|
|
|
@ -120,18 +120,18 @@ class ClassTypesTestCase(TestBase):
|
|||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
error = lldb.SBError()
|
||||
self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
|
||||
if not error.Success() or not self.process:
|
||||
if not error.Success() or not process:
|
||||
self.fail("SBTarget.Launch() failed")
|
||||
|
||||
if self.process.GetState() != lldb.eStateStopped:
|
||||
if process.GetState() != lldb.eStateStopped:
|
||||
self.fail("Process should be in the 'stopped' state, "
|
||||
"instead the actual state is: '%s'" %
|
||||
lldbutil.state_type_to_str(self.process.GetState()))
|
||||
lldbutil.state_type_to_str(process.GetState()))
|
||||
|
||||
# The stop reason of the thread should be breakpoint.
|
||||
thread = self.process.GetThreadAtIndex(0)
|
||||
thread = process.GetThreadAtIndex(0)
|
||||
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
|
||||
from lldbutil import stop_reason_to_str
|
||||
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
|
||||
|
@ -149,7 +149,7 @@ class ClassTypesTestCase(TestBase):
|
|||
# We should be stopped on the breakpoint with a hit count of 1.
|
||||
self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)
|
||||
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
|
||||
def class_types_expr_parser(self):
|
||||
"""Test 'frame variable this' and 'expr this' when stopped inside a constructor."""
|
||||
|
|
|
@ -53,12 +53,12 @@ class ConditionalBreakTestCase(TestBase):
|
|||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
error = lldb.SBError()
|
||||
self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
|
||||
self.assertTrue(error.Success() and self.process, PROCESS_IS_VALID)
|
||||
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
|
||||
|
||||
# The stop reason of the thread should be breakpoint.
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped,
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped,
|
||||
STOPPED_DUE_TO_BREAKPOINT)
|
||||
|
||||
# Find the line number where a's parent frame function is c.
|
||||
|
@ -72,7 +72,7 @@ class ConditionalBreakTestCase(TestBase):
|
|||
# The 10 in range(10) is just an arbitrary number, which means we would
|
||||
# like to try for at most 10 times.
|
||||
for j in range(10):
|
||||
thread = self.process.GetThreadAtIndex(0)
|
||||
thread = process.GetThreadAtIndex(0)
|
||||
|
||||
if thread.GetNumFrames() >= 2:
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
|
@ -94,7 +94,7 @@ class ConditionalBreakTestCase(TestBase):
|
|||
self.assertTrue(val.GetValue(frame1) == "3", "'val' has a value of 3")
|
||||
break
|
||||
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
|
||||
def simulate_conditional_break_by_user(self):
|
||||
"""Simulate a user using lldb commands to break on c() if called from a()."""
|
||||
|
|
|
@ -114,12 +114,12 @@ class DynamicValueTestCase(TestBase):
|
|||
VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at the entry point.
|
||||
self.process = target.LaunchSimple (None, None, os.getcwd())
|
||||
process = target.LaunchSimple (None, None, os.getcwd())
|
||||
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped,
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped,
|
||||
PROCESS_STOPPED)
|
||||
|
||||
threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, first_call_bpt)
|
||||
threads = lldbutil.get_threads_stopped_at_breakpoint (process, first_call_bpt)
|
||||
self.assertTrue (len(threads) == 1)
|
||||
thread = threads[0]
|
||||
|
||||
|
@ -141,7 +141,7 @@ class DynamicValueTestCase(TestBase):
|
|||
|
||||
# Okay now run to doSomething:
|
||||
|
||||
threads = lldbutil.continue_to_breakpoint (self.process, do_something_bpt)
|
||||
threads = lldbutil.continue_to_breakpoint (process, do_something_bpt)
|
||||
self.assertTrue (len(threads) == 1)
|
||||
thread = threads[0]
|
||||
|
||||
|
@ -194,7 +194,7 @@ class DynamicValueTestCase(TestBase):
|
|||
|
||||
# Okay, now continue again, and when we hit the second breakpoint in main
|
||||
|
||||
threads = lldbutil.continue_to_breakpoint (self.process, second_call_bpt)
|
||||
threads = lldbutil.continue_to_breakpoint (process, second_call_bpt)
|
||||
self.assertTrue (len(threads) == 1)
|
||||
thread = threads[0]
|
||||
|
||||
|
@ -206,7 +206,7 @@ class DynamicValueTestCase(TestBase):
|
|||
# Finally continue to doSomething again, and make sure we get the right value for anotherA,
|
||||
# which this time around is just an "A".
|
||||
|
||||
threads = lldbutil.continue_to_breakpoint (self.process, do_something_bpt)
|
||||
threads = lldbutil.continue_to_breakpoint (process, do_something_bpt)
|
||||
self.assertTrue(len(threads) == 1)
|
||||
thread = threads[0]
|
||||
|
||||
|
|
|
@ -101,18 +101,18 @@ class BasicExprCommandsTestCase(TestBase):
|
|||
# Launch the process, and do not stop at the entry point.
|
||||
# Pass 'X Y Z' as the args, which makes argc == 4.
|
||||
error = lldb.SBError()
|
||||
self.process = target.Launch(self.dbg.GetListener(), ['X', 'Y', 'Z'], None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
process = target.Launch(self.dbg.GetListener(), ['X', 'Y', 'Z'], None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
|
||||
if not error.Success() or not self.process:
|
||||
if not error.Success() or not process:
|
||||
self.fail("SBTarget.LaunchProcess() failed")
|
||||
|
||||
if self.process.GetState() != lldb.eStateStopped:
|
||||
if process.GetState() != lldb.eStateStopped:
|
||||
self.fail("Process should be in the 'stopped' state, "
|
||||
"instead the actual state is: '%s'" %
|
||||
lldbutil.state_type_to_str(self.process.GetState()))
|
||||
lldbutil.state_type_to_str(process.GetState()))
|
||||
|
||||
# The stop reason of the thread should be breakpoint.
|
||||
thread = self.process.GetThreadAtIndex(0)
|
||||
thread = process.GetThreadAtIndex(0)
|
||||
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
|
||||
from lldbutil import stop_reason_to_str
|
||||
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
|
||||
|
|
|
@ -213,12 +213,12 @@ class FoundationTestCase(TestBase):
|
|||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
error = lldb.SBError()
|
||||
self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# The stop reason of the thread should be breakpoint.
|
||||
thread = self.process.GetThreadAtIndex(0)
|
||||
thread = process.GetThreadAtIndex(0)
|
||||
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
|
||||
from lldbutil import stop_reason_to_str
|
||||
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
|
||||
|
|
|
@ -62,10 +62,10 @@ class HelloWorldTestCase(TestBase):
|
|||
# On the other hand, the following line of code are more reliable.
|
||||
self.runCmd("run")
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.GetProcess()
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
thread = self.process.GetThreadAtIndex(0)
|
||||
thread = process.GetThreadAtIndex(0)
|
||||
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
|
||||
from lldbutil import stop_reason_to_str
|
||||
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
|
||||
|
|
|
@ -58,15 +58,15 @@ class CrashingInferiorTestCase(TestBase):
|
|||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
# Both argv and envp are null.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
import lldbutil
|
||||
if self.process.GetState() != lldb.eStateStopped:
|
||||
if process.GetState() != lldb.eStateStopped:
|
||||
self.fail("Process should be in the 'stopped' state, "
|
||||
"instead the actual state is: '%s'" %
|
||||
lldbutil.state_type_to_str(self.process.GetState()))
|
||||
lldbutil.state_type_to_str(process.GetState()))
|
||||
|
||||
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonException)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonException)
|
||||
if not thread:
|
||||
self.fail("Fail to stop the thread upon bad access exception")
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ def get_stopped_thread(process, reason):
|
|||
|
||||
...
|
||||
from lldbutil import get_stopped_thread
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonPlanComplete)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonPlanComplete)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
|
||||
...
|
||||
|
||||
|
@ -238,7 +238,7 @@ def get_stopped_thread(process, reason):
|
|||
|
||||
...
|
||||
from lldbutil import get_stopped_thread
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
|
||||
...
|
||||
|
||||
|
|
|
@ -67,12 +67,12 @@ class ObjCDynamicValueTestCase(TestBase):
|
|||
VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at the entry point.
|
||||
self.process = target.LaunchSimple (None, None, os.getcwd())
|
||||
process = target.LaunchSimple (None, None, os.getcwd())
|
||||
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped,
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped,
|
||||
PROCESS_STOPPED)
|
||||
|
||||
threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, main_before_setProperty_bkpt)
|
||||
threads = lldbutil.get_threads_stopped_at_breakpoint (process, main_before_setProperty_bkpt)
|
||||
self.assertTrue (len(threads) == 1)
|
||||
thread = threads[0]
|
||||
|
||||
|
@ -99,7 +99,7 @@ class ObjCDynamicValueTestCase(TestBase):
|
|||
|
||||
thread.StepInto()
|
||||
|
||||
threads = lldbutil.get_stopped_threads (self.process, lldb.eStopReasonPlanComplete)
|
||||
threads = lldbutil.get_stopped_threads (process, lldb.eStopReasonPlanComplete)
|
||||
self.assertTrue (len(threads) == 1)
|
||||
line_entry = threads[0].GetFrameAtIndex(0).GetLineEntry()
|
||||
self.assertTrue (line_entry.GetLine() == self.set_property_line)
|
||||
|
@ -107,7 +107,7 @@ class ObjCDynamicValueTestCase(TestBase):
|
|||
|
||||
# Okay, back to the main business. Continue to the handle_SourceBase and make sure we get the correct dynamic value.
|
||||
|
||||
threads = lldbutil.continue_to_breakpoint (self.process, handle_SourceBase_bkpt)
|
||||
threads = lldbutil.continue_to_breakpoint (process, handle_SourceBase_bkpt)
|
||||
self.assertTrue (len(threads) == 1)
|
||||
thread = threads[0]
|
||||
|
||||
|
@ -142,7 +142,7 @@ class ObjCDynamicValueTestCase(TestBase):
|
|||
# This one looks exactly the same, but in fact this is an "un-KVO'ed" version of SourceBase, so
|
||||
# its isa pointer points to SourceBase not NSKVOSourceBase or whatever...
|
||||
|
||||
threads = lldbutil.continue_to_breakpoint (self.process, handle_SourceBase_bkpt)
|
||||
threads = lldbutil.continue_to_breakpoint (process, handle_SourceBase_bkpt)
|
||||
self.assertTrue (len(threads) == 1)
|
||||
thread = threads[0]
|
||||
|
||||
|
|
|
@ -64,12 +64,12 @@ class TestObjCStepping(TestBase):
|
|||
self.assertTrue(break_returnStruct_call_super, VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
self.process = target.LaunchSimple (None, None, os.getcwd())
|
||||
process = target.LaunchSimple (None, None, os.getcwd())
|
||||
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# The stop reason of the thread should be breakpoint.
|
||||
thread = self.process.GetThreadAtIndex(0)
|
||||
thread = process.GetThreadAtIndex(0)
|
||||
if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
|
||||
from lldbutil import stop_reason_to_str
|
||||
self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
|
||||
|
@ -100,7 +100,7 @@ class TestObjCStepping(TestBase):
|
|||
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
|
||||
self.assertTrue (line_number == self.sourceBase_randomMethod_line, "Stepped through super into SourceBase randomMethod.")
|
||||
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
|
||||
self.assertTrue (line_number == self.line2, "Continued to second breakpoint in main.")
|
||||
|
||||
|
@ -109,7 +109,7 @@ class TestObjCStepping(TestBase):
|
|||
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
|
||||
self.assertTrue (line_number == self.source_returnsStruct_start_line, "Stepped into Source returnsStruct.")
|
||||
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
|
||||
self.assertTrue (line_number == self.source_returnsStruct_call_line, "Stepped to the call super line in Source returnsStruct.")
|
||||
|
||||
|
@ -120,7 +120,7 @@ class TestObjCStepping(TestBase):
|
|||
# Cool now continue to get past the call that intializes the Observer, and then do our steps in again to see that
|
||||
# we can find our way when we're stepping through a KVO swizzled object.
|
||||
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
frame = thread.GetFrameAtIndex(0)
|
||||
line_number = frame.GetLineEntry().GetLine()
|
||||
self.assertTrue (line_number == self.line3, "Continued to third breakpoint in main, our object should now be swizzled.")
|
||||
|
@ -140,7 +140,7 @@ class TestObjCStepping(TestBase):
|
|||
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
|
||||
self.assertTrue (line_number == self.sourceBase_randomMethod_line, "Stepped through super into SourceBase randomMethod in swizzled object.")
|
||||
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
|
||||
self.assertTrue (line_number == self.line4, "Continued to fourth breakpoint in main.")
|
||||
|
||||
|
@ -149,7 +149,7 @@ class TestObjCStepping(TestBase):
|
|||
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
|
||||
self.assertTrue (line_number == self.source_returnsStruct_start_line, "Stepped into Source returnsStruct in swizzled object.")
|
||||
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
|
||||
self.assertTrue (line_number == self.source_returnsStruct_call_line, "Stepped to the call super line in Source returnsStruct - second time.")
|
||||
|
||||
|
|
|
@ -64,13 +64,11 @@ class EventAPITestCase(TestBase):
|
|||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
error = lldb.SBError()
|
||||
self.process = target.Launch (listener, None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.Launch (listener, None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Get a handle on the process's broadcaster.
|
||||
broadcaster = self.process.GetBroadcaster()
|
||||
broadcaster = process.GetBroadcaster()
|
||||
self.assertTrue(broadcaster, "Process with valid broadcaster")
|
||||
|
||||
# Create an empty event object.
|
||||
|
@ -94,7 +92,7 @@ class EventAPITestCase(TestBase):
|
|||
|
||||
# Use Python API to kill the process. The listening thread should be
|
||||
# able to receive a state changed event.
|
||||
self.process.Kill()
|
||||
process.Kill()
|
||||
|
||||
# Let's start the listening thread to retrieve the event.
|
||||
my_thread = MyListeningThread()
|
||||
|
@ -122,14 +120,12 @@ class EventAPITestCase(TestBase):
|
|||
VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at the entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped,
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped,
|
||||
PROCESS_STOPPED)
|
||||
|
||||
# Get a handle on the process's broadcaster.
|
||||
broadcaster = self.process.GetBroadcaster()
|
||||
broadcaster = process.GetBroadcaster()
|
||||
self.assertTrue(broadcaster, "Process with valid broadcaster")
|
||||
|
||||
# Create an empty event object.
|
||||
|
@ -188,7 +184,7 @@ class EventAPITestCase(TestBase):
|
|||
|
||||
# Use Python API to continue the process. The listening thread should be
|
||||
# able to receive the state changed events.
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
|
||||
# Start the listening thread to receive the "running" followed by the
|
||||
# "stopped" events.
|
||||
|
|
|
@ -41,9 +41,6 @@ class FrameAPITestCase(TestBase):
|
|||
VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at the entry point.
|
||||
# Note that we don't assign the process to self.process as in other test
|
||||
# cases. We want the inferior to run till it exits and there's no need
|
||||
# for the testing framework to kill the inferior upon tearDown().
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
process = target.GetProcess()
|
||||
|
|
|
@ -53,14 +53,12 @@ class DisasmAPITestCase(TestBase):
|
|||
VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Frame #0 should be on self.line1.
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
lineEntry = frame0.GetLineEntry()
|
||||
|
@ -77,9 +75,9 @@ class DisasmAPITestCase(TestBase):
|
|||
print "context1:", context1
|
||||
|
||||
# Continue the inferior, the breakpoint 2 should be hit.
|
||||
self.process.Continue()
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
process.Continue()
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
lineEntry = frame0.GetLineEntry()
|
||||
|
|
|
@ -53,14 +53,12 @@ class SymbolAPITestCase(TestBase):
|
|||
VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Frame #0 should be on self.line1.
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
symbol_line1 = frame0.GetSymbol()
|
||||
|
@ -71,9 +69,9 @@ class SymbolAPITestCase(TestBase):
|
|||
self.assertTrue(addr_line1.GetSectionType() == lldb.eSectionTypeCode)
|
||||
|
||||
# Continue the inferior, the breakpoint 2 should be hit.
|
||||
self.process.Continue()
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
process.Continue()
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
symbol_line2 = frame0.GetSymbol()
|
||||
|
|
|
@ -59,18 +59,17 @@ class CommandInterpreterAPICase(TestBase):
|
|||
ci.HandleCommand("process launch", res)
|
||||
self.assertTrue(res.Succeeded())
|
||||
|
||||
# Assigning to self.process so it gets cleaned up during test tear down.
|
||||
self.process = ci.GetProcess()
|
||||
self.assertTrue(self.process)
|
||||
process = ci.GetProcess()
|
||||
self.assertTrue(process)
|
||||
|
||||
import lldbutil
|
||||
if self.process.GetState() != lldb.eStateStopped:
|
||||
if process.GetState() != lldb.eStateStopped:
|
||||
self.fail("Process should be in the 'stopped' state, "
|
||||
"instead the actual state is: '%s'" %
|
||||
lldbutil.state_type_to_str(self.process.GetState()))
|
||||
lldbutil.state_type_to_str(process.GetState()))
|
||||
|
||||
if self.TraceOn():
|
||||
lldbutil.print_stacktraces(self.process)
|
||||
lldbutil.print_stacktraces(process)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -33,15 +33,15 @@ class FrameUtilsTestCase(TestBase):
|
|||
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
if not self.process:
|
||||
if not process:
|
||||
self.fail("SBTarget.LaunchProcess() failed")
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped,
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped,
|
||||
PROCESS_STOPPED)
|
||||
|
||||
import lldbutil
|
||||
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
frame1 = thread.GetFrameAtIndex(1)
|
||||
parent = lldbutil.get_parent_frame(frame0)
|
||||
|
|
|
@ -45,9 +45,9 @@ class LLDBIteratorTestCase(TestBase):
|
|||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
rc = lldb.SBError()
|
||||
self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
|
||||
|
||||
if not rc.Success() or not self.process:
|
||||
if not rc.Success() or not process:
|
||||
self.fail("SBTarget.LaunchProcess() failed")
|
||||
|
||||
from lldbutil import get_description
|
||||
|
@ -106,14 +106,14 @@ class LLDBIteratorTestCase(TestBase):
|
|||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
rc = lldb.SBError()
|
||||
self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
|
||||
|
||||
if not rc.Success() or not self.process:
|
||||
if not rc.Success() or not process:
|
||||
self.fail("SBTarget.LaunchProcess() failed")
|
||||
|
||||
from lldbutil import print_stacktrace
|
||||
stopped_due_to_breakpoint = False
|
||||
for thread in self.process:
|
||||
for thread in process:
|
||||
if self.TraceOn():
|
||||
print_stacktrace(thread)
|
||||
ID = thread.GetThreadID()
|
||||
|
|
|
@ -34,13 +34,13 @@ class RegistersIteratorTestCase(TestBase):
|
|||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
rc = lldb.SBError()
|
||||
self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
|
||||
|
||||
if not rc.Success() or not self.process:
|
||||
if not rc.Success() or not process:
|
||||
self.fail("SBTarget.LaunchProcess() failed")
|
||||
|
||||
import lldbutil
|
||||
for thread in self.process:
|
||||
for thread in process:
|
||||
if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
|
||||
for frame in thread:
|
||||
# Dump the registers of this frame using lldbutil.get_GPRs() and friends.
|
||||
|
|
|
@ -35,19 +35,19 @@ class ThreadsStackTracesTestCase(TestBase):
|
|||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
rc = lldb.SBError()
|
||||
self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
|
||||
|
||||
if not rc.Success() or not self.process:
|
||||
if not rc.Success() or not process:
|
||||
self.fail("SBTarget.LaunchProcess() failed")
|
||||
|
||||
import lldbutil
|
||||
if self.process.GetState() != lldb.eStateStopped:
|
||||
if process.GetState() != lldb.eStateStopped:
|
||||
self.fail("Process should be in the 'stopped' state, "
|
||||
"instead the actual state is: '%s'" %
|
||||
lldbutil.state_type_to_str(self.process.GetState()))
|
||||
lldbutil.state_type_to_str(process.GetState()))
|
||||
|
||||
if self.TraceOn():
|
||||
lldbutil.print_stacktraces(self.process)
|
||||
lldbutil.print_stacktraces(process)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -76,9 +76,9 @@ class ProcessAPITestCase(TestBase):
|
|||
|
||||
# Launch the process, and do not stop at the entry point.
|
||||
error = lldb.SBError()
|
||||
self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
|
||||
frame = thread.GetFrameAtIndex(0)
|
||||
|
||||
|
@ -95,7 +95,7 @@ class ProcessAPITestCase(TestBase):
|
|||
|
||||
# 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!
|
||||
content = self.process.ReadMemory(location, 1, error)
|
||||
content = process.ReadMemory(location, 1, error)
|
||||
if not error.Success():
|
||||
self.fail("SBProcess.ReadMemory() failed")
|
||||
if self.TraceOn():
|
||||
|
@ -118,9 +118,9 @@ class ProcessAPITestCase(TestBase):
|
|||
|
||||
# Launch the process, and do not stop at the entry point.
|
||||
error = lldb.SBError()
|
||||
self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
|
||||
frame = thread.GetFrameAtIndex(0)
|
||||
|
||||
|
@ -139,14 +139,14 @@ class ProcessAPITestCase(TestBase):
|
|||
# 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.
|
||||
result = self.process.WriteMemory(location, 'a', error)
|
||||
result = process.WriteMemory(location, 'a', error)
|
||||
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!
|
||||
content = self.process.ReadMemory(location, 1, error)
|
||||
content = process.ReadMemory(location, 1, error)
|
||||
if not error.Success():
|
||||
self.fail("SBProcess.ReadMemory() failed")
|
||||
if self.TraceOn():
|
||||
|
@ -169,9 +169,9 @@ class ProcessAPITestCase(TestBase):
|
|||
|
||||
# Launch the process, and do not stop at the entry point.
|
||||
error = lldb.SBError()
|
||||
self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
|
||||
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
|
||||
frame = thread.GetFrameAtIndex(0)
|
||||
|
||||
|
@ -192,7 +192,7 @@ class ProcessAPITestCase(TestBase):
|
|||
byteSize = val.GetByteSize()
|
||||
bytes = int_to_bytearray(256, byteSize)
|
||||
|
||||
byteOrder = self.process.GetByteOrder()
|
||||
byteOrder = process.GetByteOrder()
|
||||
if byteOrder == lldb.eByteOrderBig:
|
||||
bytes.reverse()
|
||||
elif byteOrder == lldb.eByteOrderLittle:
|
||||
|
@ -207,7 +207,7 @@ class ProcessAPITestCase(TestBase):
|
|||
|
||||
# Now use WriteMemory() API to write 256 into the global variable.
|
||||
new_value = str(bytes)
|
||||
result = self.process.WriteMemory(location, new_value, error)
|
||||
result = process.WriteMemory(location, new_value, error)
|
||||
if not error.Success() or result != byteSize:
|
||||
self.fail("SBProcess.WriteMemory() failed")
|
||||
|
||||
|
@ -225,7 +225,7 @@ class ProcessAPITestCase(TestBase):
|
|||
startstr = '256')
|
||||
|
||||
# Now read the memory content. The bytearray should have (byte)1 as the second element.
|
||||
content = self.process.ReadMemory(location, byteSize, error)
|
||||
content = process.ReadMemory(location, byteSize, error)
|
||||
if not error.Success():
|
||||
self.fail("SBProcess.ReadMemory() failed")
|
||||
|
||||
|
|
|
@ -47,14 +47,12 @@ class SymbolContextAPITestCase(TestBase):
|
|||
VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Frame #0 should be on self.line.
|
||||
from lldbutil import get_stopped_thread
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
self.assertTrue(frame0.GetLineEntry().GetLine() == self.line)
|
||||
|
|
|
@ -99,8 +99,7 @@ class TargetAPITestCase(TestBase):
|
|||
breakpoint = target.BreakpointCreateByLocation('main.c', line)
|
||||
|
||||
# Now launch the process, do not stop at entry point, and redirect stdout to "stdout.txt" file.
|
||||
# The inferior should run to completion after "process.Continue()" call, so there's no need
|
||||
# to assign to self.process to have the inferior kiiled during test teardown.
|
||||
# The inferior should run to completion after "process.Continue()" call.
|
||||
error = lldb.SBError()
|
||||
process = target.Launch (self.dbg.GetListener(), None, None, None, "stdout.txt", None, None, 0, False, error)
|
||||
process.Continue()
|
||||
|
@ -146,14 +145,12 @@ class TargetAPITestCase(TestBase):
|
|||
VALID_BREAKPOINT)
|
||||
|
||||
# Now launch the process, and do not stop at entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.process = target.GetProcess()
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Frame #0 should be on self.line1.
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
|
||||
#self.runCmd("process status")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
|
@ -163,9 +160,9 @@ class TargetAPITestCase(TestBase):
|
|||
address1 = lineEntry.GetStartAddress()
|
||||
|
||||
# Continue the inferior, the breakpoint 2 should be hit.
|
||||
self.process.Continue()
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
process.Continue()
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped)
|
||||
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
|
||||
#self.runCmd("process status")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
|
|
|
@ -116,15 +116,15 @@ class ThreadAPITestCase(TestBase):
|
|||
self.runCmd("breakpoint list")
|
||||
|
||||
# Launch the process, and do not stop at the entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
|
||||
self.runCmd("process status")
|
||||
|
||||
proc_of_thread = thread.GetProcess()
|
||||
#print "proc_of_thread:", proc_of_thread
|
||||
self.assertTrue(proc_of_thread.GetProcessID() == self.process.GetProcessID())
|
||||
self.assertTrue(proc_of_thread.GetProcessID() == process.GetProcessID())
|
||||
|
||||
def get_stop_description(self):
|
||||
"""Test Python SBThread.GetStopDescription() API."""
|
||||
|
@ -138,9 +138,9 @@ class ThreadAPITestCase(TestBase):
|
|||
#self.runCmd("breakpoint list")
|
||||
|
||||
# Launch the process, and do not stop at the entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
|
||||
#self.runCmd("process status")
|
||||
|
||||
|
@ -163,10 +163,10 @@ class ThreadAPITestCase(TestBase):
|
|||
self.runCmd("breakpoint list")
|
||||
|
||||
# Launch the process, and do not stop at the entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
while True:
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
|
||||
caller_symbol = get_caller_symbol(thread)
|
||||
#print "caller symbol of malloc:", caller_symbol
|
||||
|
@ -176,7 +176,7 @@ class ThreadAPITestCase(TestBase):
|
|||
break
|
||||
#self.runCmd("thread backtrace")
|
||||
#self.runCmd("process status")
|
||||
self.process.Continue()
|
||||
process.Continue()
|
||||
|
||||
thread.StepOut()
|
||||
self.runCmd("thread backtrace")
|
||||
|
@ -196,13 +196,13 @@ class ThreadAPITestCase(TestBase):
|
|||
self.runCmd("breakpoint list")
|
||||
|
||||
# Launch the process, and do not stop at the entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Frame #0 should be on self.line2.
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
|
||||
self.runCmd("thread backtrace")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
|
@ -237,13 +237,13 @@ class ThreadAPITestCase(TestBase):
|
|||
self.runCmd("breakpoint list")
|
||||
|
||||
# Launch the process, and do not stop at the entry point.
|
||||
self.process = target.LaunchSimple(None, None, os.getcwd())
|
||||
process = target.LaunchSimple(None, None, os.getcwd())
|
||||
|
||||
self.assertTrue(self.process, PROCESS_IS_VALID)
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Frame #0 should be on self.line2.
|
||||
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
|
||||
thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(process.GetState() == lldb.eStateStopped)
|
||||
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
|
||||
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
|
||||
self.runCmd("thread backtrace")
|
||||
frame0 = thread.GetFrameAtIndex(0)
|
||||
|
|
Loading…
Reference in New Issue