2 Test the ptr_refs tool on Darwin
5 from __future__ import print_function
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
13 class TestPtrRefs(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
18 def test_ptr_refs(self):
19 """Test format string functionality."""
22 exe = os.path.join(os.getcwd(), exe_name)
24 target = self.dbg.CreateTarget(exe)
25 self.assertTrue(target, VALID_TARGET)
27 main_file_spec = lldb.SBFileSpec ('main.c')
28 breakpoint = target.BreakpointCreateBySourceRegex('break', main_file_spec)
29 self.assertTrue(breakpoint and
30 breakpoint.GetNumLocations() == 1,
33 process = target.LaunchSimple (None, None, self.get_process_working_directory())
34 self.assertTrue(process, PROCESS_IS_VALID)
36 # Frame #0 should be on self.line1 and the break condition should hold.
37 thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
38 self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
40 frame = thread.GetFrameAtIndex(0)
42 self.dbg.HandleCommand("script import lldb.macosx.heap")
43 self.expect("ptr_refs my_ptr", substrs=["malloc", "stack"]);