2 Test that breakpoint works correctly in the presence of dead-code stripping.
7 from lldbsuite
.test
.decorators
import *
8 from lldbsuite
.test
.lldbtest
import *
9 from lldbsuite
.test
import lldbutil
12 class DeadStripTestCase(TestBase
):
13 @expectedFailureAll(oslist
=["windows"], bugnumber
="llvm.org/pr44429")
15 """Test breakpoint works correctly with dead-code stripping."""
17 exe
= self
.getBuildArtifact("a.out")
18 self
.runCmd("file " + exe
, CURRENT_EXECUTABLE_SET
)
20 # Break by function name f1 (live code).
21 lldbutil
.run_break_set_by_symbol(
22 self
, "f1", num_expected_locations
=1, module_name
="a.out"
25 # Break by function name f2 (dead code).
26 lldbutil
.run_break_set_by_symbol(
27 self
, "f2", num_expected_locations
=0, module_name
="a.out"
30 # Break by function name f3 (live code).
31 lldbutil
.run_break_set_by_symbol(
32 self
, "f3", num_expected_locations
=1, module_name
="a.out"
35 self
.runCmd("run", RUN_SUCCEEDED
)
37 # The stop reason of the thread should be breakpoint (breakpoint #1).
40 STOPPED_DUE_TO_BREAKPOINT
,
41 substrs
=["stopped", "a.out`f1", "stop reason = breakpoint"],
44 # The breakpoint should have a hit count of 1.
45 lldbutil
.check_breakpoint(self
, bpno
=1, expected_hit_count
=1)
47 self
.runCmd("continue")
49 # The stop reason of the thread should be breakpoint (breakpoint #3).
52 STOPPED_DUE_TO_BREAKPOINT
,
53 substrs
=["stopped", "a.out`f3", "stop reason = breakpoint"],
56 # The breakpoint should have a hit count of 1.
57 lldbutil
.check_breakpoint(self
, bpno
=3, expected_hit_count
=1)