Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the expression window in Xcode 4?

How can I add an expression to watch in Xcode 4?

This should be very obvious, but it is not. It does not seem to be down any menu or available on a contextual click. It would be nice if I could highlight a variable or expression and then "Add to watch" or "Add expression".

like image 275
jcpennypincher Avatar asked Apr 12 '11 08:04

jcpennypincher


People also ask

How do you evaluate expressions in Xcode?

Evaluate a C/ObjC/C++ expression in the current program context, using user defined variables and variables currently in scope. This command takes 'raw' input (no need to quote stuff). -G <gdb-format> ( --gdb-format <gdb-format> ) Specify a format using a GDB format specifier string.

How do I see local variables in Xcode?

Right click in the local variables window to see the "Watch Expression" menu command. Type the variable name and the variable will be added.

How do I step through code in Xcode?

Step Through Code in the Debugger Customize what Xcode displays when running your app in the debugger by choosing Xcode > Preferences > Behaviors > Running. Use the buttons in the debug bar to control the execution of your app.

How do I debug in Xcode step by step?

To try to debug it, set your active scheme in Xcode to be AppName > iPhone 11 Pro Max. Then using the simulator alone (not Xcode) click on the AppName to let it run. Then go into Xcode and do Debug > Attach to process by PID. Then type in the name of your App, and click Attach.


2 Answers

I don't know that there is an option to create a watch expression directly from Xcode 4's code window. If there's something in the code window you'll want to add an expression watch for, I think you'll have to copy that code to the clipboard.

Then while debugging, make sure the debug area is being shown. It is the bottom center view in Xcode. You can show this area by clicking the appropriate view icon from the debug view.

Show Xcode 4's Debug Area

Then in the lower left of the debug area, you have your watch list. You can add an expression to this list by right-clicking and selecting Add Expression:

Right-click to add an expression http://blog.roughfalls.com/non-wp/img/xcode4_addexpression.png

After you select this option, a dialog appears. You can paste the expression that you copied to the clipboard into this dialog, and click "Add." Watch expressions are denoted in the list with a small "E" icon to their left.

like image 129
Andrew Brown Avatar answered Oct 04 '22 20:10

Andrew Brown


Just a note: I had a problem with expressions that they didn't get evaluated (Expression in Xcode 4.3.2 Debug area not evaluated).

To make it working, I had to include also the result type of the expression (e.g. (NSString *)[tag name]).

enter image description here

like image 24
Radek Skokan Avatar answered Oct 04 '22 18:10

Radek Skokan