Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
ed4278ab
Commit
ed4278ab
authored
Mar 05, 2010
by
hjk
Browse files
debugger: fix new wstring dumper encoding
parent
72ecc8a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
share/qtcreator/gdbmacros/gdbmacros.py
View file @
ed4278ab
...
...
@@ -1829,20 +1829,41 @@ def qdump__std__string(d, item):
check
(
rep
[
'_M_refcount'
]
>=
0
)
check
(
0
<=
size
and
size
<=
alloc
and
alloc
<=
100
*
1000
*
1000
)
d
.
unputField
(
"type"
)
p
=
gdb
.
Value
(
data
.
cast
(
charType
.
pointer
()))
s
=
""
if
str
(
charType
)
==
"char"
:
d
.
putType
(
"std::string"
)
elif
str
(
charType
)
==
"wchar_t"
:
d
.
putType
(
"std::string"
)
d
.
putType
(
"std::
w
string"
)
else
:
d
.
putType
(
baseType
)
p
=
gdb
.
Value
(
data
.
cast
(
charType
.
pointer
()))
s
=
""
format
=
"%%0%dx"
%
(
2
*
charType
.
sizeof
)
n
=
qmin
(
size
,
1000
)
for
i
in
xrange
(
size
):
s
+=
format
%
int
(
p
.
dereference
())
p
+=
1
d
.
putValue
(
s
,
6
)
if
charType
.
sizeof
==
1
:
format
=
"%02x"
for
i
in
xrange
(
size
):
s
+=
format
%
int
(
p
.
dereference
())
p
+=
1
d
.
putValue
(
s
,
6
)
d
.
putNumChild
(
0
)
elif
charType
.
sizeof
==
2
:
format
=
"%02x%02x"
for
i
in
xrange
(
size
):
val
=
int
(
p
.
dereference
())
s
+=
format
%
(
val
%
256
,
val
/
256
)
p
+=
1
d
.
putValue
(
s
,
7
)
else
:
# FIXME: This is not always a proper solution.
format
=
"%02x%02x%02x%02x"
for
i
in
xrange
(
size
):
val
=
int
(
p
.
dereference
())
hi
=
val
/
65536
lo
=
val
%
65536
s
+=
format
%
(
lo
%
256
,
lo
/
256
,
hi
%
256
,
hi
/
256
)
p
+=
1
d
.
putValue
(
s
,
8
)
d
.
putNumChild
(
0
)
...
...
src/plugins/debugger/watchutils.cpp
View file @
ed4278ab
...
...
@@ -646,13 +646,20 @@ QString decodeData(const QByteArray &ba, int encoding)
//qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n";
return
doubleQuote
+
QString
::
fromLatin1
(
decodedBa
)
+
doubleQuote
;
}
case
7
:
{
// %04x encoded 16 bit data
case
7
:
{
// %04x encoded 16 bit data
, Little Endian
const
QChar
doubleQuote
(
QLatin1Char
(
'"'
));
const
QByteArray
decodedBa
=
QByteArray
::
fromHex
(
ba
);
//qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n";
return
doubleQuote
+
QString
::
fromUtf16
(
reinterpret_cast
<
const
ushort
*>
(
decodedBa
.
data
()),
decodedBa
.
size
()
/
2
)
+
doubleQuote
;
}
case
8
:
{
// %08x encoded 32 bit data, Little Endian
const
QChar
doubleQuote
(
QLatin1Char
(
'"'
));
const
QByteArray
decodedBa
=
QByteArray
::
fromHex
(
ba
);
//qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n";
return
doubleQuote
+
QString
::
fromUcs4
(
reinterpret_cast
<
const
uint
*>
(
decodedBa
.
data
()),
decodedBa
.
size
()
/
4
)
+
doubleQuote
;
}
}
qDebug
()
<<
"ENCODING ERROR: "
<<
encoding
;
return
QCoreApplication
::
translate
(
"Debugger"
,
"<Encoding error>"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment