https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/147525

>From ce9eaf42172580aac1d97e109d8713ba59c3c91a Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuc...@gmail.com>
Date: Tue, 8 Jul 2025 15:21:28 +0100
Subject: [PATCH 1/4] [lldb][test] Merge MSVC STL std::(u8)string tests into
 generic directory

---
 .../string/TestDataFormatterStdString.py      |  21 +++
 .../generic/string/main.cpp                   |   2 +
 .../string => generic/u8string}/Makefile      |   1 +
 .../u8string/TestDataFormatterStdU8String.py} |  29 +++--
 .../{msvcstl => generic}/u8string/main.cpp    |  10 +-
 .../string/TestDataFormatterMsvcStlString.py  | 120 ------------------
 .../msvcstl/string/main.cpp                   |  40 ------
 .../msvcstl/u8string/Makefile                 |   4 -
 8 files changed, 48 insertions(+), 179 deletions(-)
 rename 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/{msvcstl/string 
=> generic/u8string}/Makefile (61%)
 rename 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/{msvcstl/u8string/TestDataFormatterMsvcStlU8String.py
 => generic/u8string/TestDataFormatterStdU8String.py} (53%)
 rename 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/{msvcstl => 
generic}/u8string/main.cpp (52%)
 delete mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/TestDataFormatterMsvcStlString.py
 delete mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/main.cpp
 delete mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/Makefile

diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
index 7ae5687af2cf4..ba8a8b32afeb7 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
@@ -80,6 +80,7 @@ def cleanup():
                 '(%s::string) Q = "quite a long std::strin with lots of info 
inside it"'
                 % ns,
                 "(%s::string *) null_str = nullptr" % ns,
+                '(std::string) overwritten_zero = "abc"',
             ],
         )
 
@@ -124,6 +125,11 @@ def test_libstdcxx(self):
         self.build(dictionary={"USE_LIBSTDCPP": 1})
         self.do_test()
 
