summaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic
diff options
context:
space:
mode:
authornerix <nerixdev@outlook.de>2025-07-23 17:19:47 +0200
committerGitHub <noreply@github.com>2025-07-23 16:19:47 +0100
commitd5c8303af86f8f4f50320b831c027df4febcd5ea (patch)
tree11654965b0d5b2a68fc5a6e1664b5be61052cdf5 /lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic
parentf0f3194e198e05fe9094cfb39a2cf63f3b4a1a7d (diff)
[LLDB] Add formatters for MSVC STL std::deque (#150097)
This PR adds synthetic children for std::deque from MSVC's STL. Similar to libstdc++ and libc++, the elements are in a `T**`, so we need to "subscript" twice. The [NatVis for deque](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/debugger/STL.natvis#L1103-L1112) uses `_EEN_DS` which contains the block size. We can't access this, but we can access the [constexpr `_Block_size`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/inc/deque#L641). Towards #24834.
Diffstat (limited to 'lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic')
-rw-r--r--lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py32
1 files changed, 21 insertions, 11 deletions
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py
index f52f6f7ec3ff..2332eff7b10d 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py
@@ -3,9 +3,6 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-USE_LIBSTDCPP = "USE_LIBSTDCPP"
-USE_LIBCPP = "USE_LIBCPP"
-
class GenericDequeDataFormatterTestCase(TestBase):
def findVariable(self, name):
@@ -56,8 +53,7 @@ class GenericDequeDataFormatterTestCase(TestBase):
],
)
- def do_test(self, stdlib_type):
- self.build(dictionary={stdlib_type: "1"})
+ def do_test(self):
(_, process, _, bkpt) = lldbutil.run_to_source_breakpoint(
self, "break here", lldb.SBFileSpec("main.cpp")
)
@@ -135,15 +131,22 @@ class GenericDequeDataFormatterTestCase(TestBase):
@add_test_categories(["libstdcxx"])
def test_libstdcpp(self):
- self.do_test(USE_LIBSTDCPP)
+ self.build(dictionary={"USE_LIBSTDCPP": 1})
+ self.do_test()
@add_test_categories(["libc++"])
def test_libcpp(self):
- self.do_test(USE_LIBCPP)
+ self.build(dictionary={"USE_LIBCPP": 1})
+ self.do_test()
+
+ @add_test_categories(["msvcstl"])
+ def test_msvcstl(self):
+ # No flags, because the "msvcstl" category checks that the MSVC STL is used by default.
+ self.build()
+ self.do_test()
- def do_test_ref_and_ptr(self, stdlib_type: str):
+ def do_test_ref_and_ptr(self):
"""Test formatting of std::deque& and std::deque*"""
- self.build(dictionary={stdlib_type: "1"})
(self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
self, "stop here", lldb.SBFileSpec("main.cpp", False)
)
@@ -157,8 +160,15 @@ class GenericDequeDataFormatterTestCase(TestBase):
@add_test_categories(["libstdcxx"])
def test_libstdcpp_ref_and_ptr(self):
- self.do_test_ref_and_ptr(USE_LIBSTDCPP)
+ self.build(dictionary={"USE_LIBSTDCPP": 1})
+ self.do_test_ref_and_ptr()
@add_test_categories(["libc++"])
def test_libcpp_ref_and_ptr(self):
- self.do_test_ref_and_ptr(USE_LIBCPP)
+ self.build(dictionary={"USE_LIBCPP": 1})
+ self.do_test_ref_and_ptr()
+
+ @add_test_categories(["msvcstl"])
+ def test_msvcstl_ref_and_ptr(self):
+ self.build()
+ self.do_test_ref_and_ptr()