Before reading this article, I recommend that you take a look at the Eclipse Shortcuts manual, and my eclipse version is 4.2 Juno.
Three points first.
Do not use SYSTEM.OUT.PRINTLN as the debugging tool to enable verbose logging levels for all components use a log analyzer to read log 1, conditional breakpoints
Imagine how we normally add breakpoints, usually by double-clicking the left side of the line number. In the debug view, breakpoint View lists all breakpoints, but we can add a Boolean condition to determine whether the breakpoint has been skipped. If the condition is true, the program stops at the breakpoint, otherwise the breakpoint is skipped and the program continues to execute.
2. Abnormal Breakpoint
There is one in the breakpoint view that looks like J. button, we can use it to add a breakpoint based on the exception, for example we want the program to pause when the NullPointerException is thrown:
3, Observation points
This feature I like very much, and he allows the program to pause and debug when a selected attribute is accessed or changed. The easiest way to do this is to add an observation point by double-clicking the line number on the left of the statement that declares the member variable in the class.
4. View variable
Use Ctrl+shift+d or Ctrl+shift+i on the selected variable to view the value of the variable, and we can also add monitoring in expressions view.
5, change the value of the variable
We can change the values of the variables in the debug time. You can do this in variables view as shown in the following illustration.
6, in the main method to stop in the Run/debug settings, we can as shown in the following figure to enable this feature. The program will stop at the first line of the Main method
7. Environment variables We can easily add environment variables to the Edit Conriguration dialog box
8, drop to frame This function is very cool, is my second favorite feature, drop to frame that is, you can jump back to the beginning of the current method to perform again, and all the values of the context variables back to that time. Not necessarily the current method, you can click on any frame in the current call stack to jump there (except for the first frame). The main purpose is to quickly restore all variables to the beginning of the method to perform again, that is, over and over again in the context of your concern to do multiple debugging (combined with changing the value of variables and other functions), instead of debugging to where. Of course, the side effects of the original execution are irreversible (for example, you insert a record into the database).
9, Step Filter When we are debugging in the F5 will enter the internal method, but this has a disadvantage sometimes may go into some of the library inside (such as JDK), may not be what we want, we can add a filter in the preferences, exclude the specified package.
10, enter, skip, return actually this technique is the most basic knowledge of Debug. F5-step into: Moves to the next step, and if the current row is a method call, it will enter the first row of the method. (Can be excluded by the Nineth article) F6-step over: Move to the next line. If the current row has a method call, the method is executed and returned, then to the next line. F7-step return: Continues execution of the current method, and when the current method finishes execution, control goes to the line that the current method is called. F8-moves to the next breakpoint.
Report:
Debug Common shortcut keys:
<span style= "font-size:10px;" > Scope feature Shortcut
Global step back F7 global stepping skip
F6
Global Stepping F5
Global step Jump Select Ctrl+f5
Global Debug last started F11 Global
continue F8 global
use Filter Stepping Shift+f5
Global Add/Remove breakpoint Ctrl+shift+b
Global display ctrl+d global
run last start ctrl+f11
global run to row ctrl+r
Global execution Ctrl + U </span>
<span style= "font-size:10px;" >
</span>
<span style= "font-size:10px;" > Original address: <a target=_blank target= "_blank" href= "http://www.oschina.net/question/82993_69439" style= "Color:rgb" ( 51, 102, 153); Text-decoration:none; " >http://www.oschina.net/question/82993_69439</a></span>