如何分析 BSOD 及其向我提供的错误信息?

发布于 2024-08-02 21:42:19 字数 280 浏览 6 评论 0原文

幸运的是,我没有编写过很多导致 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陈独秀 2024-08-09 21:42:19

如果您想要一种相当简单的方法来找出导致操作系统崩溃的原因,并且该方法在大约 90% 的情况下都有效(假设您有可用的故障转储),请尝试以下操作:

  • 下载 WinDbg 作为 Windows 调试工具包。请注意,您只需安装名为“Windows 调试工具”的组件。
  • 运行 WinDbg
  • 从文件菜单中选择“打开故障转储”
  • 当转储文件加载后,输入 analyze -v 并按 Enter 键
  • WinDbg 将对故障进行自动分析,并提供大量有关故障的信息崩溃时的系统状态。它通常能够告诉您哪个模块出现故障以及导致崩溃的错误类型。您还应该获得一个堆栈跟踪,它可能对您有帮助,也可能没有帮助。
  • 另一个有用的命令是 kb,它打印堆栈跟踪。在该列表中,查找包含 .sys 的行。这通常是造成车祸的司机。

请注意,您必须在 WinDbg 中配置符号如果您希望堆栈跟踪为您提供函数名称。为此:

  • 创建一个文件夹,例如 C:\symbols
  • 在 WinDbg 中,打开 File ->符号文件路径
  • 添加: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:

  • Download WinDbg as part of the Debugging tools for Windows package. Note, you only need to install the component called Debugging Tools for Windows.
  • Run WinDbg
  • Select "Open Crash Dump" from the file menu
  • When the dump file has loaded type analyze -v and press enter
  • WinDbg will do an automated analysis of the crash and will provide a huge amount of information on the system state at the time of the crash. It will usually be able to tell you which module was at fault and what type of error caused the crash. You should also get a stack trace that may or may not be helpful to you.
  • Another useful command is kbwhich 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:

  • Create a folder such as C:\symbols
  • In WinDbg, open File -> Symbol File Path
  • Add: 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.

凉薄对峙 2024-08-09 21:42:19

一般来说,您不能在应用程序代码中导致操作系统崩溃或错误检查。也就是说,如果您正在寻找一般提示和内容,我推荐 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文