Article from: http://www.iteye.com/topic/633824
1,
Conditional breakpoint
Breakpoint is familiar to everyone.
Double-click the line header in the editing area to get a breakpoint, and the code stops running here.
Conditional breakpoint, as its name implies, is a breakpoint with certain conditions. The Code stops running at the breakpoint only when the conditions set by the user are met.
Right-click the breakpoint and select the last "breakpoint properties"
The breakpoint attribute interface and the meaning of each option are as follows,
2,
Variable breakpoint
Breakpoints can be used not only in statements, but also in variables,
It is the breakpoint of a variable. It can be stopped when the value of the variable is initialized or the value of the variable is changed. Of course, the breakpoint of the variable can also be conditional, the settings are the same as those described above.
3,
Method breakpoint
The method breakpoint is to place the breakpoint at the entrance of the method,
The method breakpoint is particularly effective when
In the JDK source code
JDK removes debugging information during compilation, so normal breakpoints cannot be hit, but method breakpoints are acceptable. You can view the call stack of a method in this way.
4,
Change variable value
The Code stops at the breakpoint, but the passed value is incorrect. How can I modify the variable value to ensure that the code continues to follow the correct process, or that an abnormal branch is always inaccessible, can I change the debugging conditions to see if the abnormal branch code is correct?
In debug
Variables of the View
In the small window, we can see mdestjarname
The variable value is "F: \ study \ eclipsepro \ jardir \ jarhelp. Jar
"
Right-click the variable and select "change value ..."
In the displayed dialog box, modify the variable value,
Or modify it in the Value View window below, and use CTR + S
After saving, the variable value will change to the new value after modification.
5,
Redebug
This debugging rollback is not omnipotent. It can only be rolled back in the stack frame of the current thread, that is, it can only be returned to the start of the call of the current thread at most.
During rollback, right-click the thread method to be rolled back and select
"Drop to frame"
6,
Remote debugging
It is used to debug programs not on the local machine. There are two methods,
1. The local machine acts as the client
2. The local machine acts as the server
The premise of using remote debugging is that the code on the server and client is consistent.
The local machine acts as the client
This machine is usually used as a client. You need to enable the remote debugging switch when the Java program on the remote server is started,
Virtual Machine parameters must be added to the server.
Versions earlier than 1.5 (available after 1.5): [-xdebug-xrunjdwp: Transport = dt_socket, Server = Y, address = 8000]
1.5 and later versions: [-agentlib: jdwp = transport = dt_socket, Server = Y, address = 8000]
F: \ study \ eclipsepro \ screensnap> JAVA-xdebug-xrunjdwp: Transport = dt_socket, Server = Y, address = 8000-jar screensnap3.jar
When connecting to the remote server, you need to create a new remote debugging program in eclipse
Note that the debug view cannot be automatically switched during connection. Do not assume that the local debugging program is not connected to the server.
This machine acts as the server
Compared with the local machine as the client, you only need to modify the "connection type"
At this time, eclipse will enter the pending connection status
The Connection Program uses the following parameters to connect to the local server. Replace the IP address with the IP address ~~
[-Agentlib: jdwp = transport = dt_socket, suspend = Y, address = 127.0.0.1: 8000]
F: \ study \ eclipsepro \ screensnap> JAVA-agentlib: jdwp = transport = dt_socket, suspend = Y, address = 127.0.0.1: 8000-jar screensnap3.jar
During remote debugging, local code modifications can be synchronized to remote, but are not written to remote files. That is to say, local modifications will be lost the next time you start the remote program, it does not affect the remote code used next time.
For more details about remote debugging, see [Use eclipse to remotely debug Java applications]
It seems that a breakpoint is missing. If the breakpoint is abnormal, complete it.
7. Exception breakpoint
I often encounter some exceptions, and then the program exits. It is difficult to find out where the exceptions occur. Fortunately, you can create an exception breakpoint,
We added an nullpointexception exception breakpoint. When an exception occurs, the Code stops at the exception. It should be helpful to locate the problem.