IDEA- Advanced Debug technique

The idea as to introduce see website with respect to ok, www.jetbrains.com/idea/downlo…

For many partners who are not familiar with IDEA, IDEA debugging is not only limited to F8 and F9 two shortcut keys, but IDEA itself is very powerful debugging function, if you master these advanced debugging skills, for your personal development is a great improvement in efficiency!

Basic usage & shortcut keys

image.png

Debug mainly corresponds to horizontal and vertical lines:

1. First, the first group of buttons, a total of 8 buttons, from left to right as follows:

image.png
  • Show Execution Point (Alt + F10) : If the cursor is on another line or page, click this button to jump to the current line of Execution.
  • Step Over (F8) : Step Over, line by line, if there is a method on the line does not enter the method.
  • Step Into (F7) : if the current line has a method, can enter the method inside, generally used to enter a custom method, not Into the official class library method.
  • Step Out (Shift + F8) : Exit from the method you entered to the method call, “at which point the method has completed execution but has not completed assignment.”
  • Drop Frame (default none) : Rollback breakpoint, as explained in Section 8
  • Run to Cursor (Alt + F9) : Run to Cursor (Alt + F9) : Run to Cursor (Alt + F9) : Run to Cursor (Alt + F9) : Run to Cursor (Alt + F9) : Run to Cursor (Alt + F9) : Run to Cursor (Alt + F9) : Run to Cursor (Alt + F9) : Run to Cursor (Alt + F9) : Run to Cursor (Alt + F9) : Run to Cursor.

Right click on breakpoints:

  • Enable: indicates whether the breakpoint is a breakpoint
  • Suspend: Multithreading breakpoint
  • Condition: conditional breakpoint

To “view the value of an object at a breakpoint”, you can: ALTER + click, press ALTER, and then click on the variable you want to view

Second, evaluate the expression

Evaluating an expression does two things:

  • View the value of the expression
  • Sets the value of the expression
image.png

Set the value of the expression:

  • Method 1: This case is to set the value of the expression A =20;
image.png
  • Method 2:

Right click on the variable and set the Value of set Value.

image.png

Method breakpoints

Method breakpoint is the breakpoint for the triangle, and the main thing it does is, if I hit F9,

  • Enter the first and last lines of the method
image.png
  • Breaking a breakpoint on an interface. If an interface has multiple implementation classes, breaking a breakpoint on a method of the interface can quickly locate the specific implementation class
image.png

Abnormal breakpoints

Where there is an exception, the breakpoint will stay, such as the null-pointer exception below, the program will stay on the line of code that reported the null-pointer exception!

image.png

The program stops at the line where the exception was thrown (” It’s very easy to find code locations where a null pointer occurs this way!” )

image.png

Field breakpoints

When you set a complex value, you can see how the value changes, you can set a breakpoint, and the writing process will stop!!The field breakpoint is used every time you change the value and the first time you set age was 10

The second value is: 20

image.png

Conditional breakpoint

image.png

For debug, I =50 will pause directly

image.png

Seven: load the changing code during debugging

Want to load the changed code when debugging:

image.png

To get more technical articles recommended small partners, please long press the picture below, pay attention to the wechat public number “front and rear end selection”, or directly on wechat search “front and rear end selection” can be concerned!

image-20200614102027868

This article is formatted using MDNICE