Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-04-2010, 12:08 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 32
quantass is on a distinguished road
Question GDB and Displaying Property values

I would like to obtain the value for my declared properties while debugging. With Xcode's GUI debugger 99% of the time it displays nothing of value. NSLog is my only resort. I'm now trying to understand and appreciate GDB.

My property:

@property (nonatomic, retain) UIView *myView;
@synthesize myView;

I would like to display the value of my frame width: myView.frame.size.width

NSLog displays the correct width however with the GDB console (i set a break point):

po myView produces <UIView: 0x526e10>

po (CGRect)[myView frame] produces the message "Previous frame inner to this frame (gdb could not unwind past this frame) Value can't be converted to integer."

po myView.frame.size.width produces the message "There is no member named frame"

po [myView frame] and po [[[myView frame] size] width] produces the message "Program received signal EXC_BAD_ACCESS, Could not access memory"

Any help in getting GDB (or Xcode) to display the contents of my properties and other class members would be terrific. I'm coming from a MS Visual Studio debugger background so please forgive my ignorance on how debugging is performed within Xcode.

As always, much appreciated!

Last edited by quantass; 01-04-2010 at 12:20 AM.
quantass is offline   Reply With Quote
Old 04-23-2010, 12:21 PM   #2 (permalink)
ole
Registered Member
 
ole's Avatar
 
Join Date: Dec 2009
Location: Berlin
Posts: 14
ole is on a distinguished road
Default

"po" is short stands for "print-object". Since frame is no object, you have to use the print command instead. Also, [[[myView frame] size] width] is not valid code because size and width are struct members and not properties. They can only be accessed with C-style dot notation.

Code:
print (CGRect) [myView frame]
print (CGSize) [myView frame].size
print (CGFloat) [myView frame].size.width
__________________
http://oleb.net
ole is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 344
16 members and 328 guests
akacaj, alexP, ClerurcifeDer, Domele, Duncan C, givensur, GraffitiCircus, guusleijsten, JmayLive, michelle, NetGuru, NSString, Paul Slocum, Punkjumper, Sloshmonster, soohyun
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,114
Posts: 402,883
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:50 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0