From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1234 invoked by alias); 22 Mar 2007 13:50:16 -0000 Received: (qmail 722 invoked by uid 22791); 22 Mar 2007 13:49:07 -0000 Received: from Unknown (HELO iceblock01.celunite.com) (66.220.2.179) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 22 Mar 2007 13:49:07 +0000 Received: from localhost (iceblock01.celunite.com [127.0.0.1]) by iceblock01.celunite.com (Postfix) with ESMTP id 69B3ABFC20E; Thu, 22 Mar 2007 06:48:52 -0700 (PDT) Received: from iceblock01.celunite.com ([127.0.0.1]) by localhost (iceblock01.celunite.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UMWOsEmFuzla; Thu, 22 Mar 2007 06:48:51 -0700 (PDT) Received: from [192.168.100.106] (unknown [220.225.33.101]) (Authenticated sender: ramana.radhakrishnan@celunite.com) by iceblock01.celunite.com (Postfix) with ESMTP id 7BE48BFC122; Thu, 22 Mar 2007 06:48:50 -0700 (PDT) Subject: Re: faster printing of QStrings From: Ramana Radhakrishnan Reply-To: ramana.radhakrishnan@celunite.com To: Markus.Grunwald@pruftechnik.com Cc: gdb@sourceware.org In-Reply-To: References: Content-Type: text/plain; charset=ISO-8859-1 Date: Thu, 22 Mar 2007 13:50:00 -0000 Message-Id: <1174571260.9097.6.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 8bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00272.txt.bz2 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)