Author Topic: Debugging QString  (Read 33230 times)

Offline LordCB

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Debugging QString
« Reply #30 on: September 17, 2009, 05:17:35 pm »
One more question.

When I type a command during debugging it seems CB stores the entered command somwhere.
Does aanybody knows in which file those commands are stored??

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: Debugging QString
« Reply #31 on: September 17, 2009, 07:03:07 pm »
I did not follow the entire discussion on this thread, but I assume that you are using the script I provided you with, and with it you should be able to view much short output..

for example, for this code:
Code
	QString str;
str = "hello world";

You should have get this output from gdb (using gdb 6.8 here), after typing 'printqstring str':

Code
(QString)0x22ff50 (length=11): "hello world"


Is this still the case?

Eran

Offline LordCB

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Debugging QString
« Reply #32 on: September 17, 2009, 11:36:25 pm »
Yes I use your script you provided before.

But under gdb6.8 it doesnt work with gdb 6.3 it works.

I always search the gdb command to output the name of the variable. Perhaps like this:
Code
	QString str;
str = "hello world";

(str)->(QString)0x22ff50 (length=11): "hello world"

Is there a method for example $arg0.d->name or which methods are available in the script you provide.

I took the gdb reference but donĀ“t find any command that gives me the name of the variable.

I try to add a third variable like this

Code
 printf "(%c)->(QString)0x%x (length=%i): \"",$arg0,&$arg0,$arg0.d->size
« Last Edit: September 17, 2009, 11:38:05 pm by LordCB »

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: Debugging QString
« Reply #33 on: September 18, 2009, 07:09:58 am »
$arg0 IS a QString
$arg0.d-> is part of the QString implementation and not related to gdb
using this:
printf "%c", $arg0 is equal to this:
printf ("%c", str) -> but as you can see, str is of type QString so it wont work...

You can not get the name of the argument, the same way you cant do it in C++/C

Eran

Offline LordCB

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Debugging QString
« Reply #34 on: September 18, 2009, 01:58:33 pm »
Hmmm.. Ok ?!?!?!

Thanx a lot I learn alot in this post thanx to all