Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / functionalities / ptr_refs / TestPtrRefs.py
blob95d81bf8a9992bb9db00f5ecf48835bbd89df530
1 """
2 Test the ptr_refs tool on Darwin
3 """
6 import lldb
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.
14 @skipUnlessDarwin
15 def test_ptr_refs(self):
16 """Test format string functionality."""
17 self.build()
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)
25 self.assertTrue(
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)
34 self.assertTrue(
35 thread.IsValid(),
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"])