aprantl created this revision.
aprantl added reviewers: ldionne, shafik, jingham.
aprantl added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
aprantl requested review of this revision.
https://reviews.llvm.org/D125496 changed the layout of std::string without
updating the LLDB dataformatter. This patch adds code to recognize the now
format.
How do we usually add tests for STL data structures?
https://reviews.llvm.org/D126080
Files:
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
Index: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -546,7 +546,7 @@
nullptr, nullptr, &valobj, false,
false);
}
-// the field layout in a libc++ string (cap, side, data or data, size, cap)
+/// The field layout in a libc++ string (cap, side, data or data, size, cap).
enum LibcxxStringLayoutMode {
eLibcxxStringLayoutModeCSD = 0,
eLibcxxStringLayoutModeDSC = 1,
@@ -626,6 +626,9 @@
return {};
ValueObjectSP location_sp = short_sp->GetChildAtIndex(
(layout == eLibcxxStringLayoutModeDSC) ? 0 : 1, true);
+ // After D125496, there is a flat layout.
+ if (location_sp->GetName() == g_size_name)
+ location_sp = short_sp->GetChildAtIndex(3, true);
if (using_bitmasks)
size = (layout == eLibcxxStringLayoutModeDSC)
? size_mode_value
Index: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -546,7 +546,7 @@
nullptr, nullptr, &valobj, false, false);
}
-// the field layout in a libc++ string (cap, side, data or data, size, cap)
+/// The field layout in a libc++ string (cap, side, data or data, size, cap).
enum LibcxxStringLayoutMode {
eLibcxxStringLayoutModeCSD = 0,
eLibcxxStringLayoutModeDSC = 1,
@@ -626,6 +626,9 @@
return {};
ValueObjectSP location_sp = short_sp->GetChildAtIndex(
(layout == eLibcxxStringLayoutModeDSC) ? 0 : 1, true);
+ // After D125496, there is a flat layout.
+ if (location_sp->GetName() == g_size_name)
+ location_sp = short_sp->GetChildAtIndex(3, true);
if (using_bitmasks)
size = (layout == eLibcxxStringLayoutModeDSC)
? size_mode_value
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits