xref: /llvm-project/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py (revision 6abf361953e9c5d019a72fd83765498d269eb080)
1import lldbsuite.test.lldbutil as lldbutil
2from lldbsuite.test.lldbtest import *
3
4
5class TestCase(TestBase):
6    def test_functions_having_dlang_mangling_prefix(self):
7        """
8        Ensure C functions with a '_D' prefix alone are not mistakenly treated
9        as a Dlang mangled name. A proper Dlang mangling will have digits
10        immediately following the '_D' prefix.
11        """
12        self.build()
13        _, _, thread, _ = lldbutil.run_to_name_breakpoint(self, "_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")
25