当前位置:网站首页>Introduction to program debugging and its use
Introduction to program debugging and its use
2022-08-10 15:21:00 【Seven, seven.】
Article table of contents
Debug
First, the concept of program debugging
Program debugging is the process of testing
, correcting syntax errors and logic errors by hand or compiling the program before putting it into actual operation.
Second, program debugging steps
1. Find the existence of program errors.
2. Locate the found error
3. Find out the cause of the error
4. Correct the error
5. Re-test the corrected program
Third, debugging in Windows environment
We use VS to debug in the Windows environment, and gdb in the linux environment.Debugging on VS is divided into two versions: Debug version and release version.
Debug version contains program debugging information without optimization.
The release version has carried out various optimizations to the program, so that the size and speed of the program code have been improved.Mainly for user use.
You can compare the running size of the two versions, as shown in the figure: 


Obviously debug is much bigger than release.Normal debugging can only be performed under the debug version.
Fourth, debugging shortcuts
F5: Start debugging, often used to jump directly to the next breakpoint.
F9: The important role of creating breakpoints and canceling breakpoints. Breakpoints can be set anywhere in the program.In this way, the program can be stopped at the desired position at will, and then executed step by step.
F10: by procedure, used to process a procedure can be a function call, or a statement.
F11: statement by statement, execute a statement each time, this shortcut key can make our execution logic enter the function.
5. What debugging can do
1. View the value of the temporary variable
Enter debugging, initialize the a array to 0 in the code as shown in the figure, and enter a in the monitor, and the values from 0 to 9 will be initialized to 0 as shown in the figure:

2. View memory information
Enter a in the memory to display the addresses of these 10 numbers:
Of course, you can also see &a in the monitor, for example, enter &a[1], &a[9].As shown: 
3. View the call stack


From the picture, we can see that the program only calls one main function.
4. View assembly information


5. View register information


6. Common compilation errors
(1), compilation error
Look directly at the error message in the box below, or solve it with your own experience
(2), link error
Look at the error message and find the identifier in the error message in the code. Generally, the identifier name does not exist or is misspelled. For example, main is written as mian or a non-existent function name is written.
(3), runtime error
This is relatively hard to find and requires debugging to gradually locate the error.
边栏推荐
- 第五讲 测试技术与用例设计
- 易观千帆银行用户体验中心:聚焦银行APP用户体验
- 网络初识(二)
- 产品使用说明书小程序开发制作说明
- Go Context基本使用
- 【数仓设计】企业数仓为什么要进行分层?(六大好处)
- Epoll learn to think: a high performance server processing framework
- Programmer = overtime??- Master the time to master the life
- PyTorch multi-machine multi-card training: DDP combat and skills
- scala 10种函数高级应用
猜你喜欢

符合信创要求的堡垒机有哪些?支持哪些系统?

Do not access Object.prototype method ‘hasOwnProperty‘ from target object....

王学岗—————————哔哩哔哩直播-手写哔哩哔哩硬编码录屏推流(硬编)(26节课)

Alibaba的秒杀系统—千亿级并发设计手册上线了

Based on Azuki Series: NFT Valuation Analysis Framework "DRIC"

易基因|深度综述:m6A RNA甲基化在大脑发育和疾病中的表观转录调控作用

E. Cross Swapping(并查集变形/好题)

SWIG教程《二》

奢侈品鉴定机构小程序开发制作功能介绍

SWIG教程《一》
随机推荐
产品使用说明书小程序开发制作说明
Understanding_Data_Types_in_Go
富爸爸穷爸爸之读书笔记
systemui屏蔽通知栏
司空见惯 - 股市狠狠下跌后,何時能反弹?
SYM32——RTC实时时钟程序讲解
NFT digital collection development issue - digital collection platform
Based on Azuki Series: NFT Valuation Analysis Framework "DRIC"
win2012安装Oraclerac失败
Steam教育在新时代中综合学习论
网络初识(二)
关于已拦截跨源请求CORS 头缺少 ‘Access-Control-Allow-Origin‘问题解决
PyTorch 多机多卡训练:DDP 实战与技巧
[Letter from Wu Enda] The development of reinforcement learning!
数学建模学习视频及资料集(2022.08.10)
1004 (tree array + offline operation + discretization)
640. 求解方程 : 简单模拟题
Boss raises salary!Look at my WPF Loading!!!
SWIG Tutorial "One"
容器化 | 在 S3 实现定时备份