1
2import lldb
3from lldbsuite.test.decorators import *
4from lldbsuite.test.lldbtest import *
5from lldbsuite.test import lldbutil
6
7class ExprBug35310(TestBase):
8
9    mydir = TestBase.compute_mydir(__file__)
10
11    def setUp(self):
12        # Call super's setUp().
13        TestBase.setUp(self)
14
15        self.main_source = "main.cpp"
16        self.main_source_spec = lldb.SBFileSpec(self.main_source)
17
18    def test_issue35310(self):
19        """Test invoking functions with non-standard linkage names.
20
21        The GNU abi_tag extension used by libstdc++ is a common source
22        of these, but they could originate from other reasons as well.
23        """
24        self.build()
25
26        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
27                                          '// Break here', self.main_source_spec)
28        frame = thread.GetFrameAtIndex(0)
29
30        value = frame.EvaluateExpression("a.test_abi_tag()")
31        self.assertTrue(value.IsValid())
32        self.assertTrue(value.GetError().Success())
33        self.assertEqual(value.GetValueAsSigned(0), 1)
34
35        value = frame.EvaluateExpression("a.test_asm_name()")
36        self.assertTrue(value.IsValid())
37        self.assertTrue(value.GetError().Success())
38        self.assertEqual(value.GetValueAsSigned(0), 2)
39