labath wrote:

> Another aside: Does anyone know why the [libstdc++ `std::__cxx11::string` 
> summaries](https://github.com/llvm/llvm-project/blob/802fa92aee3565768887615108aa3e924d4e0fc7/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp#L240-L358)
>  weren't using the string summary? They were initially added in 
> [D13964](https://reviews.llvm.org/D13964), but it doesn't provide a reason to 
> do so. Note that the summary for a `std::string v = "foo"` was the format 
> string one (`${var._M_dataplus._M_p}`). Only when printing a reference or 
> pointer to a string, `LibStdcppStringSummaryProvider` was called. I tried to 
> use this function for all libstdc++ strings, but this broke when using 
> `-D_GLIBCXX_USE_CXX11_ABI=0` (on MinGW). On the other hand, 
> `${var._M_dataplus._M_p}` works with both ABIs.

Well, the commit says (I haven't verified this) that the std::string formatter 
at the time was written in python, so this could have been a way to avoid the 
python dependency. As for the implementation, a possible reason (again, I don't 
know if that's the case) could be to make the formatter work in the case where 
you don't have debug info for std::string -- it looks like it avoids looking at 
any type information, which means it could work even with a forward declaration 
-- but that it would break when the ABI changes, as you've noticed.

I don't think we need to concern ourselves with that though. Your new 
implementation is fine.

https://github.com/llvm/llvm-project/pull/143177
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to