This period of time has been using IntelliJ idea, today to record the usage of the Debug area tool here.
Compile the program you want to debug first.
1. Set breakpoints
Select the line of code for which you want to set a breakpoint, and click the left mouse button after the area of the line number.
2. Turn on the debug session
Click the red arrow pointing to the little bug. Start to enter debugging.
The debug view appears below the IDE, and the red Arrow points to the line of code where the debugger is currently stuck. Method F2 (), the 11th line of the program. The red arrow hovers over the area of the program's method call stack. In this area, the method used to run the program to the breakpoint is displayed, the more the following methods are called earlier.
3. Single Step commissioning 3.1 step Over
Click the button pointing to the red arrow. The program runs down one line (assuming that the current row has a method call, this method will be run to complete the return.) And then to the next line)
3.2 Step Into
Click the button pointing to the red Arrow and the program executes one line down. Assuming that the row has its own definition method, it executes a method that enters its own definition method (which does not enter the official class library). Detailed procedures such as the following:
Set breakpoints at your own definition method Hair F1 (), run debugging
Click
3.3 Force Step Into
The button can enter whatever method is being debugged.
3.4 Step Out
Suppose you enter a method (such as F2 ()) when debugging. And that the method is not problematic, you can use StepOut to jump out of the method and return to the next line of statements where the method is being used. It is worth noting that the method has been run to completion.
3.5 Drop Frame
When you click the button, you will return to the current method's call (for example, the program will go back to main () and run again, and the value of all context variables will return to that time.
Simply call the chain with a higher-level method, and be able to jump to either method.
4. Advanced Debugging 4.1 cross-Breakpoint debugging
Set multiple breakpoints. Turn on debugging.
To move to the next breakpoint, click for example to:
The program runs a breakpoint to the next breakpoint between the code that needs to be run. Assuming the following code does not have a breakpoint, tapping the button again will run out of program.
4.2 Viewing breakpoints
Click the button that the arrow points to. Ability to view breakpoints you have previously set and to set some properties of breakpoints.
The arrow 1 points to the breakpoint you have set previously, and the Arrow 2 can set a conditional breakpoint (when a condition is met, pausing the program's operation, such as c==97). After you finish debugging, you should delete the breakpoint you set at arrow 1 (after selecting the breakpoint you want to delete, click the red minus sign above).
4.3 Setting variable values
After debugging starts. In the area pointed by the Red arrow can assign a value to the specified variable (left mouse button to select the variable, right-click popup menu Select SetValue ... )。
This feature allows you to detect your conditional statements and loop statements more rapidly.
alt+f8 debug时选中查看值
f8相当于eclipse的f6跳到下一步
shift+f8相当于eclipse的f8跳到下一个断点。也相当于eclipse的f7跳出函数
f7相当于eclipse的f5就是进入到代码
alt+shift+f7这个是强制进入代码
ctrl+shift+f9 debug执行java类
ctrl+shift+f10正常执行java类
command+f2停止执行
Summary of the use of the Android Studio Debug feature