解决ubuntu中Qt无法打汉字和调试时String类型显示问题
第一步:在Qt的安装目录下找到:/Qt5.9.0/Tools/QtCreator/share/qtcreator/debugger
第二步:打开 stdtypes.py 文件
第三步:找到【def qdumpHelper_std__string(d, value, charType, format):】
将 【(size, alloc, refcount) = d.split("ppp", data - 3 * d.ptrSize())】替换成
【(size, alloc, refcount) = d.split("ppp", value.address() + d.ptrSize())】
将【d.check(0 <= size and size <= alloc and alloc <= 100*1000*1000)】替换成
【
if size > 4002:
size = 4002
】
替换后应该如下:
def qdumpHelper_std__string(d, value, charType, format):
if d.isQnxTarget():
qdumpHelper__std__string__QNX(d, value, charType, format)
return
if d.isMsvcTarget():
qdumpHelper__std__string__MSVC(d, value, charType, format)
return
data = value.extractPointer()
# We can't lookup the std::string::_Rep type without crashing LLDB,
# so hard-code assumption on member position
# struct { size_type _M_length, size_type _M_capacity, int _M_refcount; }
(size, alloc, refcount) = d.split("ppp", value.address() + d.ptrSize())
refcount = refcount & 0xffffffff
d.check(refcount >= -1) # Can be -1 according to docs.
if size > 4002:
size = 4002
d.putCharArrayHelper(data, size, charType, format)
第四步:重启:reboot系统
参考链接:https://blog.csdn.net/qq_40140083/article/details/109804123 参考链接