如何分析 BSOD 及其向我提供的错误信息?
幸运的是,我没有编写过很多导致 BSOD 的应用程序,但我只是想知道这个屏幕上的信息是否有用。它是否包含任何有用的信息可以帮助我找到代码中的错误?如果是这样,我到底需要什么?
然后,系统重新启动,并且可能已将一些错误日志或其他信息写入系统的某处。它在哪里,包含什么以及如何使用它来改进我的代码?
过去,当我与 PBX 系统交互时,我确实经常遇到 BSOD,因为该系统的驱动程序文档数量很少,所以我不得不进行一些试错编码。幸运的是,我现在在另一家公司工作,并且没有看到我的代码导致任何 BSOD。
Well, fortunately I haven't written many applications that cause a BSOD but I just wonder about the usefullness of the information on this screen. Does it contain any useful information that could help me to find the error in my code? If so, what do I need, exactly?
And then, the system restarts and probably has written some error log or other information to the system somewhere. Where is it, what does it contain and how do I use it to improve my code?
I did get a BSOD regularly in the past when I was interacting with a PBX system where the amount of documentation of it's drivers were just absent, so I had to do some trial-and-error coding. Fortunately, I now work for a different company and don't see any BSOD's as a result of my code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想要一种相当简单的方法来找出导致操作系统崩溃的原因,并且该方法在大约 90% 的情况下都有效(假设您有可用的故障转储),请尝试以下操作:
analyze -v
并按 Enter 键.sys
的行。这通常是造成车祸的司机。请注意,您必须在 WinDbg 中配置符号如果您希望堆栈跟踪为您提供函数名称。为此:
SRV*C:\symbols*http://msdl.microsoft.com/download/symbols
这将从 Microsoft 服务器缓存符号文件。
如果自动分析还不够,那么 WinDbg 提供了多种命令,使您能够准确地找出崩溃时发生的情况。在这种情况下,帮助文件是一个很好的起点。
If you want a fairly easy way to find out what caused an OS crash that will work ~90% of the time - assuming you have a crash dump available - then try the following:
analyze -v
and press enterkb
which prints out a stack trace. In that list, look for a line contains.sys
. This is normally the driver which caused the crash.Note that you will have to configure symbols in WinDbg if you want the stack trace to give you function names. To do this:
SRV*C:\symbols*http://msdl.microsoft.com/download/symbols
This will cache symbol files from Microsoft's servers.
If the automated analysis is not sufficient then there are a variety of commands that WinDbg provides to enable you to work out exactly what was happening at the time of the crash. The help file is a good place to start in this scenario.
一般来说,您不能在应用程序代码中导致操作系统崩溃或错误检查。也就是说,如果您正在寻找一般提示和内容,我推荐 NTDebugging 博客。大多数事情都超出了我的能力范围。
当操作系统崩溃时会发生什么,它会写入一个内核转储文件,具体取决于当前标志等,您可以在其中获得更多或更少的信息。您可以在 Windbg 或其他调试器中加载转储文件。 Windbg 具有有用的
!analyze
命令,该命令将检查转储文件并为您提供有关崩溃所在存储桶以及可能的罪魁祸首的提示。另请检查 Windbg 文档,了解错误检查的一般原因,以及可以采取哪些措施来解决该问题。Generally speaking, you cannot cause a OS crash or bug check from within your application code. That said, if you are looking for general tips and stuff, I recommend the NTDebugging blog. Most of the stuff is way over my head.
What happens when the OS crashes is it will write a kernel dump file, depending on the current flags and so on, you get more or less info in it. You can load up the dump file in windbg or some other debugger. Windbg has the useful
!analyze
command, which will examine the dump file and give you hints on the bucket the crash fell into, and the possible culprits. Also check the windbg documentation on the general cause of the bug check, and what you can do to resolve it.