You can try to fix "/usr/share/qtcreator/debugger/stdtypes.py". Since they use the "assumption of hard code regarding member position", it seems that this does not work everywhere. In my case - Linux x64, gcc 9.1, it works exactly as you described: the line is not available
So find the function def qdumpHelper_std__string(d, value, charType, format):
And change (size, alloc, refcount) = d.split("ppp", data - 3 * d.ptrSize()) to (size, alloc, refcount) = d.split("ppp", value.address() + d.ptrSize())
Also comment on d.check(0 <= size and size <= alloc and alloc <= 100*1000*1000) or change it to something like
if size > 1000: size = 1000
On my system, std :: string has the following structure
pointer 8 byte size 8 byte union 16 byte
And this union field can change its value depending on the size of the string. Therefore, we need to comment on this size < alloc check. value.address() is the address of the string object, so value.address() + d.ptrSize() will indicate the size, and value.address() + 2 * d.ptrSize() indicate this union, which from time to time contain the value of alloc size .
Just look at the declaration of the std::string class to get the structure on your system. And after the fix: the debugger view is fixed
Both work - when the "system GDB beautiful printers" are checked and cleaned