Code::Blocks

User forums => Using Code::Blocks => Topic started by: C.H. on September 23, 2005, 01:51:59 pm

Title: qt 4.0.1 & debug
Post by: C.H. on September 23, 2005, 01:51:59 pm
Hi!
How can I see in Watch window QString object?


[attachment deleted by admin]
Title: Re: qt 4.0.1 & debug
Post by: Urxae on September 23, 2005, 02:21:20 pm
It looks like only static members are optimized out in this case, so technically you are already seeing all of the actual QString object ;), namely what seems to be the single member d, a pointer to an instance of QString::Data which presumably holds the actual string data.
[If you want to see all the stuff that's <optimized out>, turn off all optimizations and recompile. Normally, you don't want to debug with optimizations turned on anyway unless you have to.]

If on the other hand you want to see the string data presumably contained in fn.d, I'm not sure (I haven't really used the debugging functionality of C::B all that much), but I'd try adding a 'manual' watch on *fn.d and see what that gets you.
Title: Re: qt 4.0.1 & debug
Post by: mandrav on September 23, 2005, 02:31:08 pm
That's right. If you want to see the contents of a pointer, add a watch as '*pointer', where 'pointer' is the pointer's name.
And, please, disable optimizations when debugging. It will make your life so much simpler ;)
Title: Re: qt 4.0.1 & debug
Post by: C.H. on September 23, 2005, 02:40:33 pm
That's right. If you want to see the contents of a pointer, add a watch as '*pointer', where 'pointer' is the pointer's name.
And, please, disable optimizations when debugging. It will make your life so much simpler ;)

I didn't turn on any optimize porperties!
I add *fn.d but still can't see text :-(

[attachment deleted by admin]
Title: Re: qt 4.0.1 & debug
Post by: Urxae on September 23, 2005, 04:36:02 pm
I didn't turn on any optimize porperties!
Did you check the target options (click on "default" at the left of that dialog) and global options (Settings --> Compiler in the main window)? If it's enabled in any of those places it'll be enabled when compiling. And don't forget to rebuild your project (or at least the target you're debugging) after making sure all of them are disabled.

Quote
I add *fn.d but still can't see text :-(
What can you see? Most people probably can't tell you much about the internals of QString...
Can you see what members *fn.d has? What are their types? If any are pointers (especially char*s), try adding a watch for *fn.d->MEMBER_NAME.
Title: Re: qt 4.0.1 & debug
Post by: zieQ on September 23, 2005, 06:10:18 pm
I didn't turn on any optimize porperties!

Yes but did you compile and link the wxWidgets *debug* version?