开发者

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

开发者 https://www.devze.com 2022-12-28 17:09 出处:网络
Visual Studio is one of the best developer IDE of all times, and now was improved with multithreading debugging and much more.开发者_如何转开发

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

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消