Author Topic: qt 4.0.1 & debug  (Read 4103 times)

Offline C.H.

  • Single posting newcomer
  • *
  • Posts: 6
qt 4.0.1 & debug
« on: September 23, 2005, 01:51:59 pm »
Hi!
How can I see in Watch window QString object?


[attachment deleted by admin]
« Last Edit: September 23, 2005, 01:53:34 pm by C.H. »

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: qt 4.0.1 & debug
« Reply #1 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.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: qt 4.0.1 & debug
« Reply #2 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 ;)
Be patient!
This bug will be fixed soon...

Offline C.H.

  • Single posting newcomer
  • *
  • Posts: 6
Re: qt 4.0.1 & debug
« Reply #3 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]
« Last Edit: September 23, 2005, 02:46:35 pm by C.H. »

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: qt 4.0.1 & debug
« Reply #4 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.

Offline zieQ

  • Almost regular
  • **
  • Posts: 155
Re: qt 4.0.1 & debug
« Reply #5 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?