1"""
2Test 'target modules dump symtab -m' doesn't demangle symbols.
3"""
4
5from lldbsuite.test.decorators import *
6from lldbsuite.test.lldbtest import *
7from lldbsuite.test import lldbutil
8
9class TestCase(TestBase):
10
11    @no_debug_info_test
12    def test(self):
13        src_dir = self.getSourceDir()
14        yaml_path = os.path.join(src_dir, "a.yaml")
15        yaml_base, ext = os.path.splitext(yaml_path)
16        obj_path = self.getBuildArtifact("main.o")
17        self.yaml2obj(yaml_path, obj_path)
18
19        # Create a target with the object file we just created from YAML
20        target = self.dbg.CreateTarget(obj_path)
21        self.assertTrue(target, VALID_TARGET)
22
23        # First test that we demangle by default and our mangled symbol isn't in the output.
24        self.expect("target modules dump symtab", substrs=["foo::bar(int)"])
25        self.expect("target modules dump symtab", matching=False, substrs=["_ZN3foo3barEi"])
26
27        # Turn off demangling and make sure that we now see the mangled name in the output.
28        self.expect("target modules dump symtab -m", substrs=["_ZN3foo3barEi"])
29