[Lldb-commits] [lldb] cabee89 - [lldb] Reference STL types in import-std-module tests

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 28 01:37:25 PDT 2020


Author: Raphael Isemann
Date: 2020-09-28T10:37:03+02:00
New Revision: cabee89bed69ce37c9e588f9190ed9c33f6bfdee

URL: https://github.com/llvm/llvm-project/commit/cabee89bed69ce37c9e588f9190ed9c33f6bfdee
DIFF: https://github.com/llvm/llvm-project/commit/cabee89bed69ce37c9e588f9190ed9c33f6bfdee.diff

LOG: [lldb] Reference STL types in import-std-module tests

With the recent patches to the ASTImporter that improve template type importing
(D87444), most of the import-std-module tests can now finally import the
type of the STL container they are testing. This patch removes most of the casts
that were added to simplify types to something the ASTImporter can import
(for example, std::vector<int>::size_type was casted to `size_t` until now).
Also adds the missing tests that require referencing the container type (for
example simply printing the whole container) as here we couldn't use a casting
workaround.

The only casts that remain are in the forward_list tests that reference
the iterator and the stack test. Both tests are still failing to import the
respective container type correctly (or crash while trying to import).

Added: 
    

Modified: 
    lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
    lldb/test/API/commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py
    lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py
    lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/TestForwardDeclFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/no-std-module/TestMissingStdModule.py
    lldb/test/API/commands/expression/import-std-module/pair/TestPairFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/sysroot/TestStdModuleSysroot.py
    lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
    lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/main.cpp
    lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/unique_ptr/main.cpp
    lldb/test/API/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py
    lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py b/lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
index 1484dd25e84c..c60e280dd65d 100644
--- a/lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
@@ -17,18 +17,25 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         # Activate importing of std module.
         self.runCmd("settings set target.import-std-module true")
         # Calling some normal std functions that return non-template types.
         self.expect_expr("std::abs(-42)", result_type="int", result_value="42")
-        self.expect_expr("std::div(2, 1).quot", result_type="int", result_value="2")
+        self.expect_expr("std::div(2, 1).quot",
+                         result_type="int",
+                         result_value="2")
         # Using types from std.
-        self.expect_expr("(std::size_t)33U", result_type="std::size_t", result_value="33")
+        self.expect_expr("(std::size_t)33U",
+                         result_type="std::size_t",
+                         result_value="33")
         # Calling templated functions that return non-template types.
-        self.expect_expr("char char_a = 'b'; char char_b = 'a'; std::swap(char_a, char_b); char_a",
-                    result_type="char", result_value="'a'")
+        self.expect_expr(
+            "char char_a = 'b'; char char_b = 'a'; std::swap(char_a, char_b); char_a",
+            result_type="char",
+            result_value="'a'")
 
     @add_test_categories(["libc++"])
     @skipIf(compiler=no_match("clang"))
