mib created this revision. mib added reviewers: aprantl, JDevlieghere. mib added a project: LLDB. Herald added a project: All. mib requested review of this revision. Herald added a subscriber: lldb-commits.
This patch changes the C++ `std::string` dataformatter to reflect internal layout changes following D128285 <https://reviews.llvm.org/D128285>. Now, on short strings, in order to access the `__size` attributes, we need to access a packed anonymous struct, which introduces another indirection. This should fix the various test failures that are happening on GreenDragon: https://green.lab.llvm.org/green/job/lldb-cmake/44918/ rdar://96010248 Signed-off-by: Med Ismail Bennani <medismail.benn...@gmail.com> Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D128694 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 @@ -624,11 +624,17 @@ ValueObjectSP short_sp(dataval_sp->GetChildAtIndex(1, true)); if (!short_sp) return {}; - ValueObjectSP location_sp = short_sp->GetChildAtIndex( + + // After D128285, we need to access the size from a packed anonymous struct + ValueObjectSP packed_fields_sp = short_sp->GetChildAtIndex(0, true); + if (!packed_fields_sp) + return {}; + + ValueObjectSP location_sp = packed_fields_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); + location_sp = short_sp->GetChildAtIndex(2, 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 @@ -624,11 +624,17 @@ ValueObjectSP short_sp(dataval_sp->GetChildAtIndex(1, true)); if (!short_sp) return {}; - ValueObjectSP location_sp = short_sp->GetChildAtIndex( + + // After D128285, we need to access the size from a packed anonymous struct + ValueObjectSP packed_fields_sp = short_sp->GetChildAtIndex(0, true); + if (!packed_fields_sp) + return {}; + + ValueObjectSP location_sp = packed_fields_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); + location_sp = short_sp->GetChildAtIndex(2, true); if (using_bitmasks) size = (layout == eLibcxxStringLayoutModeDSC) ? size_mode_value
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits