This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: faster printing of QStrings


> From: Markus.Grunwald@pruftechnik.com
> Date: Thu, 22 Mar 2007 13:28:18 +0100
> 
> we are developing Qt applications. kdevelops debugger offers a watch where 
> it can display QStrings. I am more the commandline user and have found a 
> nice function that prints QStrings with gdb:
> 
> define pqs
>     set $i=0
>     set $unicode=$arg0.d->unicode
> 
>     printf "Getting QString...\n"
>     while $i < $arg0.d->len
>         set $c=$unicode[$i++].ucs
>         if $c < 32 
>           printf "\\0%o", $c
>         else
>           if $c <= 127
>             printf "%c", $c
>           else 
>             printf "\\0%o", $c
>           end 
>         end
>     end
>     echo \n
> end

Thanks for posting this, but it only prints the ASCII characters, the
rest is displayed as octal escapes.  Wouldn't it be better to send
UTF-8 encoding to the terminal?  Then the non-ASCII characters will
also be displayed in a human-readable form.

> Works fine - except that it takes ages (25s) !

For Qstring's of what length?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]