开发者

Finding a totally nasty, complex, Schröding-Bohr-Bug [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have a really nasty bug in my program, which grew quite complex over time. It's probably the worst bug I've ever had.

I think that it might be related to a static variable initialization fiasco, but how can I ensure myself of that?

When the bug strikes, the program cra开发者_如何学Goshes due to heap corruption at a random point after startup, but far inside the main() function.

To be honest, I don't know what to do.

I'm on Windows 7 using Microsoft Visual Studio 2010


my program, which grew quite complex over time

Do you keep backups of previous versions? Find an older version that worked and continue working based on that version...

There is a famous quote out there: "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan

If this program has become more complicated than you can handle then it may be time to think about refactoring.

(This is in no way intended to be demeaning or to be taken as a personal attack...)


Run your program in the debugger, and step through the code until you see what's wrong. Place breakpoints liberally anywhere you think the bug might be caused.


Try debugging your program with gdb.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