惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
V
Visual Studio Blog
雷峰网
雷峰网
J
Java Code Geeks
博客园 - 三生石上(FineUI控件)
人人都是产品经理
人人都是产品经理
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
C
Check Point Blog
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
V2EX
D
Docker
IT之家
IT之家
博客园 - 聂微东
腾讯CDC
U
Unit 42
Microsoft Security Blog
Microsoft Security Blog
The Cloudflare Blog

博客园 - Freedom

ebook site XML Namespaces and How They Affect XPath and XSLT Debugging Applications for Microsoft .NET and Microsoft Windows: Notes-Books Debugging Applications for Microsoft .NET and Microsoft Windows: Notes-Prerequisites to Debugging NET垃圾回收机制 A Software Developer’s Reading Plan 浅析.NET中的Serialization #if (C# Reference) VS 2008 常用快捷键! One Day-XML:XML Schema 参考手册 One Day-XML:XSLT One Day-XML:WAP One Day-XML:Web Services One Day-XML:WSDL One Day-XML:RDF One Day-XML:RSS One Day-XML:XForms One Day-XML:SOAP One Day-XML:XML DOM
Debugging Applications for Microsoft .NET and Microsoft W...
Freedom · 2010-05-24 · via 博客园 - Freedom
  • The Debugging Process


    Step 1: Duplicate the bug

    The most critical step in the debugging process is the first one: duplicating the bug.

    My definition is duplicating the bug on a single machine once in a 24-hour period.

    Once you've duplicated the bug by using one general set of steps, you should evaluate whether you can duplicate the bug through a different set of steps.You can get to some bugs via one code path only, but you can get to other bugs through multiple paths. The idea is to try to see the behavior from all possible angles. By duplicating the bug from multiple paths, you have a much better sense of the data and boundary conditions that are causing the problems.

    Even if you can't duplicate the bug, you should still log it into your bug tracking system. If I have a bug that I can't duplicate, I always log it into the system anyway, but I leave a note that says I couldn't duplicate it.

    Step 2: Describe the bug

    In the real world, your writing skills are almost more important than your engineering skills because you need to be able to describe your bugs, both verbally and in writing. When faced with a tough bug, you should always stop right after you duplicate it and describe it.

    Step 3: Always assume that the bug is yours

    Reading the code will force you to take the extra time to look at the problem. Starting with the state of the machine at the time of the crash or problem, work through the various scenarios that could cause you to get to that section of code.

    Step 4: Divide and conquer

    Step 5: Think creatively

    If the bug you're trying to eliminate is one of those nasty ones that happens only on certain machines or is hard to duplicate, start looking at the bug from different perspectives. This is the step in which you should start thinking about version mismatches, operating system differences, problems with your program's binaries or its installation, and other external factors.

    Step 6: Leverage tools

    Step 7: Start heavy debugging

    Just as when you're doing light debugging, when you're doing heavy debugging, you should have an idea of where you think your bug is before you start using the debugger, and then use the debugger to prove or disprove your hypothesis.

    Step 8: Verify that the bug is fixed

    When testing your fix, especially in critical code, you should verify that it works with all data conditions, good and bad. Nothing is worse than a fix for one bug that causes two other bugs.

    Step 9: Learn and share

    Each time you fix a "good" bug (that is, one that was challenging to find and fix), you should take the time to quickly summarize what you learned.You learn the most about development when you're debugging, so you should take every opportunity to learn from it.

    Final Debugging Process Secret

    Again, I'm suggesting that you need to have a hypothesis in mind—something you want to prove or disprove—before the debugger can help you.As I recommended earlier in Step 7 I write out my hypothesis before I ever touch the debugger to ensure that I have a purpose each time I use it.