kamm@ckamm-linux:~/dev/tmp/testapp$ gdb ./testapp GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /home/kamm/dev/tmp/testapp/testapp...done. (gdb) run Starting program: /home/kamm/dev/tmp/testapp/testapp [Thread debugging using libthread_db enabled] ASSERT: "i >= 0 && i < size()" in file ../../include/QtCore/../../../47/src/corelib/tools/qstring.h, line 701 Program received signal SIGABRT, Aborted. 0x00007ffff5b3aa75 in *__GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. in ../nptl/sysdeps/unix/sysv/linux/raise.c (gdb) bt #0 0x00007ffff5b3aa75 in *__GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x00007ffff5b3e5c0 in *__GI_abort () at abort.c:92 #2 0x00007ffff68eaa40 in qt_message_output (msgType=QtFatalMsg, buf=0x60a6b8 "ASSERT: \"i >= 0 && i < size()\" in file ../../include/QtCore/../../../47/src/corelib/tools/qstring.h, line 701") at /home/kamm/dev/qt/47/src/corelib/global/qglobal.cpp:2271 #3 0x00007ffff68eac42 in qt_message (msgType=QtFatalMsg, msg=0x7ffff6ab5cf8 "ASSERT: \"%s\" in file %s, line %d", ap=0x7fffffffdc40) at /home/kamm/dev/qt/47/src/corelib/global/qglobal.cpp:2317 #4 0x00007ffff68eb3f7 in qFatal (msg=0x7ffff6ab5cf8 "ASSERT: \"%s\" in file %s, line %d") at /home/kamm/dev/qt/47/src/corelib/global/qglobal.cpp:2500 #5 0x00007ffff68ea5a7 in qt_assert (assertion=0x7ffff6ab8575 "i >= 0 && i < size()", file=0x7ffff6ab8538 "../../include/QtCore/../../../47/src/corelib/tools/qstring.h", line=701) at /home/kamm/dev/qt/47/src/corelib/global/qglobal.cpp:2016 #6 0x00007ffff6916052 in QString::at (this=0x7fffffffdd90, i=0) at ../../include/QtCore/../../../47/src/corelib/tools/qstring.h:701 #7 0x00007ffff694c40e in QChar::fromAscii (c=-104 '\230') at /home/kamm/dev/qt/47/src/corelib/tools/qchar.cpp:1325 #8 0x00007ffff2f03c96 in QString::operator+= (this=0x7fffffffdf20, c=-104 '\230') at ../../../../include/QtCore/../../../47/src/corelib/tools/qstring.h:452 #9 0x00007ffff2f02020 in QGbkCodec::convertToUnicode (this=0x7304d0, chars=0x404e68 "鸿鹄安知燕雀之志", len=24, state=0x0) at /home/kamm/dev/qt/47/src/plugins/codecs/cn/qgb18030codec.cpp:359 #10 0x0000000000403796 in QTextCodec::toUnicode (this=0x7304d0, in=0x404e68 "鸿鹄安知燕雀之志", length=24, state=0x0) at ../../qt/47-build/include/QtCore/../../../47/src/corelib/codecs/qtextcodec.h:116 #11 0x0000000000403621 in main (argc=1, argv=0x7fffffffe038) at main.cpp:9 (gdb) frame 7 #7 0x00007ffff694c40e in QChar::fromAscii (c=-104 '\230') at /home/kamm/dev/qt/47/src/corelib/tools/qchar.cpp:1325 1325 return QTextCodec::codecForCStrings()->toUnicode(&c, 1).at(0).unicode(); (gdb) frame 10 #10 0x0000000000403796 in QTextCodec::toUnicode (this=0x7304d0, in=0x404e68 "鸿鹄安知燕雀之志", length=24, state=0x0) at ../../qt/47-build/include/QtCore/../../../47/src/corelib/codecs/qtextcodec.h:116 116 { return convertToUnicode(in, length, state); } (gdb) frame 9 #9 0x00007ffff2f02020 in QGbkCodec::convertToUnicode (this=0x7304d0, chars=0x404e68 "鸿鹄安知燕雀之志", len=24, state=0x0) at /home/kamm/dev/qt/47/src/plugins/codecs/cn/qgb18030codec.cpp:359 359 result += qValidChar(u); (gdb) l 354 if (Is2ndByteIn2Bytes(ch)) { 355 buf[1] = ch; 356 int clen = 2; 357 uint u = qt_Gb18030ToUnicode(buf, clen); 358 if (clen == 2) { 359 result += qValidChar(u); 360 } else { 361 result += replacement; 362 ++invalid; 363 } (gdb) frame 7 #7 0x00007ffff694c40e in QChar::fromAscii (c=-104 '\230') at /home/kamm/dev/qt/47/src/corelib/tools/qchar.cpp:1325 1325 return QTextCodec::codecForCStrings()->toUnicode(&c, 1).at(0).unicode(); (gdb) p QTextCodec::codecFor codecForCStrings() codecForName(QByteArray const&) codecForHtml(QByteArray const&) codecForName(QByteArray const&)::cache codecForHtml(QByteArray const&, QTextCodec*) codecForName(char const*) codecForLocale() codecForTr() codecForMib(int) codecForUtfText(QByteArray const&) codecForMib(int)::cache codecForUtfText(QByteArray const&, QTextCodec*) (gdb) p QTextCodec::codecForCStrings() $1 = (QTextCodec *) 0x7304d0 (gdb) frame 11 #11 0x0000000000403621 in main (argc=1, argv=0x7fffffffe038) at main.cpp:9 9 tc->toUnicode(str, qstrlen(str)); (gdb) p tc $2 = (struct QTextCodec *) 0x7304d0 (gdb) p c $3 = {i = {0, 1072693248}, d = 1} (gdb) f #11 0x0000000000403621 in main (argc=1, argv=0x7fffffffe038) at main.cpp:9 9 tc->toUnicode(str, qstrlen(str)); (gdb) frame 7 #7 0x00007ffff694c40e in QChar::fromAscii (c=-104 '\230') at /home/kamm/dev/qt/47/src/corelib/tools/qchar.cpp:1325 1325 return QTextCodec::codecForCStrings()->toUnicode(&c, 1).at(0).unicode(); (gdb) p c $4 = -104 '\230' (gdb) p *(&c+1) $5 = 127 '\177' (gdb) frame 6 #6 0x00007ffff6916052 in QString::at (this=0x7fffffffdd90, i=0) at ../../include/QtCore/../../../47/src/corelib/tools/qstring.h:701 701 { Q_ASSERT(i >= 0 && i < size()); return d->data[i]; } (gdb) p size() $6 = 0 (gdb) frame 11 #11 0x0000000000403621 in main (argc=1, argv=0x7fffffffe038) at main.cpp:9 9 tc->toUnicode(str, qstrlen(str)); (gdb) p str $7 = 0x404e68 "鸿鹄安知燕雀之志" (gdb) p *str $8 = -23 '\351' (gdb) p *(str+1) $9 = -72 '\270' (gdb) p *(str+2) $10 = -65 '\277' (gdb) p *(str+3) $11 = -23 '\351' (gdb) p *(str+4) $12 = -71 '\271' (gdb) p *(str+5) $13 = -124 '\204' (gdb) p *(str+6) $14 = -27 '\345' (gdb) p *(str+7) $15 = -82 '\256' (gdb) p *(str+8) $16 = -119 '\211' (gdb) p *(str+9) $17 = -25 '\347' (gdb) p *(str+10) $18 = -97 '\237' (gdb) p *(str+11) $19 = -91 '\245' (gdb) p *(str+12) $20 = -25 '\347' (gdb) p *(str+13) $21 = -121 '\207' (gdb) p *(str+14) $22 = -107 '\225' (gdb) p *(str+15) $23 = -23 '\351' (gdb) p *(str+16) $24 = -101 '\233' (gdb) p *(str+17) $25 = -128 '\200' (gdb) p *(str+18) $26 = -28 '\344' (gdb) p *(str+19) $27 = -71 '\271' (gdb) p *(str+20) $28 = -117 '\213' (gdb) p *(str+21) $29 = -27 '\345' (gdb) p *(str+22) $30 = -65 '\277' (gdb) p *(str+23) $31 = -105 '\227' (gdb) p *(str+24) $32 = 0 '\000' (gdb) frame 9 #9 0x00007ffff2f02020 in QGbkCodec::convertToUnicode (this=0x7304d0, chars=0x404e68 "鸿鹄安知燕雀之志", len=24, state=0x0) at /home/kamm/dev/qt/47/src/plugins/codecs/cn/qgb18030codec.cpp:359 359 result += qValidChar(u); (gdb) l 354 if (Is2ndByteIn2Bytes(ch)) { 355 buf[1] = ch; 356 int clen = 2; 357 uint u = qt_Gb18030ToUnicode(buf, clen); 358 if (clen == 2) { 359 result += qValidChar(u); 360 } else { 361 result += replacement; 362 ++invalid; 363 } (gdb) l - 344 buf[0] = ch; 345 nbuf = 1; 346 } else { 347 // Invalid 348 result += replacement; 349 ++invalid; 350 } 351 break; 352 case 1: 353 // GBK 2nd byte (gdb) 334 //qDebug("QGbkDecoder::toUnicode(const char* chars = \"%s\", int len = %d)", chars, len); 335 for (int i=0; i}, static shared_null = {ref = {_q_value = 25}, alloc = 0, size = 0, data = 0x60637a, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = { 0}}, static shared_empty = {ref = {_q_value = 1}, alloc = 0, size = 0, data = 0x7ffff6dc539a, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x0, static codecForCStrings = 0x7304d0} (gdb) n 337 switch (nbuf) { (gdb) 354 if (Is2ndByteIn2Bytes(ch)) { (gdb) 355 buf[1] = ch; (gdb) 356 int clen = 2; (gdb) 357 uint u = qt_Gb18030ToUnicode(buf, clen); (gdb) 358 if (clen == 2) { (gdb) 359 result += qValidChar(u); (gdb) p u $37 = 31640 (gdb) p buf $38 = "\271\204" (gdb) s QString::operator+= (this=0x7fffffffdf20, c=-104 '\230') at ../../../../include/QtCore/../../../47/src/corelib/tools/qstring.h:452 452 { return append(QChar::fromAscii(c)); } (gdb) s QChar::fromAscii (c=-104 '\230') at /home/kamm/dev/qt/47/src/corelib/tools/qchar.cpp:1323 1323 if (QTextCodec::codecForCStrings()) (gdb) n 1325 return QTextCodec::codecForCStrings()->toUnicode(&c, 1).at(0).unicode(); (gdb) s QTextCodec::codecForCStrings () at ../../include/QtCore/../../../47/src/corelib/codecs/qtextcodec.h:157 157 inline QTextCodec* QTextCodec::codecForCStrings() { return validCodecs() ? QString::codecForCStrings : 0; } (gdb) fin Run till exit from #0 QTextCodec::codecForCStrings () at ../../include/QtCore/../../../47/src/corelib/codecs/qtextcodec.h:157 0x00007ffff694c3dc in QChar::fromAscii (c=-104 '\230') at /home/kamm/dev/qt/47/src/corelib/tools/qchar.cpp:1325 1325 return QTextCodec::codecForCStrings()->toUnicode(&c, 1).at(0).unicode(); Value returned is $39 = (struct QTextCodec *) 0x7304d0 (gdb) s QTextCodec::toUnicode (this=0x7304d0, in=0x7fffffffdd8c "\230\177", length=1, state=0x0) at ../../include/QtCore/../../../47/src/corelib/codecs/qtextcodec.h:116 116 { return convertToUnicode(in, length, state); } (gdb) p in $40 = 0x7fffffffdd8c "\230\177" (gdb) p length $41 = 1 (gdb) p state $42 = (QTextCodec::ConverterState *) 0x0 (gdb) s QGbkCodec::convertToUnicode (this=0x7304d0, chars=0x7fffffffdd8c "\230\177", len=1, state=0x0) at /home/kamm/dev/qt/47/src/plugins/codecs/cn/qgb18030codec.cpp:321 321 int nbuf = 0; (gdb) n 322 QChar replacement = QChar::ReplacementCharacter; (gdb) l 317 318 QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *state) const 319 { 320 uchar buf[2]; 321 int nbuf = 0; 322 QChar replacement = QChar::ReplacementCharacter; 323 if (state) { 324 if (state->flags & ConvertInvalidToNull) 325 replacement = QChar::Null; 326 nbuf = state->remainingChars; (gdb) l 327 buf[0] = state->state_data[0]; 328 buf[1] = state->state_data[1]; 329 } 330 int invalid = 0; 331 332 QString result; 333 334 //qDebug("QGbkDecoder::toUnicode(const char* chars = \"%s\", int len = %d)", chars, len); 335 for (int i=0; iinvalidChars += invalid; (gdb) 382 } (gdb) l 377 state->state_data[0] = buf[0]; 378 state->state_data[1] = buf[1]; 379 state->invalidChars += invalid; 380 } 381 return result; 382 } 383 384 QByteArray QGbkCodec::convertFromUnicode(const QChar *uc, int len, ConverterState *state) const 385 { 386 char replacement = '?'; (gdb) p state $44 = (QTextCodec::ConverterState *) 0x0 (gdb) p result DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece. (gdb) fin Run till exit from #0 QGbkCodec::convertToUnicode (this=0x7304d0, chars=0x7fffffffdd8c "\230\177", len=1, state=0x0) at /home/kamm/dev/qt/47/src/plugins/codecs/cn/qgb18030codec.cpp:382 0x00007ffff695d564 in QTextCodec::toUnicode (this=0x7304d0, in=0x7fffffffdd8c "\230\177", length=1, state=0x0) at ../../include/QtCore/../../../47/src/corelib/codecs/qtextcodec.h:116 116 { return convertToUnicode(in, length, state); } Value returned is $45 = {static null = {}, static shared_null = {ref = {_q_value = 26}, alloc = 0, size = 0, data = 0x60637a, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 1}, alloc = 0, size = 0, data = 0x7ffff6dc539a, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x7fffffffdd90, static codecForCStrings = 0x7304d0} (gdb) fin Run till exit from #0 0x00007ffff695d564 in QTextCodec::toUnicode (this=0x7304d0, in=0x7fffffffdd8c "\230\177", length=1, state=0x0) at ../../include/QtCore/../../../47/src/corelib/codecs/qtextcodec.h:116 0x00007ffff694c3fd in QChar::fromAscii (c=-104 '\230') at /home/kamm/dev/qt/47/src/corelib/tools/qchar.cpp:1325 1325 return QTextCodec::codecForCStrings()->toUnicode(&c, 1).at(0).unicode(); Value returned is $46 = {static null = {}, static shared_null = {ref = {_q_value = 26}, alloc = 0, size = 0, data = 0x60637a, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 1}, alloc = 0, size = 0, data = 0x7ffff6dc539a, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x7fffffffdd90, static codecForCStrings = 0x7304d0} (gdb) s QString::at (this=0x7fffffffdd90, i=0) at ../../include/QtCore/../../../47/src/corelib/tools/qstring.h:701 701 { Q_ASSERT(i >= 0 && i < size()); return d->data[i]; } (gdb) p size() warning: can't find linker symbol for virtual table for `QString' value warning: found `typeinfo for QMainWindow' instead $47 = 0 (gdb) quit