Qt-interest Archive, June 2007
gdb macros and QString and QStringData
Message 1 in thread
Those macros are very handy, I found a version of them on the kde subversion
repo.
I was wondering, I have very little experience writing Gdb macros, is there
any documentation out there that explains how to write them? I'd like to
write another macro one that lets me SET the value of a QString from inside
gdb.
For example, in this function:
>
> define printqstringdata
> set $i=0
> set $d = (QStringData *)$arg0
> while $i < $d->len
> printf "%c", (char)($d->unicode[$i++].ucs & 0xff)
> end
> printf "\n"
> end
If arg0 is a QString, why are we typecasting it down to a *pointer* to
QStringData? This is an internal class with little docs. No sourcecode in
the src tree. I only found it in a qt3headers.resource file.
Is it a special class that you can convert a QString to for such situations?
Message 2 in thread
You can ignore my previous message. After some fiddling around, I got a GDB
macro that lets me
*set* the value of a Q4 string.
define setq4string
set $len = strlen($arg1) + 1
call $arg0.resize($len)
set $d = $arg0.d
set $value = $arg1
set $i = 0
while $i < $len
set $d->data[$i] = (char) ($value[$i] & 0xff)
set $i++
end
set $d->data[$i] = 0
end
Perhaps someone should add this to the kde-devel-gdb macro collection?
On 6/5/07, Alan Ezust <alan.ezust@xxxxxxxxx> wrote:
>
> Those macros are very handy, I found a version of them on the kde
> subversion repo.
>
> I was wondering, I have very little experience writing Gdb macros, is
> there any documentation out there that explains how to write them? I'd like
> to write another macro one that lets me SET the value of a QString from
> inside gdb.
>
>
>
>
>
>
>