用于调试的最佳实践 [英] Best practices for debugging

查看:144
本文介绍了用于调试的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了不少最近使用​​Visual Studio和WinDbg中,托管应用程序的调试,因此我经常问,协助同事调试的情况。有好几次,我发现人霍刚插入破发点,在这里和那里,并希望最好的结果。在我的经验,很少是一个有用的技术。

I've been doing quite a bit of debugging of managed applications lately using both Visual Studio and WinDbg, and as such I'm often ask to assist colleagues in debugging situations. On several occasions I have found people aho just insert break points here and there and hope for the best. In my experience that is rarely a useful technique.

我的做法是这样的。


  • 重现问题。理想的情况下减少输入尽可能。

  • Reproduce the problem. Ideally reduce the input as much as possible.

检查所讲述的,其中的bug可能是错误的,并列出理论。

Examine what goes wrong and list theories for where the bug may be.

通过调试代码的特定区域检查一次一个理论。

Examine one theory at a time by debugging that specific area of the code.

根据需要重复步骤。

对于复杂的调试问题我经常与同事合作。对于WinDbg的,这是特别有用。

For complex debugging problems I often work with a colleague. For WinDbg this is especially useful.

有关调试任何其他有用的提示或最佳实践?

Any other useful tips or best practices for debugging?

推荐答案

一个非常最佳实践是不是跳水到调试立即但看代码和苦思冥想的一段时间。

One very best practice is not diving into debugger immediately but look at the code and think hard for some time.

这篇关于用于调试的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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