当前位置:网站首页>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 :
边栏推荐
- Why should two judgment expressions in if be written in two lines
- Simple understanding of basic language of C language
- redis-0. Introduction to redis and NiO principle (random talk)
- 基于SSM实现水果商城批发平台
- Implementation of fruit mall wholesale platform based on SSM
- Raspberry school advanced development - "writing of IO port driver code" includes bus address, physical \u virtual address and bcm2835 chip manual knowledge
- Ansible PlayBook的中清单变量优先级分析及清单变量如何分离总结
- 百货中心供应链管理系统
- Un des backtraders du cadre de quantification lit l'analyseur
- [vivefocus uses the wavevr plug-in to obtain handle operation events]
猜你喜欢
2022-06-12:在N*N的正方形棋盤中,有N*N個棋子,那麼每個格子正好可以擁有一個棋子。 但是現在有些棋子聚集到一個格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二維數組代錶,一
量化框架backtrader之一文读懂Analyzer分析器
A solution to the problem that there is always a newline character when C merges multiple RichTextBox contents
RT thread simulator lvgl control: button button event
Related operations under Oracle Database
Tidb dashboard modify port
不间断管理设计
Through the function seaborn cubehelix_ Palette build order palette
RT-Thread 模拟器 simulator LVGL控件:slider 控件
oracle问题,字段里面的数据被逗号隔开,取逗号两边数据
随机推荐
Tidb index optimization
The biggest highlight of wwdc2022: metalfx
Functions about Oracle.
B. I Hate 1111 (记忆化搜索 数论
C drawing table and sending mail function
Tidb dashboard modify port
Through the function seaborn cubehelix_ Palette build order palette
关于#数据库#的问题:PGADMIN4 编辑sql窗口问题
Compilation and development process of Quanzhi v3s environment
mysql中时间字段 比较时间大小
Uploading and retrieving stored images in localstorage
How to use clion to debug a project built by the make tool
Monotone stack top31 of interview must brush algorithm top101
Performance tuning can't just depend on tapping the brain
powerdisgner逆向生成oracle数据模型
关于oracle的函数。
2022-06-12:在N*N的正方形棋盤中,有N*N個棋子,那麼每個格子正好可以擁有一個棋子。 但是現在有些棋子聚集到一個格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二維數組代錶,一
Related operations under Oracle Database
量化框架backtrader之一文讀懂Analyzer分析器
C # using multithreading