[Lldb-commits] [lldb] 1f28da6 - [lldb][test] Combine libstdc++ and libc++ std::string tests into generic test (#147355)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 8 06:09:51 PDT 2025
Author: Michael Buch
Date: 2025-07-08T14:09:48+01:00
New Revision: 1f28da60d5dfa51b1e623fdd168fbb3ea85f6ac9
URL: https://github.com/llvm/llvm-project/commit/1f28da60d5dfa51b1e623fdd168fbb3ea85f6ac9
DIFF: https://github.com/llvm/llvm-project/commit/1f28da60d5dfa51b1e623fdd168fbb3ea85f6ac9.diff
LOG: [lldb][test] Combine libstdc++ and libc++ std::string tests into generic test (#147355)
This combines the libc++ and libstdc++ test cases. The main difference
was that the libstdcpp tests had additional tests for
references/pointers to std::string. I moved those over.
The libstdc++ formatters don't support `std::u16string`/`std::u32string`
yet, so I extracted those into XFAILed test cases.
There were also two test assertions that failed for libstdc++:
1. libstdc++ doesn't obey the capped/uncapped summary options
2. When a summary isn't available for a std::string, libc++ would print
"Summary Unavailable", whereas libstdc++ just prints "((null))". This
may be better suited for the STL-specific subdirectories, but left it
here for now.
I put those in separate XFAILed test-cases.
Split out from https://github.com/llvm/llvm-project/pull/146740
Added:
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/Makefile
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp
Modified:
Removed:
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp
################################################################################
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/Makefile
similarity index 53%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/Makefile
index c825977b1a5dc..99998b20bcb05 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/Makefile
@@ -1,6 +1,3 @@
CXX_SOURCES := main.cpp
-CFLAGS_EXTRAS := -O0
-USE_LIBSTDCPP := 1
-
include Makefile.rules
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
similarity index 52%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
index 2f7fc88e0f449..7ae5687af2cf4 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py
@@ -10,7 +10,7 @@
from lldbsuite.test import lldbutil
-class LibcxxStringDataFormatterTestCase(TestBase):
+class StdStringDataFormatterTestCase(TestBase):
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -18,17 +18,8 @@ def setUp(self):
self.main_spec = lldb.SBFileSpec("main.cpp")
self.namespace = "std"
- @add_test_categories(["libc++"])
- @expectedFailureAll(
- bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android"
- )
- # Inline namespace is randomly ignored as Clang due to broken lookup inside
- # the std namespace.
- @expectedFailureAll(debug_info="gmodules")
- def test_with_run_command(self):
+ def do_test(self):
"""Test that that file and class static variables display correctly."""
- self.build()
-
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
self, "Set break point at this line.", self.main_spec
)
@@ -47,42 +38,13 @@ def cleanup():
ns = self.namespace
- self.expect(
- "frame variable",
- substrs=[
- '(%s::wstring) wempty = L""' % ns,
- '(%s::wstring) s = L"hello world! מזל טוב!"' % ns,
- '(%s::wstring) S = L"!!!!"' % ns,
- "(const wchar_t *) mazeltov = 0x",
- 'L"מזל טוב"',
- '(%s::string) empty = ""' % ns,
- '(%s::string) q = "hello world"' % ns,
- '(%s::string) Q = "quite a long std::strin with lots of info inside it"'
- % ns,
- '(%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,
- '(%s::u32string) u32_empty = U""' % ns,
- "(%s::string *) null_str = nullptr" % ns,
- ],
- )
+ # Check 'S' pre-assignment.
+ self.expect("frame variable S", substrs=['(%s::wstring) S = L"!!!!"' % ns])
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)
@@ -108,31 +70,145 @@ def cleanup():
self.expect(
"frame variable",
substrs=[
+ '(%s::wstring) wempty = L""' % ns,
+ '(%s::wstring) s = L"hello world! מזל טוב!"' % ns,
'(%s::wstring) S = L"!!!!!"' % ns,
"(const wchar_t *) mazeltov = 0x",
'L"מזל טוב"',
+ '(%s::string) empty = ""' % ns,
'(%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,
+ ],
+ )
+
+ # Test references and pointers to std::string.
+ var_rq = frame.FindVariable("rq")
+ var_rQ = frame.FindVariable("rQ")
+ var_pq = frame.FindVariable("pq")
+ var_pQ = frame.FindVariable("pQ")
+
+ self.assertEqual(var_rq.GetSummary(), '"hello world"', "rq summary wrong")
+ self.assertEqual(
+ var_rQ.GetSummary(),
+ '"quite a long std::strin with lots of info inside it"',
+ "rQ summary wrong",
+ )
+ self.assertEqual(var_pq.GetSummary(), '"hello world"', "pq summary wrong")
+ self.assertEqual(
+ var_pQ.GetSummary(),
+ '"quite a long std::strin with lots of info inside it"',
+ "pQ summary wrong",
+ )
+
+ @expectedFailureAll(
+ bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android"
+ )
+ # Inline namespace is randomly ignored as Clang due to broken lookup inside
+ # the std namespace.
+ @expectedFailureAll(debug_info="gmodules")
+ @add_test_categories(["libc++"])
+ def test_libcxx(self):
+ self.build(dictionary={"USE_LIBCPP": 1})
+ self.do_test()
+
+ @expectedFailureAll(
+ bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android"
+ )
+ # Inline namespace is randomly ignored as Clang due to broken lookup inside
+ # the std namespace.
+ @expectedFailureAll(debug_info="gmodules")
+ @add_test_categories(["libstdcxx"])
+ def test_libstdcxx(self):
+ self.build(dictionary={"USE_LIBSTDCPP": 1})
+ self.do_test()
+
+ def do_test_multibyte(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,
'(%s::u16string) u16_string = u"ß水氶"' % ns,
+ '(%s::u16string) u16_empty = u""' % ns,
'(%s::u32string) u32_string = U"🍄🍅🍆🍌"' % ns,
'(%s::u32string) u32_empty = U""' % ns,
- "(%s::string *) null_str = nullptr" % ns,
],
)
- # 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", self.main_spec
+ @add_test_categories(["libc++"])
+ def test_multibyte_libcxx(self):
+ self.build(dictionary={"USE_LIBCPP": 1})
+ self.do_test_multibyte()
+
+ @expectedFailureAll(
+ bugnumber="libstdc++ formatters don't support UTF-16/UTF-32 strings yet."
+ )
+ @add_test_categories(["libstdcxx"])
+ def test_multibyte_libstdcxx(self):
+ self.build(dictionary={"USE_LIBSTDCPP": 1})
+ 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
+ )
+
+ TheVeryLongOne = thread.frames[0].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",
)
- 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")
+
+ @add_test_categories(["libc++"])
+ def test_uncapped_libcxx(self):
+ self.build(dictionary={"USE_LIBCPP": 1})
+ self.do_test_uncapped_summary()
+
+ @expectedFailureAll(
+ bugnumber="libstdc++ std::string summary provider doesn't obey summary options."
+ )
+ @add_test_categories(["libstdcxx"])
+ def test_uncapped_libstdcxx(self):
+ self.build(dictionary={"USE_LIBSTDCPP": 1})
+ self.do_test_uncapped_summary()
+
+ def do_test_summary_unavailable(self):
+ """
+ Make sure that if the string is not readable, we give an error.
+ """
+ (_, _, thread, _) = lldbutil.run_to_source_breakpoint(
+ self, "Break here to look at bad string", self.main_spec
+ )
+
+ var = thread.frames[0].FindVariable("in_str")
+ self.assertTrue(var.GetError().Success(), "Found variable")
summary = var.GetSummary()
self.assertEqual(summary, "Summary Unavailable", "No summary for bad value")
+
+ @add_test_categories(["libc++"])
+ def test_unavailable_summary_libcxx(self):
+ self.build(dictionary={"USE_LIBCPP": 1})
+ self.do_test_summary_unavailable()
+
+ @expectedFailureAll(
+ bugnumber="libstdc++ std::string summary provider doesn't output a user-friendly message for invalid strings."
+ )
+ @add_test_categories(["libstdcxx"])
+ def test_unavailable_summary_libstdcxx(self):
+ self.build(dictionary={"USE_LIBSTDCPP": 1})
+ 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
new file mode 100644
index 0000000000000..db695ed06f015
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp
@@ -0,0 +1,104 @@
+#include <stdint.h>
+#include <string>
+
+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 TheVeryLongOne(
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "9012345678901234567890123456789012345678901234567890someText123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890123456789012345678901234567890123456789012"
+ "345678901234567890123456789012345678901234567890123456789012345678901234"
+ "567890123456789012345678901234567890123456789012345678901234567890123456"
+ "789012345678901234567890123456789012345678901234567890123456789012345678"
+ "901234567890123456789012345678901234567890123456789012345678901234567890"
+ "1234567890123456789012345678901234567890");
+ 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;
+ auto &rq = q;
+ auto &rQ = Q;
+ std::string *pq = &q;
+ std::string *pQ = &Q;
+
+ 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/libcxx/string/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile
deleted file mode 100644
index c7c91da728d1e..0000000000000
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-CXX_SOURCES := main.cpp
-
-USE_LIBCPP := 1
-
-CXXFLAGS_EXTRAS := -std=c++11 -O0
-include Makefile.rules
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp
deleted file mode 100644
index 373f817a80f7d..0000000000000
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <string>
-#include <stdint.h>
-
-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 TheVeryLongOne("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890someText1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
- 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/libstdcpp/string/TestDataFormatterStdString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
deleted file mode 100644
index 0f66fe89e67b3..0000000000000
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# coding=utf8
-"""
-Test lldb data formatter subsystem.
-"""
-
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class StdStringDataFormatterTestCase(TestBase):
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number to break at.
- self.line = line_number("main.cpp", "// Set break point at this line.")
-
- @add_test_categories(["libstdcxx"])
- @expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
- def test_with_run_command(self):
- """Test that that file and class static variables display correctly."""
- self.build()
- self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line(
- self, "main.cpp", self.line, num_expected_locations=-1
- )
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # The stop reason of the thread should be breakpoint.
- self.expect(
- "thread list",
- STOPPED_DUE_TO_BREAKPOINT,
- substrs=["stopped", "stop reason = breakpoint"],
- )
-
- # 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)
-
- var_wempty = self.frame().FindVariable("wempty")
- var_s = self.frame().FindVariable("s")
- var_S = self.frame().FindVariable("S")
- var_mazeltov = self.frame().FindVariable("mazeltov")
- var_empty = self.frame().FindVariable("empty")
- var_q = self.frame().FindVariable("q")
- var_Q = self.frame().FindVariable("Q")
- var_rq = self.frame().FindVariable("rq")
- var_rQ = self.frame().FindVariable("rQ")
- var_pq = self.frame().FindVariable("pq")
- var_pQ = self.frame().FindVariable("pQ")
-
- self.assertEqual(var_wempty.GetSummary(), 'L""', "wempty summary wrong")
- self.assertEqual(
- var_s.GetSummary(), 'L"hello world! מזל טוב!"', "s summary wrong"
- )
- self.assertEqual(var_S.GetSummary(), 'L"!!!!"', "S summary wrong")
- self.assertEqual(
- var_mazeltov.GetSummary(), 'L"מזל טוב"', "mazeltov summary wrong"
- )
- self.assertEqual(var_empty.GetSummary(), '""', "empty summary wrong")
- self.assertEqual(var_q.GetSummary(), '"hello world"', "q summary wrong")
- self.assertEqual(
- var_Q.GetSummary(),
- '"quite a long std::strin with lots of info inside it"',
- "Q summary wrong",
- )
- self.assertEqual(var_rq.GetSummary(), '"hello world"', "rq summary wrong")
- self.assertEqual(
- var_rQ.GetSummary(),
- '"quite a long std::strin with lots of info inside it"',
- "rQ summary wrong",
- )
- self.assertEqual(var_pq.GetSummary(), '"hello world"', "pq summary wrong")
- self.assertEqual(
- var_pQ.GetSummary(),
- '"quite a long std::strin with lots of info inside it"',
- "pQ summary wrong",
- )
-
- self.runCmd("next")
-
- self.assertEqual(var_S.GetSummary(), 'L"!!!!!"', "new S summary wrong")
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp
deleted file mode 100644
index eefb96c4573e4..0000000000000
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <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");
- auto &rq = q, &rQ = Q;
- std::string *pq = &q, *pQ = &Q;
- S.assign(L"!!!!!"); // Set break point at this line.
- return 0;
-}
More information about the lldb-commits
mailing list