1 """Test that conflicting symbols in different shared libraries work correctly"""
5 from lldbsuite
.test
.decorators
import *
6 from lldbsuite
.test
.lldbtest
import *
7 from lldbsuite
.test
import lldbutil
10 class TestConflictingSymbols(TestBase
):
11 NO_DEBUG_INFO_TESTCASE
= True
15 lldbutil
.mkdir_p(self
.getBuildArtifact("One"))
16 lldbutil
.mkdir_p(self
.getBuildArtifact("Two"))
18 @expectedFailureAll(oslist
=["windows"], bugnumber
="llvm.org/pr24489")
19 def test_conflicting_symbols(self
):
21 exe
= self
.getBuildArtifact("a.out")
22 target
= self
.dbg
.CreateTarget(exe
)
23 self
.assertTrue(target
, VALID_TARGET
)
25 # Register our shared libraries for remote targets so they get
26 # automatically uploaded
27 environment
= self
.registerSharedLibrariesWithTarget(target
, ["One", "Two"])
29 lldbutil
.run_break_set_by_source_regexp(
30 self
, "// break here", extra_options
="-f One.c", num_expected_locations
=-2
32 lldbutil
.run_break_set_by_source_regexp(
33 self
, "// break here", extra_options
="-f Two.c", num_expected_locations
=-2
35 lldbutil
.run_break_set_by_source_regexp(
36 self
, "// break here", extra_options
="-f main.c", num_expected_locations
=1
39 process
= target
.LaunchSimple(
40 None, environment
, self
.get_process_working_directory()
42 self
.assertTrue(process
, PROCESS_IS_VALID
)
44 # The stop reason of the thread should be breakpoint.
47 STOPPED_DUE_TO_BREAKPOINT
,
48 substrs
=["stopped", "stop reason = breakpoint"],
51 lldbutil
.check_breakpoint(self
, bpno
=1, expected_hit_count
=1)
53 # This should display correctly.
55 "expr (unsigned long long)conflicting_symbol",
56 "Symbol from One should be found",
60 self
.runCmd("continue", RUN_SUCCEEDED
)
62 # The stop reason of the thread should be breakpoint.
65 STOPPED_DUE_TO_BREAKPOINT
,
66 substrs
=["stopped", "stop reason = breakpoint"],
69 lldbutil
.check_breakpoint(self
, bpno
=1, expected_hit_count
=1)
72 "expr (unsigned long long)conflicting_symbol",
73 "Symbol from Two should be found",
77 self
.runCmd("continue", RUN_SUCCEEDED
)
79 # The stop reason of the thread should be breakpoint.
82 STOPPED_DUE_TO_BREAKPOINT
,
83 substrs
=["stopped", "stop reason = breakpoint"],
86 lldbutil
.check_breakpoint(self
, bpno
=1, expected_hit_count
=1)
89 "expr (unsigned long long)conflicting_symbol",
90 "An error should be printed when symbols can't be ordered",
92 substrs
=["Multiple internal symbols"],
95 @expectedFailureAll(bugnumber
="llvm.org/pr35043")
96 @skipIfWindows # This test is "passing" on Windows, but it is a false positive.
97 def test_shadowed(self
):
99 exe
= self
.getBuildArtifact("a.out")
100 target
= self
.dbg
.CreateTarget(exe
)
101 self
.assertTrue(target
, VALID_TARGET
)
103 # Register our shared libraries for remote targets so they get
104 # automatically uploaded
105 environment
= self
.registerSharedLibrariesWithTarget(target
, ["One", "Two"])
107 lldbutil
.run_break_set_by_source_regexp(
108 self
, "// break here", extra_options
="-f main.c", num_expected_locations
=1
111 process
= target
.LaunchSimple(
112 None, environment
, self
.get_process_working_directory()
114 self
.assertTrue(process
, PROCESS_IS_VALID
)
116 # The stop reason of the thread should be breakpoint.
119 STOPPED_DUE_TO_BREAKPOINT
,
120 substrs
=["stopped", "stop reason = breakpoint"],
123 # As we are shadowing the conflicting symbol, there should be no
124 # ambiguity in this expression.
126 "expr int conflicting_symbol = 474747; conflicting_symbol",