[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: HOWTO: print a QString in gdb
From: David Faure <david () mandrakesoft ! com>
Date: 2001-01-14 1:34:58
[Download RAW message or body]
Since Dirk made me look into it (in spite of himself :), here's how to print
the contents of a QString in gdb. Very easy, in fact.
Put this in your ~/.gdbinit :
define printqstring
set $i=0
while $i < $arg0.d->len
p $arg0.d->unicode[$i++].cl
end
end
Then in gdb you can do
printqstring myqstring
to see its contents.
For instance,
QString myqstring = QString::fromLatin1("contents");
can be examined using
(gdb) printqstring myqstring
$1 = 99 'c'
$2 = 111 'o'
$3 = 110 'n'
$4 = 116 't'
$5 = 101 'e'
$6 = 110 'n'
$7 = 116 't'
$8 = 115 's'
Quite handy :)
BTW: gdb 4.1x sucks, gdb 5.x rocks. You know which one you want to use :)
--
David FAURE, david@mandrakesoft.com, faure@kde.org
http://www.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic