]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / data-formatter / data-formatter-stl / libcxx / function / TestLibCxxFunction.py
1 """
2 Test lldb data formatter subsystem.
3 """
4
5 from __future__ import print_function
6
7
8 import os
9 import time
10 import lldb
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
14
15
16 class LibCxxFunctionTestCase(TestBase):
17
18     mydir = TestBase.compute_mydir(__file__)
19
20     def get_variable(self, name):
21         var = self.frame().FindVariable(name)
22         var.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
23         var.SetPreferSyntheticValue(True)
24         return var
25
26     @skipIf(compiler="gcc")
27     @skipIfWindows  # libc++ not ported to Windows yet
28     def test(self):
29         """Test that std::function as defined by libc++ is correctly printed by LLDB"""
30         self.build()
31         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
32
33         bkpt = self.target().FindBreakpointByID(
34             lldbutil.run_break_set_by_source_regexp(
35                 self, "Set break point at this line."))
36
37         self.runCmd("run", RUN_SUCCEEDED)
38
39         lldbutil.skip_if_library_missing(
40             self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
41
42         # The stop reason of the thread should be breakpoint.
43         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
44                     substrs=['stopped',
45                              'stop reason = breakpoint'])
46
47         f1 = self.get_variable('f1')
48         f2 = self.get_variable('f2')
49
50         if self.TraceOn():
51             print(f1)
52         if self.TraceOn():
53             print(f2)
54
55         self.assertTrue(f1.GetValueAsUnsigned(0) != 0, 'f1 has a valid value')
56         self.assertTrue(f2.GetValueAsUnsigned(0) != 0, 'f2 has a valid value')