2 Test the ptr_refs tool on Darwin
7 from lldbsuite
.test
.decorators
import *
8 from lldbsuite
.test
.lldbtest
import *
9 from lldbsuite
.test
import lldbutil
12 class TestPtrRefs(TestBase
):
13 @skipIfAsan # The output looks different under ASAN.
15 def test_ptr_refs(self
):
16 """Test format string functionality."""
18 exe
= self
.getBuildArtifact("a.out")
20 target
= self
.dbg
.CreateTarget(exe
)
21 self
.assertTrue(target
, VALID_TARGET
)
23 main_file_spec
= lldb
.SBFileSpec("main.c")
24 breakpoint
= target
.BreakpointCreateBySourceRegex("break", main_file_spec
)
26 breakpoint
and breakpoint
.GetNumLocations() == 1, VALID_BREAKPOINT
29 process
= target
.LaunchSimple(None, None, self
.get_process_working_directory())
30 self
.assertTrue(process
, PROCESS_IS_VALID
)
32 # Frame #0 should be on self.line1 and the break condition should hold.
33 thread
= lldbutil
.get_stopped_thread(process
, lldb
.eStopReasonBreakpoint
)
36 "There should be a thread stopped due to breakpoint condition",
39 frame
= thread
.GetFrameAtIndex(0)
41 self
.runCmd("command script import lldb.macosx.heap")
42 self
.expect("ptr_refs my_ptr", substrs
=["malloc", "stack"])