网页 综合 更新时间 2026-11-14 01:37:16

Examine suspended program | AppCode Documentation

自动蜘蛛 www.jetbrains.com 正文约 5614 字
Examine suspended program | AppCode Documentation
After the debugger session has started, the Debug tool window will appear, and the program will run normally until one of the following happens:
you manually pause the program
After that, the program is suspended, allowing you to examine its current state, control its further execution, and test various scenarios at runtime.
If you accidentally closed the Debug tool window, select View | Tool Windows | Debug from the main menu or press Alt+5 to reopen it.
The state of the program is represented by frames. When the program is suspended, the current frame stack is displayed on the Frames tab of the Debug tool window.
A frame corresponds to the active method or function call. It stores the local variables of the called method or function, its arguments, and the code context that enables expression evaluation.
Each time a method is called, a new frame is added to the top of the stack. When the execution of a method is complete, the corresponding frame is removed from the stack (in the last in, first out fashion).
Examining frames helps you understand why particular parameters were passed to a method and what the state of the caller was at the time of calling.
The Frames tab displays both the frames that come from libraries (by default, highlighted in yellow) and the frames from your source code. If the library frames distract you from the debugging process, you can hide them.
To hide/show library frames, click on the toolbar:
To copy the call stack for the current thread, right-click anywhere on the Frames tab and select Copy Stack.
The Variables tab shows the list of the variables in the selected frame/thread. The examination of variables is instrumental to understanding why the program operates in a certain way.
Be mindful of variable scope and lifetime. If a variable is not present on the list, this means the variable is out of scope for the current frame at the current execution point.
When examining variables, you may need to copy a variable name or value to paste it somewhere else or to compare it with another variable.
To copy the value that a variable holds, right-click the variable and select Copy Value Ctrl+C. For types other than String, the description representation is copied.
To copy the name of a variable, right-click the variable and select Copy Name.
When you need to compare a variable value with some other value, use the Compare Value with Clipboard option. This is helpful, for example, when a variable holds a long string, and you need to compare it with another long string.
Copy the content you are going to compare (for example, from a text file).
In the Variables tab, right-click the variable which you are going to compare with and select Compare Value with Clipboard.
Examine the differences in the Diff Viewer that opens. For additional information on how to efficiently use the Diff Viewer, refer to the Comparing Files and Folders topic.
AppCode allows you to inspect variables in a dedicated dialog. This is useful when you need to keep track of some variable (or the object whose reference it holds) and at the same time be able to navigate between frames and threads.
Right-click a variable on the Variables tab and select Inspect.
If there is a need to test how the program would behave in certain conditions or fix its current behavior at runtime, you can do that by setting/changing the variable values.
Right-click a variable on the Variables tab and select Set Value, or select the variable and press F2.
Enter the value for the variable and press Enter.
Alternatively, you can set a variable value using the inline hint popup. Click the hint that corresponds to the desired variable, expand the tree if required, and select Set Value:
If you need to look into the source code where some variable or class is declared, you can move there right from the Variables tab.
To navigate to the code where the variable is declared, right-click a variable and select Jump to Source F4.
To open the variable source code in a new window, press F4.
When stepping through the programm, the variable values are recalculated on every step and shown in the Variables tab of the Debug tool window and inline in the editor. This may cause performance degradation, especially in case of large structures or arrays. To avoid unnecessary calculations and improve the stepping performance, you can mute variables and load thier values only when needed.
To mute variables, in the Debug tool window, go to the Variables tab, right-click inside the tab and select Mute Variables.
The Mute Variables option affects the entire IDE: variables are muted for the current and following debug sessions in all projects until you unmute them.
To unmute variables, deselect Mute Variables from the context menu of the Variables tab.
To load the value of a variable when variables are muted, click Load next to this variable on the Variables tab:
The value will be calculated for the current step only.
Mute Variables doesn't change the behavior of watches — they still change values on each step. Also, you can evaluate expressions that contain muted variables.
For numerical variables of integer types, you can examine hexadecimal representation instead or alongside the original formatting.
Go to Preferences | Build, Execution, Deployment | Debugger | Data Views | Objective-C.
Select the Show integers as hex values checkbox. If you want to have the hex values alongside the original ones, select Display alongside the original value.
The hexadecimal formatting will be shown both on the Variables tab of the Debug tool window and in the editor's inline variables view.
访问原文 返回搜索 https://www.jetbrains.com/help/objc/examining-suspended-program.html
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。