Intellij IDEA debug breakpoint debugging

IntelliJ IDEA Tutorial (General Catalog)

When debugging the code, your project has to start in debug mode, that is, click the green beetle to start the server, and then you can debug with breakpoints in the code.
Don't worry about what this shortcut key is , because this keymap can be configured by yourself , some people's keymap is the mac version, and some is the Windows version .
Mine is Windows, and I modified the keymap to the keymap of eclipse, because I was turned from eclipse.
Look directly at the picture below and explain in detail what each button (the button corresponds to the number in the picture) does.

1, rerun XXX, this is to directly re-run a program.
2. This is equivalent to f8 in eclipse, run it directly, stop at the next breakpoint, and run the program directly without it.
3. Stop the project or program. If it is your own main, click it to stop it, if it is a Java web project, click 2 to stop the server.
4. View all breakpoint settings. For specific details, there are schematic diagrams below, which will be explained in detail.
5. Cancel all breakpoints directly, making all breakpoints invalid.
6. If you accidentally mess up the layout below, click this to restore the layout below.
7. Jump to the place where the current code is executed, that is to say, when you are looking at the code, click to other places, click this button, and you will arrive at the place where the current line of code is executed by the program.
8. The next step, if it is a method, he will not jump into it. Just go down line by line. (The shortcut key in eclipse is f6)
9. Jump to the details. If the next line of debugging code is an executable method, you can go in with f5 to view the details of the operation of this method. The point is to click in and execute
10, and jump out from the details, which is the opposite of 9 above.
11. Literally, it means jumping to the place where the cursor is, provided that there is no breakpoint on the way.
12. After this point is turned on, you can calculate the value of the code segment you want to see, as shown in the figure above.
13. Look at the meaning, the same as the watch in eclipse, to view the value of an object, a custom object.
14. Separate the value of the custom view object to another tab page.
15. Sometimes when we step into the method body, we want to go back to the outside of the method. After clicking this button, the breakpoint returns to the outside of the method body. Continue or you can enter the method again

 

To view the value of an object at the breakpoint , you can use the following methods:
1. After selecting the object, hover the mouse over the object for about 2 seconds.
2. Add the object to the watch.
3. You may be automatically listed below. There are 4 in the code
, use the button marked 12 on the above picture

5. Alter + click, press and hold alter, and then click the variable you want to see, and the value of the variable will appear. This is amazing, thanks to the old iron on the 40th floor.

 

Let's talk about 4, 12, 13, 14
4 in detail below. To view the details of all breakpoints, click on it as shown below.
In the condition of the figure, you can set the condition of the breakpoint, and stop when i==4. View specific breakpoint content.


 

Regarding setting breakpoint conditions, you can also right-click to set directly at the code breakpoint. After you are done, done, the setting is complete.


12. This one is used a lot, and this one is more casual. You can calculate the result you want based on your input, not limited to the variables in the code.
This is very convenient to use when debugging.


13, 14, after these two points are completed, the effect is as shown in the figure below, but the custom variables and the variables that come with the code are displayed in two tab pages.
You can click button 13 and add the value of the variable you want to view by yourself.

 

Another requirement is to modify the value of the code variable in the running state in real time when debugging the code.

If you look carefully at the figure below, you will know how to set the value of some variables when debugging the code in real time. You can see that after I enter a above, there are prompts similar to when you write the code, and you can Change the value of the variable here

 

When debugging, set the parameters at runtime as follows:

The entrance is as follows, both places are available.

Generally, we run the simple main method. When running the main method, the parameter file is also included. This is the first time, so let’s make a record by the way.

 

Finally, I said so much about the wet chest. Dear audience, those who have money will support the money field, and those who have no money will support the personal field. Give a like, leave a comment or something, okay?

 

Update: This editor can set the keymap for the convenience of students who have transferred from the eclipse editor. See the picture for details.

Because when I just started, I used eclipse, and then turned it over, so when I used it, I set up this keyboard mapping first. I still use the shortcut keys that I used to use on eclipse. No need to memorize new shortcut keymaps again. This is also extremely convenient.

Therefore, on the shortcut key of this debug and when using eclipse, it is the same f5 to enter, and f6 is the next step.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324955483&siteId=291194637