Skip to content

Commit 5a3b690

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 09c0607 commit 5a3b690

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
@@ -12,5 +12,14 @@ def test_functions_having_dlang_mangling_prefix(self):
1212
"""
1313
self.build()
1414
_, _, thread, _ = lldbutil.run_to_name_breakpoint(self, "_Dfunction")
15-
symbol = thread.frame[0].symbol
16-
self.assertEqual(symbol.GetDisplayName(), "_Dfunction")
15+
frame = thread.frame[0]
16+
17+
symbol = frame.symbol
18+
# On Windows the function does not have an associated symbol.
19+
if symbol.IsValid():
20+
self.assertFalse(symbol.mangled)
21+
self.assertEqual(symbol.GetDisplayName(), "_Dfunction")
22+
23+
function = frame.function
24+
self.assertFalse(function.mangled)
25+
self.assertEqual(function.GetDisplayName(), "_Dfunction")

0 commit comments

Comments
 (0)