在调试模式下发布软件有什么问题吗? [英] Anything wrong with releasing software in debug mode?

查看:104
本文介绍了在调试模式下发布软件有什么问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都知道,调试模式应该用于开发,因为编译器生成更多的调试信息,而且发布模式应用于生产版本,因为编译器生成优化的代码。



但是,如果您正在制作仅在组织内部使用的软件,而代码性能不是一个巨大的问题,因为软件需要做很多文件I / O和数据库查询。在这种情况下,我将很乐意在调试模式中发布软件,因为这些额外的调试信息使得将来的维护更容易。



还有什么令人信服的在这种情况下释放模式的软件的原因?

解决方案

我可以想到两个问题:


  1. 调试构建通常会将填充添加到缓冲区。这就是为什么有时你会收到似乎的程序在调试中工作,但在发布时崩溃。似乎是这里的操作词,因为缓冲区溢出只是一个事故等待发生。


  2. 奇怪的事情发生在调试版本中。我曾经工作过一个长时间运行的应用程序,每二十天左右就会崩溃。事实证明,在C运行时,每次执行malloc / free时,计数器(用于辅助调试)都会递增。如果柜台发生溢出 - kaboom!因为这个原因,我绝对不会推荐任何人部署调试二进制文件 - 你永远不会知道什么惊喜可能在等待你的客户。



We all know that "Debug Mode" should be used for development because compiler produces more debugging information and "Release Mode" should be used for production releases because the compiler produces optimized code.

However, lets say if you are making a software that is only used internally within the organization and code performance is not a huge issue because the software need to do a lot of file I/O and database queries. I will be very tempted to just release the software in "Debug Mode" in this scenario because those extra debugging information makes future maintenance a bit easier.

Are there still any compelling reason for releasing software in release mode in this case?

解决方案

Two concerns I can think of:

  1. Debug builds often add padding to buffers. That's why sometimes you get programs that seem to work in debug but crash in release. Seem is the operative word here, as buffer overflows are just an accident waiting to happen.

  2. Strange things happen in debug builds. I once worked on a long running application that would crash every twenty days or so. It turns out that in the C runtime a counter (used to aid debugging) was being incremented each time a malloc/free was performed. If the counter happened to overflow - kaboom! For this reason alone I would never recommend anyone deploy debug binaries - you just never know what surprises might be waiting for your customer.

这篇关于在调试模式下发布软件有什么问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