当前位置:网站首页>Program debugging - debug/release version
Program debugging - debug/release version
2022-06-29 07:55:00 【qazw9600】
explain
- In years of embedded R & D work , It is found that most small and medium-sized companies are not divided Debug/Release Version habit , Even some entrepreneurial teams who are known as industry leaders and large companies .
- Common processing :
- There is only one version in the whole development stage , Almost no extra tools are used , Debugging, etc. by printing without using gdb Tools such as .
- Use the version with debugging information when programming debugging , The official version is based on this strip Next .
Personal understanding
Whether it is necessary to distinguish Debug/Release edition
- Debug( Debugging phase )、Release ( Release phase ), There are two phases in the life cycle of each program , In order to deal with , Each program should have two versions (Debug Version and Release edition ),Debug Version to facilitate debugging and find problems , A lot of additional debugging tools need to be added , and Release edition , For performance and user experience , Some optimization of the program is needed , for example : Get rid of Debug Stage debugging means .
- Divide into Debug/Release The version is not C/C++ Characteristics of language ; No matter what language the program is written in, it has these two stages , Therefore, they all need to be distinguished , But other languages ( for example :java etc. ) The requirements for performance are relatively low, and the compilation and operation mechanism is similar to C/C++ Different languages and better dynamics ( Debugging methods such as logs can be dynamically set at runtime ) therefore Debug/Release The partition requirements of the version are not like C/C++ So obvious .
- Debug/Release Versioning is not a specific method , It is a policy that can be customized ; There are no regulations Debug and Release What should the version do , What should not be done , Nor is there a specific option to cover it Debug/Release Division of versions , Compiler options and usage IDE You can generate versions with debugging information , That's language level Debug/Release Versioning , You also need to have a business layer Debug/Release Versioning , for example :Debug/Release Different stages Log Output .
strip and Release The difference between
- A program that will be accompanied by debugging information strip Not equivalent to Release edition , Compiler plus -g The program compiled with the compile option will have its own debugging information ,strip The program will remove the debugging information and symbol table of the program , Although binary programs are generated in two ways strip The file size is the same after , But what is generated is language level Release edition , Business level debugging tools still exist , for example : Assertion , Self added debugging means , And these means ( Assertion ) The existence of is very dangerous .
C/C++ How to divide when programming Debug/Release edition
- Use NDEBUG macro , The macro is not defined by default , Corresponding Debug edition , Generate Release version , You need to define the macro manually , This macro can also control system level debugging methods such as assertions .
- The way is C/C++ The conventional division of the project , Many system codes and open source projects adopt this method , Therefore, the macro can be judged in the code NDEBUG Whether it exists or not Release Mode or Debug Pattern , Or expand , for example :
#ifndef NDEBUG
std::cout << "Debug Mode" << std::endl;
#else
std::cout << "Release Mode" << std::endl;
#endif
边栏推荐
- Wechat applet learning notes (summer vacation)
- Dump (cl\alv\tree\base================================cp|set\items\for\column) when expanding node or clicking toolbar button
- Using cdockablepane to realize floating window in MFC
- Common MySQL errors and solutions summarized painstakingly (I)
- JSP learning part
- 小白大战指针 (上)
- 产品经理应该学习墨刀还是Axure?
- tf. count_ nonzero
- tf. compat. v1.global_ variables
- 基础语法 - 位运算
猜你喜欢

Appium 环境搭建

4年工作经验,多线程间的5种通信方式都说不出来,你敢信?

Vulnhub's dc7 target

【深度之眼吴恩达机器学习作业班第四期】Logistic Regression 逻辑回归总结

从Nacos客户端谈Nacos配置中心

【工控老马】PLC六路抢答器系统设计详解

SizeBalanceTree

面试官:为什么数据库连接很消耗资源,资源都消耗在哪里?

Reasons why the ext.dic file configured in ES does not take effect
![[old horse of industrial control] detailed explanation of Siemens PLC s7-300scl programming](/img/da/08f23cfe7f8759b73576eb0638fec5.png)
[old horse of industrial control] detailed explanation of Siemens PLC s7-300scl programming
随机推荐
code::blocks代码格式化快捷键
cv2.cvtColor
1032 Sharing
低配MySQL数据库几十秒插入百万数据
ShapeShifter: Robust Physical Adversarial Attack on Faster R-CNN Object Detector
Check whether tensorflow supports GPU and test program
声波通讯 - 流式数据处理 - 窗口对齐
【量化投资系统】因子处理安装talib
从Nacos客户端谈Nacos配置中心
[repair collection function, update login interface] knowledge payment applet, blog applet, full version open source code, resource realization applet, with 299 whole station resource data
498. 对角线遍历(模拟)
pycharm的虚拟环境如何共享到jupyter-lab
【域渗透提权】CVE-2020-1472 NetLogon 权限提升漏洞
穿越过后,她说多元宇宙真的存在
C mqtt subscription message
Vulnhub's dc7 target
C#Mqtt订阅消息
SizeBalanceTree
电检码配置
Vulnhub's dc6 target