+    @add_test_categories(["msvcstl"])
+    def test_msvc(self):
+        self.build()
+        self.do_test()
+
     def do_test_multibyte(self):
         lldbutil.run_to_source_breakpoint(
             self, "Set break point at this line.", self.main_spec
@@ -157,6 +163,11 @@ def test_multibyte_libstdcxx(self):
         self.build(dictionary={"USE_LIBSTDCPP": 1})
         self.do_test_multibyte()
 
+    @add_test_categories(["msvcstl"])
+    def test_multibyte_msvc(self):
+        self.build()
+        self.do_test_multibyte()
+
     def do_test_uncapped_summary(self):
         (_, _, thread, _) = lldbutil.run_to_source_breakpoint(
             self, "Set break point at this line.", self.main_spec
@@ -187,6 +198,11 @@ def test_uncapped_libstdcxx(self):
         self.build(dictionary={"USE_LIBSTDCPP": 1})
         self.do_test_uncapped_summary()
 
+    @add_test_categories(["msvcstl"])
+    def test_uncapped_msvc(self):
+        self.build()
+        self.do_test_uncapped_summary()
+
     def do_test_summary_unavailable(self):
         """
         Make sure that if the string is not readable, we give an error.
@@ -212,3 +228,8 @@ def test_unavailable_summary_libcxx(self):
     def test_unavailable_summary_libstdcxx(self):
         self.build(dictionary={"USE_LIBSTDCPP": 1})
         self.do_test_summary_unavailable()
+
+    @add_test_categories(["msvcstl"])
+    def test_unavailable_summary_msvc(self):
+        self.build()
+        self.do_test_summary_unavailable()
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp
index db695ed06f015..f22c890861d01 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp
@@ -13,6 +13,8 @@ int main() {
   std::string empty("");
   std::string q("hello world");
   std::string Q("quite a long std::strin with lots of info inside it");
+  std::string overwritten_zero("abc");
+  const_cast<char *>(overwritten_zero.data())[3] = 'd';
   std::string TheVeryLongOne(
       
"123456789012345678901234567890123456789012345678901234567890123456789012"
       
"345678901234567890123456789012345678901234567890123456789012345678901234"
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/Makefile
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/u8string/Makefile
similarity index 61%
rename from 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/Makefile
rename to 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/u8string/Makefile
index 99998b20bcb05..4f79c0a900c3a 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/Makefile
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/u8string/Makefile
@@ -1,3 +1,4 @@
 CXX_SOURCES := main.cpp
+CXXFLAGS_EXTRAS := -std=c++20
 
 include Makefile.rules
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/TestDataFormatterMsvcStlU8String.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/u8string/TestDataFormatterStdU8String.py
similarity index 53%
rename from 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/TestDataFormatterMsvcStlU8String.py
rename to 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/u8string/TestDataFormatterStdU8String.py
index f181f520f5d85..f5d7dc5c3b79b 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/TestDataFormatterMsvcStlU8String.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/u8string/TestDataFormatterStdU8String.py
@@ -1,6 +1,6 @@
 # coding=utf8
 """
-Test std::u8string summary with MSVC's STL.
+Test std::u8string summary.
 """
 
 
@@ -10,14 +10,8 @@
 from lldbsuite.test import lldbutil
 
 
-class MsvcStlU8StringDataFormatterTestCase(TestBase):
-    NO_DEBUG_INFO_TESTCASE = True
-
-    @add_test_categories(["msvcstl"])
-    def test_with_run_command(self):
-        """Test that that file and class static variables display correctly."""
-        self.build()
-
+class StdU8StringDataFormatterTestCase(TestBase):
+    def do_test(self):
         lldbutil.run_to_source_breakpoint(
             self, "Set break point at this line.", lldb.SBFileSpec("main.cpp")
         )
@@ -31,3 +25,20 @@ def test_with_run_command(self):
                 '(std::u8string) u8_text = u8"ABC"',
             ],
         )
+
+    @expectedFailureAll(bugnumber="No libc++ formatters for std::u8string 
yet.")
+    @add_test_categories(["libc++"])
+    def test_libcxx(self):
+        self.build(dictionary={"USE_LIBCPP": 1})
+        self.do_test()
+
+    @expectedFailureAll(bugnumber="No libstdc++ formatters for std::u8string 
yet.")
+    @add_test_categories(["libstdcxx"])
+    def test_libstdcxx(self):
+        self.build(dictionary={"USE_LIBSTDCPP": 1})
+        self.do_test()
+
+    @add_test_categories(["msvcstl"])
+    def test_msvc(self):
+        self.build()
+        self.do_test()
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/u8string/main.cpp
similarity index 52%
rename from 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/main.cpp
rename to 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/u8string/main.cpp
index e01af9fa08e7e..3db9d6380f61e 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/u8string/main.cpp
@@ -1,14 +1,12 @@
+#include <cstdio>
 #include <string>
 
-#ifndef _MSVC_STL_VERSION
-// this is more of a sanity check that the categories work as expected
-#error Not using MSVC STL
-#endif
-
 int main() {
   std::u8string u8_string_small(u8"🍄");
   std::u8string u8_string(u8"â€ïžđŸ‘đŸ“„đŸ“đŸ˜ƒđŸ§‘â€đŸŒŸ");
   std::u8string u8_empty(u8"");
   std::u8string u8_text(u8"ABC");
-  u8_text.assign(u8"ABCd"); // Set break point at this line.
+  u8_text.assign(u8"ABCd");
+
+  std::puts("// Set break point at this line.");
 }
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/TestDataFormatterMsvcStlString.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/TestDataFormatterMsvcStlString.py
deleted file mode 100644
index e49ea84dbdf47..0000000000000
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/TestDataFormatterMsvcStlString.py
+++ /dev/null
@@ -1,120 +0,0 @@
-# coding=utf8
-"""
-Test std::*string summaries with MSVC's STL.
-"""
-
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class MsvcStlStringDataFormatterTestCase(TestBase):
-    NO_DEBUG_INFO_TESTCASE = True
-
-    @add_test_categories(["msvcstl"])
-    def test_with_run_command(self):
-        """Test that that file and class static variables display correctly."""
-        self.build()
-
-        main_spec = lldb.SBFileSpec("main.cpp")
-        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
-            self, "Set break point at this line.", main_spec
-        )
-        frame = thread.frames[0]
-
-        # This is the function to remove the custom formats in order to have a
-        # clean slate for the next test case.
-        def cleanup():
-            self.runCmd("type format clear", check=False)
-            self.runCmd("type summary clear", check=False)
-            self.runCmd("type filter clear", check=False)
-            self.runCmd("type synth clear", check=False)
-
-        # Execute the cleanup function during test case tear down.
-        self.addTearDownHook(cleanup)
-
-        self.expect(
-            "frame variable",
-            substrs=[
-                '(std::wstring) wempty = L""',
-                '(std::wstring) s = L"hello world! ŚžŚ–Śœ Ś˜Ś•Ś‘!"',
-                '(std::wstring) S = L"!!!!"',
-                "(const wchar_t *) mazeltov = 0x",
-                'L"ŚžŚ–Śœ Ś˜Ś•Ś‘"',
-                '(std::string) empty = ""',
-                '(std::string) q = "hello world"',
-                '(std::string) Q = "quite a long std::strin with lots of info 
inside it"',
-                '(std::string) overwritten_zero = "abc"',
-                '(std::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"',
-                '(std::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0どざ 
ăƒ«ă‚œä‹šăƒŸă §æ§Š ăă‚…ăžç‹Šç©€è„© ă˜ă‚ƒéŠ©ăƒȘョ 䀊監"',
-                '(std::u16string) u16_string = u"ĂŸæ°Žæ°¶"',
-                '(std::u16string) u16_empty = u""',
-                '(std::u32string) u32_string = U"🍄🍅🍆🍌"',
-                '(std::u32string) u32_empty = U""',
-                "(std::string *) null_str = nullptr",
-            ],
-        )
-
-        thread.StepOver()
-
-        TheVeryLongOne = frame.FindVariable("TheVeryLongOne")
-        summaryOptions = lldb.SBTypeSummaryOptions()
-        summaryOptions.SetCapping(lldb.eTypeSummaryUncapped)
-        uncappedSummaryStream = lldb.SBStream()
-        TheVeryLongOne.GetSummary(uncappedSummaryStream, summaryOptions)
-        uncappedSummary = uncappedSummaryStream.GetData()
-        self.assertGreater(
-            uncappedSummary.find("someText"),
-            0,
-            "uncappedSummary does not include the full string",
-        )
-        summaryOptions.SetCapping(lldb.eTypeSummaryCapped)
-        cappedSummaryStream = lldb.SBStream()
-        TheVeryLongOne.GetSummary(cappedSummaryStream, summaryOptions)
-        cappedSummary = cappedSummaryStream.GetData()
-        self.assertLessEqual(
-            cappedSummary.find("someText"), 0, "cappedSummary includes the 
full string"
-        )
-
-        self.expect_expr(
-            "s", result_type="std::wstring", result_summary='L"hello world! 
ŚžŚ–Śœ Ś˜Ś•Ś‘!"'
-        )
-
-        self.expect_expr("q", result_type="std::string", 
result_summary='"hello world"')
-
-        self.expect_expr(
-            "Q",
-            result_type="std::string",
-            result_summary='"quite a long std::strin with lots of info inside 
it"',
-        )
-
-        self.expect(
-            "frame variable",
-            substrs=[
-                '(std::wstring) S = L"!!!!!"',
-                "(const wchar_t *) mazeltov = 0x",
-                'L"ŚžŚ–Śœ Ś˜Ś•Ś‘"',
-                '(std::string) q = "hello world"',
-                '(std::string) Q = "quite a long std::strin with lots of info 
inside it"',
-                '(std::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"',
-                '(std::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0どざ 
ăƒ«ă‚œä‹šăƒŸă §æ§Š ăă‚…ăžç‹Šç©€è„© ă˜ă‚ƒéŠ©ăƒȘョ 䀊監"',
-                '(std::u16string) u16_string = u"ĂŸæ°Žæ°¶"',
-                '(std::u32string) u32_string = U"🍄🍅🍆🍌"',
-                '(std::u32string) u32_empty = U""',
-                "(std::string *) null_str = nullptr",
-            ],
-        )
-
-        # Finally, make sure that if the string is not readable, we give an 
error:
-        bkpt_2 = target.BreakpointCreateBySourceRegex(
-            "Break here to look at bad string", main_spec
-        )
-        self.assertEqual(bkpt_2.GetNumLocations(), 1, "Got one location")
-        threads = lldbutil.continue_to_breakpoint(process, bkpt_2)
-        self.assertEqual(len(threads), 1, "Stopped at second breakpoint")
-        frame = threads[0].frames[0]
-        var = frame.FindVariable("in_str")
-        self.assertTrue(var.GetError().Success(), "Made variable")
-        self.assertIsNone(var.GetSummary())
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/main.cpp
deleted file mode 100644
index fcfb5d48e9bb1..0000000000000
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/main.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <stdint.h>
-
-#include <string>
-
-#ifndef _MSVC_STL_VERSION
-// this is more of a sanity check that the categories work as expected
-#error Not using MSVC STL
-#endif
-
-static size_t touch_string(std::string &in_str) {
-  return in_str.size(); // Break here to look at bad string
-}
-
-int main() {
-  std::wstring wempty(L"");
-  std::wstring s(L"hello world! ŚžŚ–Śœ Ś˜Ś•Ś‘!");
-  std::wstring S(L"!!!!");
-  const wchar_t *mazeltov = L"ŚžŚ–Śœ Ś˜Ś•Ś‘";
-  std::string empty("");
-  std::string q("hello world");
-  std::string Q("quite a long std::strin with lots of info inside it");
-  std::string overwritten_zero("abc");
-  const_cast<char *>(overwritten_zero.data())[3] = 'd';
-  // clang-format off
-  std::string 
TheVeryLongOne("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890someText1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
-  // clang-format on
-  std::string IHaveEmbeddedZeros("a\0b\0c\0d", 7);
-  std::wstring IHaveEmbeddedZerosToo(
-      L"hello world!\0どざ ăƒ«ă‚œä‹šăƒŸă §æ§Š ăă‚…ăžç‹Šç©€è„© ă˜ă‚ƒéŠ©ăƒȘョ 䀊監", 38);
-  std::u16string u16_string(u"ĂŸæ°Žæ°¶");
-  std::u16string u16_empty(u"");
-  std::u32string u32_string(U"🍄🍅🍆🍌");
-  std::u32string u32_empty(U"");
-  std::string *null_str = nullptr;
-
-  S.assign(L"!!!!!"); // Set break point at this line.
-  std::string *not_a_string = (std::string *)0x0;
-  touch_string(*not_a_string);
-  return 0;
-}
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/Makefile
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/Makefile
deleted file mode 100644
index 58558e6e15f78..0000000000000
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-CXX_SOURCES := main.cpp
-
-CXXFLAGS_EXTRAS := -std=c++20 -O0
-include Makefile.rules

>From af13cece9d8a74ae46e58b510021c881f6adcfe5 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuc...@gmail.com>
Date: Tue, 8 Jul 2025 16:20:26 +0100
Subject: [PATCH 2/4] fixup! move check

---
 .../generic/string/TestDataFormatterStdString.py                | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
index ba8a8b32afeb7..9bc9ced887a15 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
@@ -79,8 +79,8 @@ def cleanup():
                 '(%s::string) q = "hello world"' % ns,
                 '(%s::string) Q = "quite a long std::strin with lots of info 
inside it"'
                 % ns,
-                "(%s::string *) null_str = nullptr" % ns,
                 '(std::string) overwritten_zero = "abc"',
+                "(%s::string *) null_str = nullptr" % ns,
             ],
         )
 

>From 62298d7663c6736b1a7c2bd2d729cc66ee7174e2 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuc...@gmail.com>
Date: Wed, 9 Jul 2025 12:53:52 +0100
Subject: [PATCH 3/4] fixup! separate out overwrite_zero test-case

---
 .../string/TestDataFormatterStdString.py      | 26 ++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
index 9bc9ced887a15..dadaab022ddf8 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
@@ -79,7 +79,6 @@ def cleanup():
                 '(%s::string) q = "hello world"' % ns,
                 '(%s::string) Q = "quite a long std::strin with lots of info 
inside it"'
                 % ns,
-                '(std::string) overwritten_zero = "abc"',
                 "(%s::string *) null_str = nullptr" % ns,
             ],
         )
@@ -233,3 +232,28 @@ def test_unavailable_summary_libstdcxx(self):
     def test_unavailable_summary_msvc(self):
         self.build()
         self.do_test_summary_unavailable()
+
+    def do_test_overwritten(self):
+        lldbutil.run_to_source_breakpoint(
+            self, "Set break point at this line.", self.main_spec
+        )
+
+        self.expect_var_path("overwritten_zero", summary='"abc"')
+
+    @add_test_categories(["libc++"])
+    def test_overwritten_libcxx(self):
+        self.build(dictionary={"USE_LIBCPP": 1})
+        self.do_test_overwritten()
+
+    @expectedFailureAll(
+        bugnumber="libstdc++ format for non-null terminated std::string 
currently diverges from MSVC and libc++ formatter."
+    )
+    @add_test_categories(["libstdcxx"])
+    def test_overwritten_libstdcxx(self):
+        self.build(dictionary={"USE_LIBSTDCPP": 1})
+        self.do_test_overwritten()
+
+    @add_test_categories(["msvcstl"])
+    def test_overwritten_msvc(self):
+        self.build()
+        self.do_test_overwritten()

>From 845ac8e5c045e74239bde33541989b44a2ebac8d Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuc...@gmail.com>
Date: Wed, 9 Jul 2025 12:59:18 +0100
Subject: [PATCH 4/4] fixup! separate out embedded-null test-case

---
 .../string/TestDataFormatterStdString.py      | 37 +++++++++++++++++--
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
index dadaab022ddf8..c4a5fe2f97bae 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
@@ -139,9 +139,6 @@ def do_test_multibyte(self):
         self.expect(
             "frame variable",
             substrs=[
-                '(%s::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"' % ns,
-                '(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0どざ 
ăƒ«ă‚œä‹šăƒŸă §æ§Š ăă‚…ăžç‹Šç©€è„© ă˜ă‚ƒéŠ©ăƒȘョ 䀊監"'
-                % ns,
                 '(%s::u16string) u16_string = u"ĂŸæ°Žæ°¶"' % ns,
                 '(%s::u16string) u16_empty = u""' % ns,
                 '(%s::u32string) u32_string = U"🍄🍅🍆🍌"' % ns,
@@ -257,3 +254,37 @@ def test_overwritten_libstdcxx(self):
     def test_overwritten_msvc(self):
         self.build()
         self.do_test_overwritten()
+
+    def do_test_embedded_null(self):
+        lldbutil.run_to_source_breakpoint(
+            self, "Set break point at this line.", self.main_spec
+        )
+
+        ns = self.namespace
+
+        self.expect(
+            "frame variable",
+            substrs=[
+                '(%s::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"' % ns,
+                '(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0どざ 
ăƒ«ă‚œä‹šăƒŸă §æ§Š ăă‚…ăžç‹Šç©€è„© ă˜ă‚ƒéŠ©ăƒȘョ 䀊監"'
+                % ns,
+            ],
+        )
+
+    @add_test_categories(["libc++"])
+    def test_embedded_null_libcxx(self):
+        self.build(dictionary={"USE_LIBCPP": 1})
+        self.do_test_embedded_null()
+
+    @expectedFailureAll(
+        bugnumber="libstdc++ formatters incorrectly format std::string with 
embedded '\0' characters."
+    )
+    @add_test_categories(["libstdcxx"])
+    def test_embedded_null_libstdcxx(self):
+        self.build(dictionary={"USE_LIBSTDCPP": 1})
+        self.do_test_embedded_null()
+
+    @add_test_categories(["msvcstl"])
+    def test_embedded_null_msvc(self):
+        self.build()
+        self.do_test_embedded_null()

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to