网页
综合
更新时间 2026-11-14 01:37:17
Breakpoints | AppCode Documentation
自动蜘蛛
www.jetbrains.com
正文约 5929 字
Breakpoints are special markers that suspend program execution at a specific point. This lets you examine the program state and behavior. Breakpoints can be simple (for example, suspending the program on reaching some line of code) or involve more complex logic (checking against additional conditions, writing log messages, and so on).
Once set, a breakpoint remains in your project until you remove it explicitly, except for temporary breakpoints).
If a file with breakpoints was modified externally, for example, updated through a VCS or changed in an external editor, and the line numbers have changed, breakpoints will be moved accordingly. Note that AppCode must be running when such changes are made, otherwise they will pass unnoticed.
The following types of breakpoints are available in AppCode:
Line breakpoints: suspend the program upon reaching the line of code where the breakpoint was set. This type of breakpoints can be set on any executable line of code.
Exception breakpoints: suspend the program when NSException (for Objective-C) or Error (for Swift) or their subclasses are thrown. They apply globally to the exception condition and do not require a particular source code reference.
Symbolic breakpoints: suspend the program when a specific function or method are executed.
Click the gutter at the executable line of code where you want to set the breakpoint. Alternatively, place the caret at the line and press Ctrl+F8.
Click View Breakpoints in the left part of the Debug tool window or press Ctrl+Shift+F8.
In the Breakpoints dialog, press Alt+Insert or click , and select Exception Breakpoints or JavaScript Exception Breakpoint.
For Exception Breakpoint, you can specify when you want to suspend the program: when any exception is thrown (Any) or on encountering unhandled Objective-C exceptions (Objective-C) or Swift errors (Swift).
Click View Breakpoints in the left part of the Debug tool window or press Ctrl+Shift+F8.
In the Breakpoints dialog, press Alt+Insert or click , and select Symbolic Breakpoints.
Specify the symbol name and select whether you want this breakpoint to be hit in all modules, or in a specific module only.
For line breakpoints: click the breakpoint in the gutter.
For all breakpoints: from the main menu, select Run | View Breakpoints Ctrl+Shift+F8, select the breakpoint, and click Remove Delete.
To avoid accidentally removing a breakpoint and losing its parameters, you can choose to remove breakpoints by dragging them to the editor or clicking the middle mouse button. To do this, go to Preferences | Build, Execution, Deployment | Debugger and select Drag to the editor or click with middle mouse button. Clicking a breakpoint will then enable or disable it.
If you don't need to stop at your breakpoints for some time, you can mute them. This allows you to resume normal program operation without leaving the debugger session. After that, you can unmute breakpoints and continue debugging.
Click the Mute Breakpoints button in the toolbar of the Debug tool window.
When you remove a breakpoint, its internal configuration is lost. To temporarily turn an individual breakpoint off without losing its parameters, you can disable it:
For line breakpoints: right-click it and set the Enabled option as required. You can also toggle them with the middle mouse button if removing breakpoints is not assigned to it.
For all breakpoints: click View Breakpoints Ctrl+Shift+F8 and check/uncheck the breakpoint on the list.
To move a breakpoint, drag it to another line.
To copy a breakpoint, hold Ctrl and drag a breakpoint to another line. This creates a breakpoint with the same parameters at the destination.
Depending on the breakpoint type, you can configure additional properties which allow you to tailor its operation for specific needs. The most used options are available via intentions.
To access breakpoint intentions, place the caret at the line with the breakpoint and press Alt+Enter. Use this option when you need to quickly configure basic breakpoint properties.
To access the full list of properties, right-click the breakpoint and click More or press Ctrl+Shift+F8. Use this option for a bird's eye view of all breakpoints and full control over their configuration.
Removes the breakpoint at the selected line.
Disables the breakpoint at the selected line.
Opens a dialog with the most used breakpoint properties. For more properties, click More or press Ctrl+Shift+F8.
Clear the checkbox to temporarily disable a breakpoint without removing it from the project. Disabled breakpoints will be skipped during the debugging process.
Select the checkbox to pause the program execution when a breakpoint is hit. Suspending an application is useful if you need to obtain logging information or calculate an expression at a certain point without interrupting the program. If you need to create a master breakpoint that will trigger dependent breakpoints when hit, choose not to suspend the program at that breakpoint.
Select to specify a condition for hitting a breakpoint. A condition is any boolean expression that evaluates to true or false.
This expression must be valid at the line where the breakpoint is set, and it is evaluated each time the breakpoint is hit. If the evaluation result is true, the selected actions are performed. In this field, you can enter multi-line conditional expressions.
Select if you want to log the following events to the console:
"Breakpoint hit" message: a log message will be displayed in the console output when the breakpoint is hit.
Stack trace: when the breakpoint is hit, its stack trace will be printed to the console.
This is useful if you want to check what paths have led to this point without interrupting the program's execution.
Select to evaluate an expression when the breakpoint is hit, and show the result in the console output.
Select to remove the breakpoint from your project right after it has been hit.
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。