当前位置:网站首页>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 :
边栏推荐
- redis-7. Redis master-slave replication, cap, Paxos, cluster sharding cluster 02
- Problems encountered during commissioning of C # project
- How worker threads in the thread pool are recycled
- 【硬记】脏读、不可重复读、幻读场景核心区别
- 在 localStorage 中上传和检索存储图像
- ISIS的vsys(虚拟系统)
- C#合并多个richtextbox内容时始终存在换行符的解决方法
- redis-6. Redis master-slave replication, cap, Paxos, cluster sharding cluster 01
- 2022-06-12:在N*N的正方形棋盘中,有N*N个棋子,那么每个格子正好可以拥有一个棋子。 但是现在有些棋子聚集到一个格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二维数组代表,一
- 汇编语言基础:寄存器和寻址方式
猜你喜欢

微隔离(MSG)

SDN基本概述

简单了解C语言基本语

学习Mysql基础第一天

SDN basic overview
![[Markov chain Monte Carlo] Markov chain Monte Carlo method sampling prior distribution](/img/8a/e6423168e110a168bc3cc6407628f6.png)
[Markov chain Monte Carlo] Markov chain Monte Carlo method sampling prior distribution

Oracle problem: the data in the field is separated by commas. Take the data on both sides of the comma

Uploading and retrieving stored images in localstorage

Lightning breakpoint continuation

Related operations under Oracle Database
随机推荐
[turn to] FPGA interview questions
QT读取SQLserver数据库
Issues related to C # delegation and events
RT-Thread 模拟器 simulator LVGL控件:slider 控件
关于c#委托、事件相关问题
SDN基本概述
Tidb implementation plan -- I
Un des backtraders du cadre de quantification lit l'analyseur
简单了解C语言基本语
C # related knowledge points
【RS-422与RS-485】RS-422与RS-485串行接口标准
Continuous management design
Sorting of numbers and strings
Reflection of C # Foundation
When the concept of industrial Internet just appeared, people only regarded it as a method to obtain b-end traffic
What languages can be decompiled
Why should two judgment expressions in if be written in two lines
Oracle problem: the data in the field is separated by commas. Take the data on both sides of the comma
Tidb server tuning
RT-Thread 模拟器 simulator LVGL控件:switch 开关按钮控件