当前位置:网站首页>How idea breaks point debugging
How idea breaks point debugging
2022-06-13 07:20:00 【Focus on writing bugs】
List of articles
When writing code , Sometimes we need to keep track of how the code works , Using breakpoint debugging is a good way , Next, let's talk about how to IDEA Using breakpoints for debugging
1. To set breakpoints
Directly in the line number field of the code where you need the break point , Click on , You can set the breakpoint , As shown in the figure 
Here is a supplement to the understanding of breakpoints : Breakpoints are in front of the code , for example 11 The breakpoint of the line is set at 11 In front of the line of code , signify , When the program runs to 11 Line code breakpoints , The first 11 Line of code doesn't actually run
2. debugging
Click the green triangle to run the program , Click the green Ladybug to run the debugging program 
The program will enter the debugging interface , Breakpoint markers at the line of code , All turned into red arrows , The blue part indicates the number of lines the program has stopped
At the bottom is the debug window , The left part of the debug window is the method stack , That is, the following methods are called earlier , The right part of the debug window is the value of the variable 
3. Basic operation of debugging
3.1 step over

At the top of the debug window , It means : Go to the next step , If the current line breakpoint is a method , Do not enter the current method . That is, from the code line A, Skip to the next line of code A + 1, And execute the original A Line code
for example :
Now let's go to the 12 Line code (12 Line not executed ), Current map There is only one element in , We can go down here Variables Confirm that there is only one element in 
When we click step over when : The first 12 The line contents are executed ,map Of size Turn into 2, The program comes to the 13 That's ok 
3.2 step into Follow Force step into
Both of them mean : Go to the next step , If the current line breakpoint is a method , Then enter the current method . But there's a difference ,step into Only for custom methods , If the corresponding method is the method of the official library , Does not enter the method body . but Force step into, Whatever the method is , Will enter the method body
give an example :
When it comes to 15 That's ok , A custom function :
Use step into
Then it enters the method body 
But if this is the official library method , Can't get into :
here , If you need to enter the method body , You need to use Force step into:
Enter here to hashmap in 
3.3 step out
Jump out of , That is, when we run in the method body , Don't want to continue running line by line , Want to go directly back to the method of the previous level , Then use step out Jump out of
Such as the above debugging , We enter hashmap in :
Use :step out Jump out of 

3.4 resume program
Restore program run , If the code below the breakpoint has a breakpoint, it will stop at the next breakpoint , That is, jump from one breakpoint to another 
for example : Program debugging to 13 That's ok , Click on Resume Program, Run directly to the next breakpoint 15 Stop at the right place 
After execution :
3.5 mute breakpoints
Invalidate all breakpoints , Invalidate all breakpoints , You can run the rest of the program directly 
3.6 view breakpoints
View the information of all breakpoints 
Query results : You can see the information of all breakpoints you have set :
3.6 Conditional breakpoints
Judge whether the breakpoint stops , Right click the breakpoint to set :
for example , If we set the breakpoint like this , During our debugging , This code will stop 100 Time , If I just want it to be greater than 90 It's time to stop ?
We can do this , Set conditional breakpoints :
After setting , The breakpoint will be added “?”
When debugging , When you stop :
边栏推荐
- mysql中时间字段 比较时间大小
- TiDB Lightning
- 领先企业的管理实践证明,企业可持续发展的核心是什么?
- 【ViveFocus使用WaveVR插件获取手柄操作事件】
- [weak transient signal detection] matlab simulation of SVM detection method for weak transient signal under chaotic background
- The biggest highlight of wwdc2022: metalfx
- NFV基本概述
- ISIS的vsys(虚拟系统)
- 微隔离(MSG)
- 【RS-422与RS-485】RS-422与RS-485串行接口标准
猜你喜欢

尝试使用RenderDoc查看UE的Shader代码

redis-1. Install redis with pictures and texts

Through the function seaborn cubehelix_ Palette build order palette

RT thread simulator lvgl control: button button event

A solution to the problem that there is always a newline character when C merges multiple RichTextBox contents

Table access among Oracle database users

SDN basic overview

Evolution in the digital age

对绘制丘岭密度图ridge plot的详细说明、重叠核密度估计曲线overlapping densities、FacetGrid对象、函数sns.kdeplot、函数FacetGrid.map

Raspberry school advanced development - "writing of IO port driver code" includes bus address, physical \u virtual address and bcm2835 chip manual knowledge
随机推荐
Continuous management design
2022-06-12:在N*N的正方形棋盤中,有N*N個棋子,那麼每個格子正好可以擁有一個棋子。 但是現在有些棋子聚集到一個格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二維數組代錶,一
RT thread simulator lvgl control: button button event
不间断管理设计
Tidb implementation plan -- III
One article of quantitative framework backtrader read analyzer
RT-Thread 模拟器 simulator LVGL控件:button 按钮样式
[Markov chain Monte Carlo] Markov chain Monte Carlo method sampling prior distribution
Related operations under Oracle Database
The 'yarn' item cannot be recognized as the name of a cmdlet, function, script file, or runnable program
Tidb statistics
Department store center supply chain management system
考研英语
2022-06-12:在N*N的正方形棋盘中,有N*N个棋子,那么每个格子正好可以拥有一个棋子。 但是现在有些棋子聚集到一个格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二维数组代表,一
[turn to] FPGA interview questions
SDN basic overview
Fundamentals of assembly language: register and addressing mode
5xx series problem solving
C # related knowledge points
Lightning data import