[Lldb-commits] [PATCH] D126080: Adapt C++ std::string dataformatter for D125496
Adrian Prantl via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri May 20 11:22:36 PDT 2022
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126080.431012.patch
Type: text/x-patch
Size: 1025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220520/6c6d5d71/attachment.bin>
More information about the lldb-commits
mailing list