Idea of using debugging tools

original:

https://blog.csdn.net/hao_hl1314/article/details/53120918

https://blog.csdn.net/minkeyto/article/details/81489041

Use Intellij IDEA Debug debugging tools area

 

快捷键
F9          resume programe       恢复程序
Alt+F10       show execution point    显示执行断点
F8          Step Over          相当于eclipse的f6      跳到下一步
F7          Step Into          相当于eclipse的f5就是  进入到代码
Alt+shift+F7     Force Step Into      这个是强制进入代码
Shift+F8       Step Out          相当于Eclipse中,f8跳到下一个断点/f7跳出函数
Atl+F9        Run To Cursor       运行到光标处
ctrl+shift+F9     Debug运行java类
ctrl+shift+F10    正常运行java类
alt+F8        Debug时选中查看值

 

Compile a good program to be debugged.

1. Set a breakpoint

To set a breakpoint selected lines of code, followed by the line number of the region, click the left mouse button.

2. Turn on debugging session

Click on the red box of small insects, began to enter debugging.

IDE Debug view appears below, the red block is now staying debugger line of code, the method F2 () in the program line 14. Bottom right is the method call stack area. Shows a program execution method used to place calls over the breakpoint, the following method is invoked earlier in this region.

3. Single-step debugging

3.1 step over

Click on the red box button, the program execution down one line (current line if there is a method call, the method has been carried out to return, then to the next line)

3.2 step into

Click on the red box button, the program execution down one line. If the line has a custom method, you run into the custom method (method will not enter the official class library). Specific steps are as follows:

Set a breakpoint in a custom test method at issue, perform debugging

Click on 

3.3 Force step into

This button when debugging can enter any method.

3.4 step out

If you entered when debugging a method (such as test ()), and that this method is no problem, you can use stepout jump out of the way to return to the next line of the method is called at. It is worth noting that the method has finished executing.

3.5 Drop frame

After clicking the button, you will be returned to the caller of the current method (as shown above, the program returns to main (),) re-executed, and all values ​​of contextual variables returned at that time. As long as the call chain as well as the superior method, you can skip to any one approach.

4. Advanced Debugging

4.1 Cross breakpoint debugging

Set multiple breakpoints, turn on debugging.

To move to the next breakpoint, click below:

It will run a breakpoint between the code to be executed next breakpoint. If the latter does not break the code, click the button again will execute your program.

4.2 View Breakpoints

点击箭头指向的按钮,可以查看你曾经设置过的断点并可设置断点的一些属性。

箭头1指向的是你曾经设置过的断点,箭头2可以设置条件断点(满足某个条件的时候,暂停程序的执行,如 i==7)。结束调试后,应该在箭头1处把所设的断点删除(选择要删除的断点后,点击上方的红色减号)。

4.3 设置变量值

调试开始后,在红箭头指向的区域可以给指定的变量赋值(鼠标左键选择变量,右键弹出菜单选择setValue...)。这个功能可以更加快速的检测你的条件语句和循环语句。

Guess you like

Origin www.cnblogs.com/haoyul/p/11067907.html