The IDE (Integrated Development Environment) is Integrated because you can "debug" it on the editor. Being able to debug in the IDE increases productivity. Debugging is [learning. ](Https://qiita.com/YudaiTsukamoto/items/42a8df22ca4c6b327dfd#4-%E5%8B%89%E5%BC%B7%E3%81%AE%E3%81%9F%E3%82%81%E3 % 81% AB% E3% 83% 87% E3% 83% 90% E3% 83% 83% E3% 82% B0% E3% 82% 92% E8% A1% 8C% E3% 81% AA% E3% 81 % 86)
--Target environment: Eclipse. I don't care about the version. --Target: Beginners in Eclipse and debugging. --Target language: Java. I don't care about the version.
"Debugging" is to investigate the cause of a bug and fix it.
The tool used to investigate the cause of a bug in a program is the "debugger".
Debugger --Pause the program at a "breakpoint" --Look at the values of variables at that time, move them line by line, and see how the program works. ――Investigate where the movement will be different from what you expected Use it like this.
Because there is a bug. You don't need it if everything works as expected.
When I run the program, the data is different from what I expected, the design is not well considered Bugs occur due to various causes such as coding mistakes. (It may also be used to confirm that it is working as expected.)
A "breakpoint" is a line of a program that you want to pause. If you double-click the leftmost side of the program's "Editor" window, it will be set as a breakpoint and a circle will be displayed.
--Can only be set on lines that can be stopped. (Does not stop at blank lines, class or method definition lines, etc.) --Multiple lines can be set as breakpoints. --Pause when you come to that line. --It is also possible to set a condition for a breakpoint and pause only when the condition is set.
Set it to "I'm suspicious around here, I want to see the value of this variable, I want to see the behavior around here".
If you want to cancel the breakpoint, double-click ○.
There are two ways to execute a program in the IDE.
--"Run": Do not pause at breakpoints. --"Debug": Pause at a breakpoint.
When you reach a breakpoint in debugging, you pause there, the editor in Eclipse's Debug Perspective opens, and the stopped line is indicated by an arrow.
If you want to set the argument with the main function, you can set it by right-clicking → "Argument" of "run configuration, debug configuration".
You can check the value below. You can also see the method return value and the class fields.
With the field selected, right click-> inspection
With the field selected, right click-> monitor
If it's a variable, you can see the value of the variable on the Variable tab.
When "What happens when the process advances to the next line?" While debugging is paused, operate as follows. (Only frequently used items are listed.)
Using shortcuts such as step-over saves time and effort.
|Resume||Resume||Run until the end of the program. *||F8|
|End||Terminate||Suspend processing(アプリケーションをEnd)To do.||Ctrl+2|
|Step in||Step Into||Go to the next line that is paused and pause. When calling a method on the target line, enter the called method and pause at the beginning.||F5|
|Step over||Step Over||Go to the next line that is paused and pause. If the method is called on the target line, perform those processes and proceed to the next line. *||F6|
|Step return||Step Return||It performs until the method being executed returns, and pauses when it returns to the calling method. *||F7|
For shortcuts, be careful not to press the wrong button! "Finally reproduced!" → While tracing, press F7 and F8 by mistake → (ﾟ Д ﾟ) (ﾟ Д ﾟ) (ﾟ Д ﾟ)