Skip to content

Commit f451039

Browse files
committed
[lldb][test] Fix D lang mangling test on Windows
On Windows the function does not have a symbol associated with it: Function: id = {0x000001c9}, name = "_Dfunction", range = [0x0000000140001000-0x0000000140001004) LineEntry: <...> Whereas it does on Linux: Function: id = {0x00000023}, name = "_Dfunction", range = [0x0000000000000734-0x0000000000000738) LineEntry: <...> Symbol: id = {0x00000058}, range = [0x0000000000000734-0x0000000000000738), name="_Dfunction" This means that frame.symbol is not valid on Windows. However, frame.function is valid and it also has a "mangled" attribute. So I've updated the test to check the symbol if we've got it, and the function always. In both cases we check that mangled is empty (meaning it has not been treated as mangled) and that the display name matches the original symbol name.
1 parent 770b6c7 commit f451039

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lldb/test/API/lang/c/non-mangled/TestCNonMangled.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,14 @@ def test_functions_having_dlang_mangling_prefix(self):
1313
"""
1414
self.build()
1515
_, _, thread, _ = lldbutil.run_to_name_breakpoint(self, "_Dfunction")
16-
symbol = thread.frame[0].symbol
17-
self.assertEqual(symbol.GetDisplayName(), "_Dfunction")
16+
frame = thread.frame[0]
17+
18+
symbol = frame.symbol
19+
# On Windows the function does not have an associated symbol.
20+
if symbol.IsValid():
21+
self.assertFalse(symbol.mangled)
22+
self.assertEqual(symbol.GetDisplayName(), "_Dfunction")
23+
24+
function = frame.function
25+
self.assertFalse(function.mangled)
26+
self.assertEqual(function.GetDisplayName(), "_Dfunction")

0 commit comments

Comments
 (0)