@@ -36,7 +43,8 @@ def test_non_cpp_language(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         # Activate importing of std module.
         self.runCmd("settings set target.import-std-module true")

diff  --git a/lldb/test/API/commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py b/lldb/test/API/commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py
index 6b817c882ad8..bfc1851cd177 100644
--- a/lldb/test/API/commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py
+++ b/lldb/test/API/commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py
@@ -22,11 +22,17 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
         self.expect_expr("std::abs(-42)", result_type="int", result_value="42")
-        self.expect_expr("std::div(2, 1).quot", result_type="int", result_value="2")
-        self.expect_expr("(std::size_t)33U", result_type="std::size_t", result_value="33")
-        self.expect("expr char char_a = 'b'; char char_b = 'a'; std::swap(char_a, char_b); char_a",
-                    substrs=["(char) $3 = 'a'"])
+        self.expect_expr("std::div(2, 1).quot",
+                         result_type="int",
+                         result_value="2")
+        self.expect_expr("(std::size_t)33U",
+                         result_type="std::size_t",
+                         result_value="33")
+        self.expect(
+            "expr char char_a = 'b'; char char_b = 'a'; std::swap(char_a, char_b); char_a",
+            substrs=["(char) $3 = 'a'"])

diff  --git a/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
index dc9da4cb2f79..18bd8ae37ff9 100644
--- a/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestBasicDeque(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,22 +17,50 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect_expr("(size_t)a.size()", result_type="size_t", result_value="3")
-        self.expect_expr("(int)a.front()", result_type="int", result_value="3")
-        self.expect_expr("(int)a.back()", result_type="int", result_value="2")
+        deque_type = "std::deque<int, std::allocator<int> >"
+        size_type = deque_type + "::size_type"
+        value_type = "std::__deque_base<int, std::allocator<int> >::value_type"
+        iterator = deque_type + "::iterator"
+        iterator_children = [
+            ValueCheck(name="__m_iter_"),
+            ValueCheck(name="__ptr_")
+        ]
+        riterator = deque_type + "::reverse_iterator"
+        riterator_children = [
+            ValueCheck(name="__t"),
+            ValueCheck(name="current")
+        ]
+
+        self.expect_expr("a",
+                         result_type=deque_type,
+                         result_children=[
+                             ValueCheck(value='3'),
+                             ValueCheck(value='1'),
+                             ValueCheck(value='2'),
+                         ])
+
+        self.expect_expr("a.size()", result_type=size_type, result_value="3")
+        self.expect_expr("a.front()", result_type=value_type, result_value="3")
+        self.expect_expr("a.back()", result_type=value_type, result_value="2")
 
         self.expect("expr std::sort(a.begin(), a.end())")
-        self.expect_expr("(int)a.front()", result_type="int", result_value="1")
-        self.expect_expr("(int)a.back()", result_type="int", result_value="3")
+        self.expect_expr("a.front()", result_type=value_type, result_value="1")
+        self.expect_expr("a.back()", result_type=value_type, result_value="3")
 
         self.expect("expr std::reverse(a.begin(), a.end())")
-        self.expect_expr("(int)a.front()", result_type="int", result_value="3")
-        self.expect_expr("(int)a.back()", result_type="int", result_value="1")
-
-        self.expect_expr("(int)(*a.begin())", result_type="int", result_value="3")
-        self.expect_expr("(int)(*a.rbegin())", result_type="int", result_value="1")
+        self.expect_expr("a.front()", result_type=value_type, result_value="3")
+        self.expect_expr("a.back()", result_type=value_type, result_value="1")
 
+        self.expect_expr("*a.begin()", result_type="int", result_value="3")
+        self.expect_expr("*a.rbegin()", result_type="int", result_value="1")
+        self.expect_expr("a.begin()",
+                         result_type=iterator,
+                         result_children=iterator_children)
+        self.expect_expr("a.rbegin()",
+                         result_type=riterator,
+                         result_children=riterator_children)

diff  --git a/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
index cde74af8e1f4..e014f08d8509 100644
--- a/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestDbgInfoContentDeque(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,18 +17,54 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3'])
-        self.expect("expr (int)a.front().a", substrs=['(int) $1 = 3'])
-        self.expect("expr (int)a.back().a", substrs=['(int) $2 = 2'])
+        deque_type = "std::deque<Foo, std::allocator<Foo> >"
+        size_type = deque_type + "::size_type"
+        value_type = "std::__deque_base<Foo, std::allocator<Foo> >::value_type"
 
-        self.expect("expr std::reverse(a.begin(), a.end())")
-        self.expect("expr (int)a.front().a", substrs=['(int) $3 = 2'])
-        self.expect("expr (int)a.back().a", substrs=['(int) $4 = 3'])
+        iterator_type = deque_type + "::iterator"
+        iterator_children = [
+            ValueCheck(name="__m_iter_"),
+            ValueCheck(name="__ptr_")
+        ]
+
+        riterator_type = deque_type + "::reverse_iterator"
+        riterator_children = [
+            ValueCheck(name="__t"),
+            ValueCheck(name="current")
+        ]
 
-        self.expect("expr (int)(a.begin()->a)", substrs=['(int) $5 = 2'])
-        self.expect("expr (int)(a.rbegin()->a)", substrs=['(int) $6 = 3'])
+        self.expect_expr("a",
+                         result_type=deque_type,
+                         result_children=[
+                             ValueCheck(children=[ValueCheck(value="3")]),
+                             ValueCheck(children=[ValueCheck(value="1")]),
+                             ValueCheck(children=[ValueCheck(value="2")])
+                         ])
+
+        self.expect_expr("a.size()", result_type=size_type, result_value="3")
+        self.expect_expr("a.front()",
+                         result_type=value_type,
+                         result_children=[ValueCheck(value="3")])
+        self.expect_expr("a.back()",
+                         result_type=value_type,
+                         result_children=[ValueCheck(value="2")])
+        self.expect_expr("a.front().a", result_type="int", result_value="3")
+        self.expect_expr("a.back().a", result_type="int", result_value="2")
+
+        self.expect("expr std::reverse(a.begin(), a.end())")
+        self.expect_expr("a.front().a", result_type="int", result_value="2")
+        self.expect_expr("a.back().a", result_type="int", result_value="3")
 
+        self.expect_expr("a.begin()",
+                         result_type=iterator_type,
+                         result_children=iterator_children)
+        self.expect_expr("a.rbegin()",
+                         result_type=riterator_type,
+                         result_children=riterator_children)
+        self.expect_expr("a.begin()->a", result_type="int", result_value="2")
+        self.expect_expr("a.rbegin()->a", result_type="int", result_value="3")

diff  --git a/lldb/test/API/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py b/lldb/test/API/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py
index 2b1cb100a325..289420a9491e 100644
--- a/lldb/test/API/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py
@@ -7,6 +7,7 @@
 from lldbsuite.test import lldbutil
 import os
 
+
 class ImportStdModule(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -23,10 +24,12 @@ def test(self):
         sysroot = os.path.join(os.getcwd(), "root")
 
         # Set the sysroot.
-        self.runCmd("platform select --sysroot '" + sysroot + "' host", CURRENT_EXECUTABLE_SET)
+        self.runCmd("platform select --sysroot '" + sysroot + "' host",
+                    CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
@@ -36,4 +39,6 @@ def test(self):
         self.expect("expr MissingContent var = 3; var", substrs=['$0 = 3'])
         # Try to access our mock std::vector. This should fail but not crash LLDB as the
         # std::vector template should be missing from the std module.
-        self.expect("expr (size_t)v.size()", substrs=["Couldn't lookup symbols"], error=True)
+        self.expect("expr (size_t)v.size()",
+                    substrs=["Couldn't lookup symbols"],
+                    error=True)

diff  --git a/lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/TestForwardDeclFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/TestForwardDeclFromStdModule.py
index 48459abb9266..4ed1271aa8a7 100644
--- a/lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/TestForwardDeclFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/TestForwardDeclFromStdModule.py
@@ -7,6 +7,7 @@
 from lldbsuite.test import lldbutil
 import os
 
+
 class TestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -23,10 +24,12 @@ def test(self):
         sysroot = os.path.join(os.getcwd(), "root")
 
         # Set the sysroot where our dummy libc++ exists.
-        self.runCmd("platform select --sysroot '" + sysroot + "' host", CURRENT_EXECUTABLE_SET)
+        self.runCmd("platform select --sysroot '" + sysroot + "' host",
+                    CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 

diff  --git a/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
index 290a0450fc8c..704cbc8168fa 100644
--- a/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestDbgInfoContentForwardList(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,12 +17,22 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (size_t)std::distance(a.begin(), a.end())", substrs=['(size_t) $0 = 3'])
-        self.expect("expr (int)a.front().a", substrs=['(int) $1 = 3'])
+        list_type = "std::forward_list<Foo, std::allocator<Foo> >"
+        value_type = list_type + "::value_type"
 
-        self.expect("expr (int)(a.begin()->a)", substrs=['(int) $2 = 3'])
+        # FIXME: This has three elements in it but the formatter seems to
+        # calculate the wrong size and contents.
+        self.expect_expr("a", result_type=list_type, result_summary="size=1")
+        self.expect_expr("std::distance(a.begin(), a.end())", result_value="3")
+        self.expect_expr("a.front().a", result_type="int", result_value="3")
+        self.expect_expr("a.begin()->a", result_type="int", result_value="3")
 
+        # FIXME: The value here isn't actually empty.
+        self.expect_expr("a.front()",
+                         result_type=value_type,
+                         result_children=[ValueCheck()])

diff  --git a/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
index 9e45bf23c120..12d9a9930890 100644
--- a/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestBasicForwardList(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,15 +17,24 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (size_t)std::distance(a.begin(), a.end())", substrs=['(size_t) $0 = 3'])
-        self.expect("expr (int)a.front()", substrs=['(int) $1 = 3'])
+        list_type = "std::forward_list<int, std::allocator<int> >"
+        value_type = list_type + "::value_type"
 
-        self.expect("expr a.sort()")
-        self.expect("expr (int)a.front()", substrs=['(int) $2 = 1'])
+        # FIXME: This has three elements in it but the formatter seems to
+        # calculate the wrong size and contents.
+        self.expect_expr("a", result_type=list_type, result_summary="size=1")
+        self.expect_expr("std::distance(a.begin(), a.end())", result_value="3")
+        self.expect_expr("a.front()", result_type=value_type, result_value="3")
 
-        self.expect("expr (int)(*a.begin())", substrs=['(int) $3 = 1'])
+        self.expect("expr a.sort()")
+        self.expect_expr("a.front()", result_type=value_type, result_value="1")
 
+        # FIXME: Removing casting here causes LLDB to crash.
+        self.expect_expr("(int)*a.begin()",
+                         result_type="int",
+                         result_value="1")

diff  --git a/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
index fa8be7cabee6..fea6caaadf71 100644
--- a/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
@@ -7,6 +7,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestDbgInfoContentList(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -17,18 +18,30 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3'])
-        self.expect("expr (int)a.front().a", substrs=['(int) $1 = 3'])
-        self.expect("expr (int)a.back().a", substrs=['(int) $2 = 2'])
+        list_type = "std::list<Foo, std::allocator<Foo> >"
+        size_type = list_type + "::size_type"
+        value_type = list_type + "::value_type"
 
-        self.expect("expr std::reverse(a.begin(), a.end())")
-        self.expect("expr (int)a.front().a", substrs=['(int) $3 = 2'])
-        self.expect("expr (int)a.back().a", substrs=['(int) $4 = 3'])
+        self.expect_expr("a",
+                         result_type=list_type,
+                         result_children=[
+                             ValueCheck(children=[ValueCheck(value="3")]),
+                             ValueCheck(children=[ValueCheck(value="1")]),
+                             ValueCheck(children=[ValueCheck(value="2")])
+                         ])
 
-        self.expect("expr (int)(a.begin()->a)", substrs=['(int) $5 = 2'])
-        self.expect("expr (int)(a.rbegin()->a)", substrs=['(int) $6 = 3'])
+        self.expect_expr("a.size()", result_type=size_type, result_value="3")
+        self.expect_expr("a.front().a", result_type="int", result_value="3")
+        self.expect_expr("a.back().a", result_type="int", result_value="2")
+
+        self.expect("expr std::reverse(a.begin(), a.end())")
+        self.expect_expr("a.front().a", result_type="int", result_value="2")
+        self.expect_expr("a.back().a", result_type="int", result_value="3")
 
+        self.expect_expr("a.begin()->a", result_type="int", result_value="2")
+        self.expect_expr("a.rbegin()->a", result_type="int", result_value="3")

diff  --git a/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py
index e8dfc8847394..9382c800ec76 100644
--- a/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestBasicList(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,22 +17,41 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3'])
-        self.expect("expr (int)a.front()", substrs=['(int) $1 = 3'])
-        self.expect("expr (int)a.back()", substrs=['(int) $2 = 2'])
+        list_type = "std::list<int, std::allocator<int> >"
+        size_type = list_type + "::size_type"
+        value_type = list_type + "::value_type"
 
-        self.expect("expr a.sort()")
-        self.expect("expr (int)a.front()", substrs=['(int) $3 = 1'])
-        self.expect("expr (int)a.back()", substrs=['(int) $4 = 3'])
+        iteratorvalue = "std::__list_iterator<int, void *>::value_type"
+        riterator_value = "std::__list_iterator<int, void *>::value_type"
 
-        self.expect("expr std::reverse(a.begin(), a.end())")
-        self.expect("expr (int)a.front()", substrs=['(int) $5 = 3'])
-        self.expect("expr (int)a.back()", substrs=['(int) $6 = 1'])
+        self.expect_expr("a",
+                         result_type=list_type,
+                         result_children=[
+                             ValueCheck(value="3"),
+                             ValueCheck(value="1"),
+                             ValueCheck(value="2")
+                         ])
 
-        self.expect("expr (int)(*a.begin())", substrs=['(int) $7 = 3'])
-        self.expect("expr (int)(*a.rbegin())", substrs=['(int) $8 = 1'])
+        self.expect_expr("a.size()", result_type=size_type, result_value="3")
+        self.expect_expr("a.front()", result_type=value_type, result_value="3")
+        self.expect_expr("a.back()", result_type=value_type, result_value="2")
 
+        self.expect("expr a.sort()")
+        self.expect_expr("a.front()", result_type=value_type, result_value="1")
+        self.expect_expr("a.back()", result_type=value_type, result_value="3")
+
+        self.expect("expr std::reverse(a.begin(), a.end())")
+        self.expect_expr("a.front()", result_type=value_type, result_value="3")
+        self.expect_expr("a.back()", result_type=value_type, result_value="1")
+
+        self.expect_expr("*a.begin()",
+                         result_type=iteratorvalue,
+                         result_value="3")
+        self.expect_expr("*a.rbegin()",
+                         result_type=riterator_value,
+                         result_value="1")

diff  --git a/lldb/test/API/commands/expression/import-std-module/no-std-module/TestMissingStdModule.py b/lldb/test/API/commands/expression/import-std-module/no-std-module/TestMissingStdModule.py
index 83d672fb1fdf..50aaf10949b0 100644
--- a/lldb/test/API/commands/expression/import-std-module/no-std-module/TestMissingStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/no-std-module/TestMissingStdModule.py
@@ -23,7 +23,8 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         # Activate importing of std module.
         self.runCmd("settings set target.import-std-module true")

diff  --git a/lldb/test/API/commands/expression/import-std-module/pair/TestPairFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/pair/TestPairFromStdModule.py
index 4f5b1ea8028b..d0449a4e7800 100644
--- a/lldb/test/API/commands/expression/import-std-module/pair/TestPairFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/pair/TestPairFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,10 +17,27 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect_expr("pair_int.first", result_type="int", result_value="1234")
-        self.expect_expr("pair_int.second", result_type="int", result_value="5678")
-        self.expect("expr pair_int", substrs=['first = 1234, second = 5678'])
\ No newline at end of file
+        self.expect_expr("pair_int.first",
+                         result_type="int",
+                         result_value="1234")
+        self.expect_expr("pair_int.second",
+                         result_type="int",
+                         result_value="5678")
+        self.expect_expr("pair_int",
+                         result_type="std::pair<int, int>",
+                         result_children=[
+                             ValueCheck(name="first", value="1234"),
+                             ValueCheck(name="second", value="5678"),
+                         ])
+        self.expect_expr(
+            "std::pair<long, long> lp; lp.first = 3333; lp.second = 2344; lp",
+            result_type="std::pair<long, long>",
+            result_children=[
+                ValueCheck(name="first", value="3333"),
+                ValueCheck(name="second", value="2344"),
+            ])

diff  --git a/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py
index 42e5f8d8c430..75cc98c15055 100644
--- a/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestQueue(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,28 +17,69 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
+        queue_type = "std::queue<C, std::deque<C, std::allocator<C> > >"
+        size_type = queue_type + "::size_type"
+        value_type = "std::__deque_base<C, std::allocator<C> >::value_type"
+
         # Test std::queue functionality with a std::deque.
+        self.expect_expr(
+            "q_deque",
+            result_type=queue_type,
+            result_children=[ValueCheck(children=[ValueCheck(value="1")])])
         self.expect("expr q_deque.pop()")
         self.expect("expr q_deque.push({4})")
-        self.expect("expr (size_t)q_deque.size()", substrs=['(size_t) $0 = 1'])
-        self.expect("expr (int)q_deque.front().i", substrs=['(int) $1 = 4'])
-        self.expect("expr (int)q_deque.back().i", substrs=['(int) $2 = 4'])
-        self.expect("expr q_deque.empty()", substrs=['(bool) $3 = false'])
+        self.expect_expr("q_deque.size()",
+                         result_type=size_type,
+                         result_value="1")
+        self.expect_expr("q_deque.front()", result_type=value_type)
+        self.expect_expr("q_deque.back()", result_type=value_type)
+        self.expect_expr("q_deque.front().i",
+                         result_type="int",
+                         result_value="4")
+        self.expect_expr("q_deque.back().i",
+                         result_type="int",
+                         result_value="4")
+        self.expect_expr("q_deque.empty()",
+                         result_type="bool",
+                         result_value="false")
         self.expect("expr q_deque.pop()")
         self.expect("expr q_deque.emplace(5)")
-        self.expect("expr (int)q_deque.front().i", substrs=['(int) $4 = 5'])
+        self.expect_expr("q_deque.front().i",
+                         result_type="int",
+                         result_value="5")
 
         # Test std::queue functionality with a std::list.
+        queue_type = "std::queue<C, std::list<C, std::allocator<C> > >"
+        size_type = queue_type + "::size_type"
+        value_type = "std::list<C, std::allocator<C> >::value_type"
+        self.expect_expr(
+            "q_list",
+            result_type=queue_type,
+            result_children=[ValueCheck(children=[ValueCheck(value="1")])])
+
         self.expect("expr q_list.pop()")
         self.expect("expr q_list.push({4})")
-        self.expect("expr (size_t)q_list.size()", substrs=['(size_t) $5 = 1'])
-        self.expect("expr (int)q_list.front().i", substrs=['(int) $6 = 4'])
-        self.expect("expr (int)q_list.back().i", substrs=['(int) $7 = 4'])
-        self.expect("expr q_list.empty()", substrs=['(bool) $8 = false'])
+        self.expect_expr("q_list.size()",
+                         result_type=size_type,
+                         result_value="1")
+        self.expect_expr("q_list.front()", result_type=value_type)
+        self.expect_expr("q_list.back()", result_type=value_type)
+        self.expect_expr("q_list.front().i",
+                         result_type="int",
+                         result_value="4")
+        self.expect_expr("q_list.back().i",
+                         result_type="int",
+                         result_value="4")
+        self.expect_expr("q_list.empty()",
+                         result_type="bool",
+                         result_value="false")
         self.expect("expr q_list.pop()")
         self.expect("expr q_list.emplace(5)")
-        self.expect("expr (int)q_list.front().i", substrs=['(int) $9 = 5'])
+        self.expect_expr("q_list.front().i",
+                         result_type="int",
+                         result_value="5")

diff  --git a/lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py
index ec39651b8150..46a796fea9b3 100644
--- a/lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestSharedPtrDbgInfoContent(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,14 +17,17 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (int)s->a", substrs=['(int) $0 = 3'])
-        self.expect("expr (int)(s->a = 5)", substrs=['(int) $1 = 5'])
-        self.expect("expr (int)s->a", substrs=['(int) $2 = 5'])
-        self.expect("expr (bool)s", substrs=['(bool) $3 = true'])
+        self.expect_expr("s",
+                         result_type="std::shared_ptr<Foo>",
+                         result_children=[ValueCheck(name="__ptr_")])
+        self.expect_expr("s->a", result_type="int", result_value="3")
+        self.expect_expr("s->a = 5", result_type="int", result_value="5")
+        self.expect_expr("s->a", result_type="int", result_value="5")
+        self.expect_expr("(bool)s", result_type="bool", result_value="true")
         self.expect("expr s.reset()")
-        self.expect("expr (bool)s", substrs=['(bool) $4 = false'])
-
+        self.expect_expr("(bool)s", result_type="bool", result_value="false")

diff  --git a/lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py
index 7e05bcca4770..0d0f300776bc 100644
--- a/lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestSharedPtr(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,14 +17,18 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (int)*s", substrs=['(int) $0 = 3'])
-        self.expect("expr (int)(*s = 5)", substrs=['(int) $1 = 5'])
-        self.expect("expr (int)*s", substrs=['(int) $2 = 5'])
-        self.expect("expr (bool)s", substrs=['(bool) $3 = true'])
+        self.expect_expr("s",
+                         result_type="std::shared_ptr<int>",
+                         result_summary="3 strong=1 weak=1",
+                         result_children=[ValueCheck(name="__ptr_")])
+        self.expect_expr("*s", result_type="int", result_value="3")
+        self.expect_expr("*s = 5", result_type="int", result_value="5")
+        self.expect_expr("*s", result_type="int", result_value="5")
+        self.expect_expr("(bool)s", result_type="bool", result_value="true")
         self.expect("expr s.reset()")
-        self.expect("expr (bool)s", substrs=['(bool) $4 = false'])
-
+        self.expect_expr("(bool)s", result_type="bool", result_value="false")

diff  --git a/lldb/test/API/commands/expression/import-std-module/sysroot/TestStdModuleSysroot.py b/lldb/test/API/commands/expression/import-std-module/sysroot/TestStdModuleSysroot.py
index 452e8d697f2d..d26eccf29986 100644
--- a/lldb/test/API/commands/expression/import-std-module/sysroot/TestStdModuleSysroot.py
+++ b/lldb/test/API/commands/expression/import-std-module/sysroot/TestStdModuleSysroot.py
@@ -7,6 +7,7 @@
 from lldbsuite.test import lldbutil
 import os
 
+
 class ImportStdModule(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,17 +17,19 @@ class ImportStdModule(TestBase):
     # test configurations where libc++ is actually supposed to be tested.
     @add_test_categories(["libc++"])
     @skipIf(compiler=no_match("clang"))
-    @skipIfRemote # This test messes with the platform, can't be run remotely.
+    @skipIfRemote  # This test messes with the platform, can't be run remotely.
     def test(self):
         self.build()
 
         sysroot = os.path.join(os.getcwd(), "root")
 
         # Set the sysroot.
-        self.runCmd("platform select --sysroot '" + sysroot + "' host", CURRENT_EXECUTABLE_SET)
+        self.runCmd("platform select --sysroot '" + sysroot + "' host",
+                    CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 

diff  --git a/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py b/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
index 9389de971286..fafb29333924 100644
--- a/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
+++ b/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestUniquePtrDbgInfoContent(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,14 +17,18 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (int)s->a", substrs=['(int) $0 = 3'])
-        self.expect("expr (int)(s->a = 5)", substrs=['(int) $1 = 5'])
-        self.expect("expr (int)s->a", substrs=['(int) $2 = 5'])
-        self.expect("expr (bool)s", substrs=['(bool) $3 = true'])
+        self.expect_expr(
+            "s",
+            result_type="std::unique_ptr<Foo, std::default_delete<Foo> >",
+            result_children=[ValueCheck(children=[ValueCheck(value="3")])])
+        self.expect_expr("s->a", result_type="int", result_value="3")
+        self.expect_expr("s->a = 5", result_type="int", result_value="5")
+        self.expect_expr("(int)s->a", result_type="int", result_value="5")
+        self.expect_expr("(bool)s", result_type="bool", result_value="true")
         self.expect("expr s.reset()")
-        self.expect("expr (bool)s", substrs=['(bool) $4 = false'])
-
+        self.expect_expr("(bool)s", result_type="bool", result_value="false")

diff  --git a/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/main.cpp b/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/main.cpp
index 73664f1c83a4..4e81e6beee85 100644
--- a/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/main.cpp
+++ b/lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/main.cpp
@@ -5,7 +5,7 @@ struct Foo {
 };
 
 int main(int argc, char **argv) {
-  std::shared_ptr<Foo> s(new Foo);
+  std::unique_ptr<Foo> s(new Foo);
   s->a = 3;
   return s->a; // Set break point at this line.
 }

diff  --git a/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
index a0e05b2c4202..7bd391243734 100644
--- a/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestUniquePtr(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,14 +17,19 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (int)*s", substrs=['(int) $0 = 3'])
-        self.expect("expr (int)(*s = 5)", substrs=['(int) $1 = 5'])
-        self.expect("expr (int)*s", substrs=['(int) $2 = 5'])
-        self.expect("expr (bool)s", substrs=['(bool) $3 = true'])
+        self.expect_expr(
+            "s",
+            result_type="std::unique_ptr<int, std::default_delete<int> >",
+            result_summary="3",
+            result_children=[ValueCheck(name="__value_")])
+        self.expect_expr("*s", result_type="int", result_value="3")
+        self.expect_expr("*s = 5", result_type="int", result_value="5")
+        self.expect_expr("*s", result_type="int", result_value="5")
+        self.expect_expr("(bool)s", result_type="bool", result_value="true")
         self.expect("expr s.reset()")
-        self.expect("expr (bool)s", substrs=['(bool) $4 = false'])
-
+        self.expect_expr("(bool)s", result_type="bool", result_value="false")

diff  --git a/lldb/test/API/commands/expression/import-std-module/unique_ptr/main.cpp b/lldb/test/API/commands/expression/import-std-module/unique_ptr/main.cpp
index cb81754087fd..dd7dbe638aed 100644
--- a/lldb/test/API/commands/expression/import-std-module/unique_ptr/main.cpp
+++ b/lldb/test/API/commands/expression/import-std-module/unique_ptr/main.cpp
@@ -1,7 +1,7 @@
 #include <memory>
 
 int main(int argc, char **argv) {
-  std::shared_ptr<int> s(new int);
+  std::unique_ptr<int> s(new int);
   *s = 3;
   return *s; // Set break point at this line.
 }

diff  --git a/lldb/test/API/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py
index 45a2507f7765..0f0279e4c017 100644
--- a/lldb/test/API/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestBoolVector(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,15 +17,35 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
-
-        self.runCmd("settings set target.import-std-module true")
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 4'])
-        self.expect("expr (bool)a.front()", substrs=['(bool) $1 = false'])
-        self.expect("expr (bool)a[1]", substrs=['(bool) $2 = true'])
-        self.expect("expr (bool)a.back()", substrs=['(bool) $3 = true'])
+        vector_type = "std::vector<bool, std::allocator<bool> >"
+        size_type = vector_type + "::size_type"
 
-        self.expect("expr (bool)(*a.begin())", substrs=['(bool) $4 = false'])
-        self.expect("expr (bool)(*a.rbegin())", substrs=['(bool) $5 = true'])
+        self.runCmd("settings set target.import-std-module true")
 
+        self.expect_expr("a",
+                         result_type=vector_type,
+                         result_children=[
+                             ValueCheck(value="false"),
+                             ValueCheck(value="true"),
+                             ValueCheck(value="false"),
+                             ValueCheck(value="true"),
+                         ])
+        self.expect_expr("a.size()", result_type=size_type, result_value="4")
+        # FIXME: Without the casting the result can't be materialized.
+        self.expect_expr("(bool)a.front()",
+                         result_type="bool",
+                         result_value="false")
+        self.expect_expr("(bool)a[1]", result_type="bool", result_value="true")
+        self.expect_expr("(bool)a.back()",
+                         result_type="bool",
+                         result_value="true")
+
+        self.expect_expr("(bool)*a.begin()",
+                         result_type="bool",
+                         result_value="false")
+        self.expect_expr("(bool)*a.rbegin()",
+                         result_type="bool",
+                         result_value="true")

diff  --git a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
index 4d51f1ba3b60..6537178e03e6 100644
--- a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
@@ -7,6 +7,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestDbgInfoContentVector(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -17,27 +18,55 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3'])
-        self.expect("expr (int)a.front().a", substrs=['(int) $1 = 3'])
-        self.expect("expr (int)a[1].a", substrs=['(int) $2 = 1'])
-        self.expect("expr (int)a.back().a", substrs=['(int) $3 = 2'])
+        vector_type = "std::vector<Foo, std::allocator<Foo> >"
+        size_type = vector_type + "::size_type"
+        value_type = vector_type + "::value_type"
+        iterator = vector_type + "::iterator"
+        # LLDB's formatter provides us with a artificial 'item' member.
+        iterator_children = [ValueCheck(name="item")]
+        riterator = vector_type + "::reverse_iterator"
+        riterator_children = [
+            ValueCheck(name="__t"),
+            ValueCheck(name="current")
+        ]
+
+        self.expect_expr("a",
+                         result_type=vector_type,
+                         result_children=[
+                             ValueCheck(children=[ValueCheck(value="3")]),
+                             ValueCheck(children=[ValueCheck(value="1")]),
+                             ValueCheck(children=[ValueCheck(value="2")]),
+                         ])
+
+        self.expect_expr("a.size()", result_type=size_type, result_value="3")
+        self.expect_expr("a.front().a", result_type="int", result_value="3")
+        self.expect_expr("a[1].a", result_type="int", result_value="1")
+        self.expect_expr("a.back().a", result_type="int", result_value="2")
 
         self.expect("expr std::reverse(a.begin(), a.end())")
-        self.expect("expr (int)a.front().a", substrs=['(int) $4 = 2'])
+        self.expect_expr("a.front().a", result_type="int", result_value="2")
 
-        self.expect("expr (int)(a.begin()->a)", substrs=['(int) $5 = 2'])
-        self.expect("expr (int)(a.rbegin()->a)", substrs=['(int) $6 = 3'])
+        self.expect_expr("a.begin()->a", result_type="int", result_value="2")
+        self.expect_expr("a.rbegin()->a", result_type="int", result_value="3")
 
         self.expect("expr a.pop_back()")
-        self.expect("expr (int)a.back().a", substrs=['(int) $7 = 1'])
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $8 = 2'])
+        self.expect_expr("a.back().a", result_type="int", result_value="1")
+        self.expect_expr("a.size()", result_type=size_type, result_value="2")
 
-        self.expect("expr (int)a.at(0).a", substrs=['(int) $9 = 2'])
+        self.expect_expr("a.at(0).a", result_type="int", result_value="2")
 
         self.expect("expr a.push_back({4})")
-        self.expect("expr (int)a.back().a", substrs=['(int) $10 = 4'])
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $11 = 3'])
+        self.expect_expr("a.back().a", result_type="int", result_value="4")
+        self.expect_expr("a.size()", result_type=size_type, result_value="3")
+
+        self.expect_expr("a.begin()",
+                         result_type=iterator,
+                         result_children=iterator_children)
+        self.expect_expr("a.rbegin()",
+                         result_type=riterator,
+                         result_children=riterator_children)

diff  --git a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
index feaeac9be5e0..bb1d736689ca 100644
--- a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestVectorOfVectors(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,11 +17,42 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
+
+        vector_type = "std::vector<int, std::allocator<int> >"
+        vector_of_vector_type = "std::vector<" + vector_type + \
+            ", std::allocator<std::vector<int, std::allocator<int> > > >"
+        size_type = (
+            "std::vector<std::vector<int, std::allocator<int> >, " +
+            "std::allocator<std::vector<int, std::allocator<int> > >" +
+            " >::size_type")
+        value_type = "std::__vector_base<int, std::allocator<int> >::value_type"
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 2'])
-        self.expect("expr (int)a.front().front()", substrs=['(int) $1 = 1'])
-        self.expect("expr (int)a[1][1]", substrs=['(int) $2 = 2'])
-        self.expect("expr (int)a.back().at(0)", substrs=['(int) $3 = 3'])
+        self.expect_expr(
+            "a",
+            result_type=vector_of_vector_type,
+            result_children=[
+                ValueCheck(type="std::vector<int, std::allocator<int> >",
+                           children=[
+                               ValueCheck(value='1'),
+                               ValueCheck(value='2'),
+                               ValueCheck(value='3'),
+                           ]),
+                ValueCheck(type="std::vector<int, std::allocator<int> >",
+                           children=[
+                               ValueCheck(value='3'),
+                               ValueCheck(value='2'),
+                               ValueCheck(value='1'),
+                           ]),
+            ])
+        self.expect_expr("a.size()", result_type=size_type, result_value="2")
+        self.expect_expr("a.front().front()",
+                         result_type=value_type,
+                         result_value="1")
+        self.expect_expr("a[1][1]", result_type=value_type, result_value="2")
+        self.expect_expr("a.back().at(0)",
+                         result_type=value_type,
+                         result_value="3")

diff  --git a/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
index 840bacb86b30..c9e1c94eb415 100644
--- a/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestBasicVector(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,38 +17,73 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $0 = 3'])
-        self.expect("expr (int)a.front()", substrs=['(int) $1 = 3'])
-        self.expect("expr (int)a[1]", substrs=['(int) $2 = 1'])
-        self.expect("expr (int)a.back()", substrs=['(int) $3 = 2'])
+        vector_type = "std::vector<int, std::allocator<int> >"
+        size_type = vector_type + "::size_type"
+        value_type = "std::__vector_base<int, std::allocator<int> >::value_type"
+        iterator = vector_type + "::iterator"
+        # LLDB's formatter provides us with a artificial 'item' member.
+        iterator_children = [ValueCheck(name="item")]
+        riterator = vector_type + "::reverse_iterator"
+        riterator_children = [
+            ValueCheck(name="__t"),
+            ValueCheck(name="current")
+        ]
+
+        self.expect_expr("a",
+                         result_type=vector_type,
+                         result_children=[
+                             ValueCheck(value="3"),
+                             ValueCheck(value="1"),
+                             ValueCheck(value="2")
+                         ])
+        self.expect_expr("a.size()", result_type=size_type, result_value="3")
+        self.expect_expr("a.front()", result_type=value_type, result_value="3")
+        self.expect_expr("a[1]", result_type=value_type, result_value="1")
+        self.expect_expr("a.back()", result_type=value_type, result_value="2")
 
         self.expect("expr std::sort(a.begin(), a.end())")
-        self.expect("expr (int)a.front()", substrs=['(int) $4 = 1'])
-        self.expect("expr (int)a[1]", substrs=['(int) $5 = 2'])
-        self.expect("expr (int)a.back()", substrs=['(int) $6 = 3'])
+        self.expect_expr("a.front()", result_type=value_type, result_value="1")
+        self.expect_expr("a[1]", result_type=value_type, result_value="2")
+        self.expect_expr("a.back()", result_type=value_type, result_value="3")
 
         self.expect("expr std::reverse(a.begin(), a.end())")
-        self.expect("expr (int)a.front()", substrs=['(int) $7 = 3'])
-        self.expect("expr (int)a[1]", substrs=['(int) $8 = 2'])
-        self.expect("expr (int)a.back()", substrs=['(int) $9 = 1'])
+        self.expect_expr("a.front()", result_type=value_type, result_value="3")
+        self.expect_expr("a[1]", result_type=value_type, result_value="2")
+        self.expect_expr("a.back()", result_type=value_type, result_value="1")
 
-        self.expect("expr (int)(*a.begin())", substrs=['(int) $10 = 3'])
-        self.expect("expr (int)(*a.rbegin())", substrs=['(int) $11 = 1'])
+        self.expect_expr("a.begin()",
+                         result_type=iterator,
+                         result_children=iterator_children)
+        self.expect_expr("a.rbegin()",
+                         result_type=riterator,
+                         result_children=riterator_children)
+
+        self.expect_expr("*a.begin()", result_type="int", result_value="3")
+        self.expect_expr("*a.rbegin()", result_type="int", result_value="1")
 
         self.expect("expr a.pop_back()")
-        self.expect("expr (int)a.back()", substrs=['(int) $12 = 2'])
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $13 = 2'])
+        self.expect_expr("a.back()", result_type=value_type, result_value="2")
+        self.expect_expr("a.size()", result_type=size_type, result_value="2")
 
-        self.expect("expr (int)a.at(0)", substrs=['(int) $14 = 3'])
+        self.expect_expr("a.at(0)", result_type=value_type, result_value="3")
 
         self.expect("expr a.push_back(4)")
-        self.expect("expr (int)a.back()", substrs=['(int) $15 = 4'])
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $16 = 3'])
+        self.expect_expr("a.back()", result_type=value_type, result_value="4")
+        self.expect_expr("a.size()", result_type=size_type, result_value="3")
 
         self.expect("expr a.emplace_back(5)")
-        self.expect("expr (int)a.back()", substrs=['(int) $17 = 5'])
-        self.expect("expr (size_t)a.size()", substrs=['(size_t) $18 = 4'])
+        self.expect_expr("a.back()", result_type=value_type, result_value="5")
+        self.expect_expr("a.size()", result_type=size_type, result_value="4")
+
+        self.expect_expr("a",
+                         result_children=[
+                             ValueCheck(value="3"),
+                             ValueCheck(value="2"),
+                             ValueCheck(value="4"),
+                             ValueCheck(value="5")
+                         ])

diff  --git a/lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py
index 5ed30312ea76..d99d5cec86b3 100644
--- a/lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestDbgInfoContentWeakPtr(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,14 +17,20 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (int)w.lock()->a", substrs=['(int) $0 = 3'])
-        self.expect("expr (int)(w.lock()->a = 5)", substrs=['(int) $1 = 5'])
-        self.expect("expr (int)w.lock()->a", substrs=['(int) $2 = 5'])
-        self.expect("expr w.use_count()", substrs=['(long) $3 = 1'])
+        self.expect_expr("w",
+                         result_type="std::weak_ptr<Foo>",
+                         result_children=[ValueCheck(name="__ptr_")])
+        self.expect_expr("*w.lock()", result_type="Foo")
+        self.expect_expr("w.lock()->a", result_type="int", result_value="3")
+        self.expect_expr("w.lock()->a = 5",
+                         result_type="int",
+                         result_value="5")
+        self.expect_expr("w.lock()->a", result_type="int", result_value="5")
+        self.expect_expr("w.use_count()", result_type="long", result_value="1")
         self.expect("expr w.reset()")
-        self.expect("expr w.use_count()", substrs=['(long) $4 = 0'])
-
+        self.expect_expr("w.use_count()", result_type="long", result_value="0")

diff  --git a/lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py
index 76241740b682..6e1b13375f03 100644
--- a/lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py
@@ -6,6 +6,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+
 class TestSharedPtr(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -16,14 +17,18 @@ def test(self):
         self.build()
 
         lldbutil.run_to_source_breakpoint(self,
-            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
+                                          "// Set break point at this line.",
+                                          lldb.SBFileSpec("main.cpp"))
 
         self.runCmd("settings set target.import-std-module true")
 
-        self.expect("expr (int)*w.lock()", substrs=['(int) $0 = 3'])
-        self.expect("expr (int)(*w.lock() = 5)", substrs=['(int) $1 = 5'])
-        self.expect("expr (int)*w.lock()", substrs=['(int) $2 = 5'])
-        self.expect("expr w.use_count()", substrs=['(long) $3 = 1'])
+        self.expect_expr("w",
+                         result_type="std::weak_ptr<int>",
+                         result_summary="3 strong=1 weak=2",
+                         result_children=[ValueCheck(name="__ptr_")])
+        self.expect_expr("*w.lock()", result_type="int", result_value="3")
+        self.expect_expr("*w.lock() = 5", result_type="int", result_value="5")
+        self.expect_expr("*w.lock()", result_type="int", result_value="5")
+        self.expect_expr("w.use_count()", result_type="long", result_value="1")
         self.expect("expr w.reset()")
-        self.expect("expr w.use_count()", substrs=['(long) $4 = 0'])
-
+        self.expect_expr("w.use_count()", result_type="long", result_value="0")


        


More information about the lldb-commits mailing list