2 Test lldb data formatter subsystem.
5 from __future__ import print_function
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
16 class LibCxxFunctionTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
20 def get_variable(self, name):
21 var = self.frame().FindVariable(name)
22 var.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
23 var.SetPreferSyntheticValue(True)
26 @skipIf(compiler="gcc")
27 @skipIfWindows # libc++ not ported to Windows yet
29 """Test that std::function as defined by libc++ is correctly printed by LLDB"""
31 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
33 bkpt = self.target().FindBreakpointByID(
34 lldbutil.run_break_set_by_source_regexp(
35 self, "Set break point at this line."))
37 self.runCmd("run", RUN_SUCCEEDED)
39 lldbutil.skip_if_library_missing(
40 self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
42 # The stop reason of the thread should be breakpoint.
43 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
45 'stop reason = breakpoint'])
47 f1 = self.get_variable('f1')
48 f2 = self.get_variable('f2')
55 self.assertTrue(f1.GetValueAsUnsigned(0) != 0, 'f1 has a valid value')
56 self.assertTrue(f2.GetValueAsUnsigned(0) != 0, 'f2 has a valid value')