2 Test lldb data formatter subsystem.
5 from __future__ import print_function
9 from lldbsuite.test.decorators import *
10 from lldbsuite.test.lldbtest import *
11 from lldbsuite.test import lldbutil
14 class LibCxxAtomicTestCase(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
18 def get_variable(self, name):
19 var = self.frame().FindVariable(name)
20 var.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
21 var.SetPreferSyntheticValue(True)
24 @skipIf(compiler=["gcc"])
25 @add_test_categories(["libc++"])
27 """Test that std::atomic as defined by libc++ is correctly printed by LLDB"""
29 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
31 bkpt = self.target().FindBreakpointByID(
32 lldbutil.run_break_set_by_source_regexp(
33 self, "Set break point at this line."))
35 self.runCmd("run", RUN_SUCCEEDED)
37 lldbutil.skip_if_library_missing(
38 self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
40 # The stop reason of the thread should be breakpoint.
41 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
43 'stop reason = breakpoint'])
45 s = self.get_variable('s')
46 i = self.get_variable('i')
53 self.assertTrue(i.GetValueAsUnsigned(0) == 5, "i == 5")
54 self.assertTrue(s.GetNumChildren() == 2, "s has two children")
56 s.GetChildAtIndex(0).GetValueAsUnsigned(0) == 1,
59 s.GetChildAtIndex(1).GetValueAsUnsigned(0) == 2,