C++ 如何使用 Microsoft 应用程序验证程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10240067/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use Microsoft Application Verifier
提问by chikuba
Using C++ and discovered today during a demo that I'm suffering from a corrupted heap (but only on important occasions!!). I found a few posts here on SOand decided to download Application Verifierand Debugging tool. I am current running Visual Studio 2010.
使用 C++ 并在今天的演示中发现我正遭受堆损坏(但仅在重要场合!!)。我在这里找到了一些关于 SO 的帖子,并决定下载Application Verifierand Debugging tool。我目前正在运行 Visual Studio 2010。
So, now I'm left with an installtion of the the debugging tool where I get a folder called Windows Kits. In the folder I have an app called WinDbg where I tried to open my app and run it. It worked fined but I was not able to get any info about my heap corruption. Then I installed the verifier which only left me with a header file and a .dll file which I dont know what to do with.
所以,现在我只剩下调试工具的安装了,在那里我得到了一个名为 Windows Kits 的文件夹。在文件夹中,我有一个名为 WinDbg 的应用程序,我试图在其中打开我的应用程序并运行它。它工作正常,但我无法获得有关堆损坏的任何信息。然后我安装了验证器,它只给我留下了一个头文件和一个我不知道该怎么做的 .dll 文件。
So, could anyone please tell me how to use this tool so that I dont have to suffer anymore embarrassing moments like these? Been searching in forums and since I dont even know how to open the verifier, I'm truly lost when I read the instructions how to use it (from 2009)
那么,谁能告诉我如何使用这个工具,这样我就不必再忍受这样的尴尬时刻了?一直在论坛里搜索,因为我什至不知道如何打开验证器,当我阅读如何使用它的说明时,我真的迷路了(从 2009 年开始)
回答by MSalters
App Verifier will install a AppVerif.EXE
executable. Run it, and tell it to verify your application. Then run your application in a debugger (either WinDBG or your IDE).
App Verifier 将安装一个AppVerif.EXE
可执行文件。运行它,并告诉它验证您的应用程序。然后在调试器(WinDBG 或您的 IDE)中运行您的应用程序。
回答by Pressacco
Consider using the Application Verifierin conjunction with the Visual Studiodebugger.
考虑将应用程序验证程序与Visual Studio调试器结合使用。
- Start Visual Studioand compile your application
- Start the application Verifier utility.
File
=>Add Application
- Select the appropriate
Tests
(e.g. heaps, exceptions,...) - Use Visual Studio
Debug
to start your application.
- 启动Visual Studio并编译您的应用程序
- 启动应用程序验证器实用程序。
File
=>Add Application
- 选择适当的
Tests
(例如堆,异常,...) - 使用 Visual Studio
Debug
启动您的应用程序。
When something badhappens... your debugger will stop. This should give you a pretty good idea of the source of the problem.
当发生不好的事情时……您的调试器将停止。这应该可以让您很好地了解问题的根源。
Also, it mighthelp to load the missing symbols before starting your test. In Visual Studio 2017, you can do this by:
此外,在开始测试之前加载丢失的符号可能会有所帮助。在 Visual Studio 2017 中,您可以通过以下方式执行此操作:
Debug
Options and Settings
Debugging
Symbols
Load all symbols
Debug
Options and Settings
Debugging
Symbols
Load all symbols
Good luck!
祝你好运!
NOTE:When you are done, be sure to disable the AppVerfierchecks that you enabled... otherwise you may experience some unexpected side-effects 6 months down the road when you have forgotten about AppVerifier.
注意:完成后,请务必禁用您启用的AppVerfier检查...否则当您忘记AppVerifier时,您可能会在 6 个月后遇到一些意想不到的副作用。
REFERENCES
参考
- MSDN: "Application Verifier" article
- Download: Application Verifier
- I believe it is also included with the various Windows SDKs (previously known as Platfrom SDK)
- Be mindful that you may have two versions installed:
C:\Windows\SysWOW64\appverif.exe
[32 bit version]C:\Windows\System32\appverif.exe
[64 bit version]
- TechNet: Two Minute Drill: Application Verifier
- MSDN:“应用程序验证器”文章
- 下载:应用程序验证器
- 我相信它也包含在各种 Windows SDK(以前称为 Platfrom SDK)中
- 请注意,您可能安装了两个版本:
C:\Windows\SysWOW64\appverif.exe
【32位版本】C:\Windows\System32\appverif.exe
【64位版本】
- TechNet:两分钟练习:应用程序验证器