[Lldb-commits] [lldb] [lldb][test] Merge MSVC STL std::(u8)string tests into generic directory (PR #147525)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 9 04:07:10 PDT 2025


Michael137 wrote:

> > But libc++ and libstdc++ print it as "abcd" (which seems like the more correct thing to do?)
> 
> I'm not so sure about that. std::string has a separate length field and it can contain embedded nul characters, so I can at least understand the idea of trusting the length field more than we trust the terminator.

Yea that's a fair point. Trusting the size makes sense given the embedded null case
 
> For libstdc++, I guess this happens because we have the simple summary `${var._M_ptr}` (or whatever), but I think this actually shows that this summary is wrong, as it will not print anything that comes after a (perfectly legal) internal nul character

Yea in fact we have XFAILed tests for those

> Given that the terminator is a part of the std::string contract, I can also imagine the formatter flagging this specially in some way (`"abc" <unterminated>` ?)

That would be neat!


https://github.com/llvm/llvm-project/pull/147525


More information about the lldb-commits mailing list