xref: /llvm-project/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py (revision 6abf361953e9c5d019a72fd83765498d269eb080)
15a02a9a2SDave Leeimport lldbsuite.test.lldbutil as lldbutil
25a02a9a2SDave Leefrom lldbsuite.test.lldbtest import *
35a02a9a2SDave Lee
45a02a9a2SDave Lee
55a02a9a2SDave Leeclass TestCase(TestBase):
65a02a9a2SDave Lee    def test_functions_having_dlang_mangling_prefix(self):
75a02a9a2SDave Lee        """
85a02a9a2SDave Lee        Ensure C functions with a '_D' prefix alone are not mistakenly treated
95a02a9a2SDave Lee        as a Dlang mangled name. A proper Dlang mangling will have digits
105a02a9a2SDave Lee        immediately following the '_D' prefix.
115a02a9a2SDave Lee        """
125a02a9a2SDave Lee        self.build()
135a02a9a2SDave Lee        _, _, thread, _ = lldbutil.run_to_name_breakpoint(self, "_Dfunction")
14*6abf3619SDavid Spickett        frame = thread.frame[0]
15*6abf3619SDavid Spickett
16*6abf3619SDavid Spickett        symbol = frame.symbol
17*6abf3619SDavid Spickett        # On Windows the function does not have an associated symbol.
18*6abf3619SDavid Spickett        if symbol.IsValid():
19*6abf3619SDavid Spickett            self.assertFalse(symbol.mangled)
205a02a9a2SDave Lee            self.assertEqual(symbol.GetDisplayName(), "_Dfunction")
21*6abf3619SDavid Spickett
22*6abf3619SDavid Spickett        function = frame.function
23*6abf3619SDavid Spickett        self.assertFalse(function.mangled)
24*6abf3619SDavid Spickett        self.assertEqual(function.GetDisplayName(), "_Dfunction")
25