Eclipse debugging skills

Single step debugging:

Pay attention to the editor, after double-clicking on the specified line to set the breakpoint, click the bug in the upper left corner to enter the debugging interface
Insert picture description here
. If you want to enter data during debugging,
Insert picture description here
click the red square and the icon on the right to stop debugging and switch back to the code view
Insert picture description here

Detailed introduction:

Insert picture description here
1. Skip All Breakpoints: Set all breakpoints to be skipped. After Skip All Breakpoints is set, there will be a slash on all breakpoints, indicating that the breakpoint will be skipped and the thread will not be at the breakpoint Is suspended.
2.Resume: Resume the suspended thread and jump directly from the current position to the next breakpoint position.
3. Suspend: Suspend the selected thread, at this time you can browse or modify the code, check the data, etc.
4. Terminate: Eclipse terminates the debugging of the local program through the Terminate command.
5. Disconnect: Eclipse uses the Disconnect command to terminate the socket connection with the remote JVM.
6.Step Into: Single step execution, enter and continue single
step execution when encountering a sub-function. 7. Step Over: In single step execution, when encountering a sub-function in the function, it will not enter the single-step execution in the sub-function, and It stops the entire execution of the sub-function, that is, the entire sub-function is regarded as one step.
8. Step Return: Jump out of the current method. During the execution of the called method, using Step Return will jump out of the method and return to the method that called the method after executing all the codes of the current method.
9.Drop to Frame: This command allows the program to return to the first line of the current method and restart execution. You can re-execute this java stack frame, you can select a specified stack frame, and then click Drop to Frame, so you can restart Enter the specified stack frame. Note when using Drop to Frame:

  • 1. Cannot drop to the method in the method stack that has been executed.
  • 2. When dropped to the stack frame, the original value of the global data will not be changed. For example, a vertor containing an element will not be cleared.

10. Step Filters: This function is relatively simple, that is, when we want to ignore some classes we don’t care about when debugging, we can turn on Step Filters to filter, and the program will continue to execute until it encounters an unfiltered location or breakpoint . The Step Filters function consists of four items: Use Step Filters, Edit Step Filters, Filter Type, and Filter Package. The specific operation is as follows: Windows -> Preferences -> Java -> Debug -> Step Filtering.

Special skills:

Run to Line : Shortcut key: Ctrl+R -> After obtaining the required input, all breakpoints in the middle will be ignored, and execution will be executed to the line where the cursor is in the middle of the breakpoint.
Drop To Frame -> Go back to the beginning of the specified method for execution.

  • Right-click on a method in the method call stack and select Drop To Frame to execute from the beginning of the method
  • Of course, for methods that have side effects, such as database operations, changing the content of the object passed in parameters, etc., operations may be re-executed and it is no longer what you want.

Change Value : Change the value of the variable. This function can be used in conjunction with Drop to Frame to debug the program. Use these two functions to replace re-debug

Find variables : Use the ctrl+f shortcut key in the variable view to quickly find the variables you need
Insert picture description here

Reference materials:

https://blog.csdn.net/u011781521/article/details/55000066

Guess you like

Origin blog.csdn.net/qq_41571459/article/details/113961891