This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: faster printing of QStrings
- From: Ramana Radhakrishnan <ramana dot radhakrishnan at celunite dot com>
- To: Markus dot Grunwald at pruftechnik dot com
- Cc: gdb at sourceware dot org
- Date: Thu, 22 Mar 2007 19:17:40 +0530
- Subject: Re: faster printing of QStrings
- References: <OFF8FB08FC.7E6D07C5-ONC12572A6.004381A6-C12572A6.00448247@pruftechnik.com>
- Reply-to: ramana dot radhakrishnan at celunite dot com
On Thu, 2007-03-22 at 13:28 +0100, Markus.Grunwald@pruftechnik.com
wrote:
> Hello,
>
> 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
>
> (gdb) pqs oszPrinterLine
> Getting QString...
> kopierer akzeptiert Anfragen seit Mo 19 Feb 2007 13:27:28 CET
>
> Works fine - except that it takes ages (25s) ! Kdevelop displays the
> QStrings in an instant. Now I wonder if there is a faster way of getting
> this information in gdb - and maybe even to "display oszPrinterLine" which
> makes sense only if printing is fast... ?
Might it go a bit faster if you used a convenience variable for len
too :) ?
set $len = $arg0.d->len
while $i < $len
Getting the actual length is loop invariant. I am no expert in the gdb
scripting areas ...
cheers
Ramana
>
> Mit freundlichen Grü�en
>
> Markus Grunwald
> Softwareentwicklung
>
> PRÃ?FTECHNIK Condition Monitoring GmbH
> Oskar-Messter-StraÃ?e 19-21
> 85737 Ismaning
> www.pruftechnik.com
> Tel: +49 (0)89 99616177
> Fax: +49 (0)89 99616200
>
> PRÃ?FTECHNIK Condition Monitoring GmbH
> Sitz Ismaning / HRB 145655 München
> Geschäftsführer: Johann Lösl, Roland Schühle
>
> Ein Unternehmen der PRÃ?FTECHNIK-Gruppe
--
cheers
Ramana
Ramana Radhakrishnan
IDE & Tools Group
Celunite Inc (www.celunite.com)