Skip to content

Commit 6abf361

Browse files
[lldb][test] Fix D lang mangling test on Windows (#94196)
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 6abf361

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import lldbsuite.test.lldbutil as lldbutil
22
from lldbsuite.test.lldbtest import *
3-
from lldbsuite.test.decorators import skipIfWindows
43

54

65
class TestCase(TestBase):
7-
@skipIfWindows
86
def test_functions_having_dlang_mangling_prefix(self):
97
"""
108
Ensure C functions with a '_D' prefix alone are not mistakenly treated
@@ -13,5 +11,14 @@ def test_functions_having_dlang_mangling_prefix(self):
1311
"""
1412
self.build()
1513
_, _, thread, _ = lldbutil.run_to_name_breakpoint(self, "_Dfunction")
16-
symbol = thread.frame[0].symbol
17-
self.assertEqual(symbol.GetDisplayName(), "_Dfunction")
14+
frame = thread.frame[0]
15+
16+
symbol = frame.symbol
17+
# On Windows the function does not have an associated symbol.
18+
if symbol.IsValid():
19+
self.assertFalse(symbol.mangled)
20+
self.assertEqual(symbol.GetDisplayName(), "_Dfunction")
21+
22+
function = frame.function
23+
self.assertFalse(function.mangled)
24+
self.assertEqual(function.GetDisplayName(), "_Dfunction")

0 commit comments

Comments
 (0)