labath 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. It would be an interesting experiment to see what happens when you take a corrupted string like this and try to e.g. `<<` it to a stream. My guess is it would print "abc". (of course, that's undefined, so there's no guarantee all STLs will behave the same way) 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 it will not print anything that comes after a (perfectly legal) internal nul character. I have no idea why this happens for libc++. 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>` ?) https://github.com/llvm/llvm-project/pull/147525 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits