Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we execute methods / code in XCcode just like in Visual Studio?

Visual Studio is one of the best developer IDE of all times, and now was improved with multithreading debugging and much more.

My question is regarding Xcode and the ability to execute code just like we do in Visual Studio.

Let's assume an object in a view and I want to run, let's say:

[pickerView setHidden:YES];

in a breakpoint just to see if in that break point I could actually hide the object.

I can't find any place for this in the XCode Debugger

alt text http://cl.ly/uLs/Screen_shot_2010-05-02_at_17.17.34.png

Am I missing something or I can't execute code that is not in the files already? like in Visual Studio Watch List or Immediate Window

enter image description here

like image 813
balexandre Avatar asked May 02 '10 15:05

balexandre


1 Answers

Yes, you can do this using gdb commands. Edit your break-point, then add a "Breakpoint Action" by pressing the plus icon under your breakpoint in the "Breakpoints" window. Select "Debugger Command" from the action type drop-down menu, then type in your command (without the semi-colon). Note that what you can enter here is gdb, not straight Objective-C, so some things won't work as you might expect (such as dot-notation).

You can also type in gdb commands in the Debugger Console while the debugger (gdb) is paused, so you can set a breakpoint, type in a command, then hit continue to see if it did what you were expecting.

like image 71
Nick Forge Avatar answered Oct 23 '22 05:10

Nick Forge