Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

GDB and Displaying Property values

quantassquantass Posts: 32Registered Users
edited April 2010 in iOS SDK Development
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!
Post edited by quantass on


  • oleole Posts: 14Registered Users
    edited April 2010
    "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.
    print (CGRect) [myView frame]
    print (CGSize) [myView frame].size
    print (CGFloat) [myView frame].size.width
Sign In or Register to comment.