Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
CXX_SOURCES := main.cpp
CXXFLAGS_EXTRAS := -std=c++11
USE_LIBCPP := 1

include Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@
from lldbsuite.test import lldbutil


class LibCxxAtomicTestCase(TestBase):
class StdAtomicTestCase(TestBase):
def get_variable(self, name):
var = self.frame().FindVariable(name)
var.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
var.SetPreferSyntheticValue(True)
return var

@skipIf(compiler=["gcc"])
@add_test_categories(["libc++"])
def test(self):
"""Test that std::atomic as defined by libc++ is correctly printed by LLDB"""
self.build()
def do_test(self):
"""Test that std::atomic is correctly printed by LLDB"""
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

bkpt = self.target().FindBreakpointByID(
Expand All @@ -31,8 +28,6 @@ def test(self):

self.runCmd("run", RUN_SUCCEEDED)

lldbutil.skip_if_library_missing(self, self.target(), re.compile(r"libc\+\+"))

# The stop reason of the thread should be breakpoint.
self.expect(
"thread list",
Expand Down Expand Up @@ -66,3 +61,9 @@ def test(self):
self.expect(
"frame var p.child.parent", substrs=["p.child.parent = {\n Value = 0x"]
)

@skipIf(compiler=["gcc"])
@add_test_categories(["libc++"])
def test_libcxx(self):
self.build(dictionary={"USE_LIBCPP": 1})
self.do_test()
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,26 @@ struct Child {
// This should point to the parent which in turn owns this
// child instance. This cycle should not cause LLDB to infinite loop
// during printing.
std::atomic<Parent*> parent{nullptr};
std::atomic<Parent *> parent{nullptr};
};
struct Parent {
Child child;
};

struct S {
int x = 1;
int y = 2;
int x = 1;
int y = 2;
};

int main ()
{
std::atomic<S> s;
s.store(S());
std::atomic<int> i;
i.store(5);
int main() {
std::atomic<S> s;
s.store(S());
std::atomic<int> i;
i.store(5);

Parent p;
// Let the child node know what its parent is.
p.child.parent = &p;
Parent p;
// Let the child node know what its parent is.
p.child.parent = &p;

return 0; // Set break point at this line.
return 0; // Set break point at this line.
}

Loading