visual-studio 防止 Visual Studio 尝试加载特定 DLL 的符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/869168/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 10:29:38  来源:igfitidea点击:

Prevent Visual Studio from trying to load symbols for a particular DLL

visual-studiodebuggingdebug-symbols

提问by RichieHindle

I have Visual Studio 2005 set up to use Microsoft's symbol servers. I also have UltraMoninstalled, which injects a hook DLL into every process. Whenever I start debugging my MFCapplication, Visual Studio says:

我已将 Visual Studio 2005 设置为使用 Microsoft 的符号服务器。我还安装了UltraMon,它将钩子 DLL 注入每个进程。每当我开始调试MFC应用程序时,Visual Studio 都会说:

"Loading symbols for C:\Program Files\UltraMon\RTSUltraMonHookX32.dll..."

for anything from the blink of an eye to several tens of seconds. It's never going to find those symbols... Can I tell it not to bother looking?

从眨眼到几十秒不等。它永远不会找到那些符号......我能告诉它不要费心寻找吗?

(I tried creating an empty RTSUltraMonHookX32.pdbfile, but Visual Studio sees that it's not good and carries on looking.)

(我尝试创建一个空RTSUltraMonHookX32.pdb文件,但 Visual Studio 发现它不好并继续查找。)

回答by JaredPar

You can't do this in a very fine grained fashion but you can disable automatic symbol loading and then manually choose the symbols to load via the Modules window (Debug -> Windows -> Modules).

您不能以非常细粒度的方式执行此操作,但您可以禁用自动符号加载,然后通过模块窗口(调试 -> 窗口 -> 模块)手动选择要加载的符号。

To Disable Automatic Symbol loading

禁用自动符号加载

  • Tools -> Options -> Debugging -> Symbols
  • Check "Search the above locations only when symbols are loaded manually"
  • 工具 -> 选项 -> 调试 -> 符号
  • 勾选“仅在手动加载符号时搜索上述位置”

回答by Denis Bakharev

Also check that you have no "_NT_SYMBOL_PATH" environment variable. If you have this var symbols will load regardless of VS settings.

还要检查您是否没有“_NT_SYMBOL_PATH”环境变量。如果你有这个 var 符号,无论 VS 设置如何,都会加载。

回答by Calvin1602

From Visual Studio 2010 onwards, you can go to:

从 Visual Studio 2010 开始,您可以访问:

Tools -> Options -> Debugging -> Symbols -> Specify excluded modules

and enter the list of the dlls which take too long to load. I use the full path, given by the Output Window; maybe it accepts wildcards or simple file names.

并输入加载时间过长的 dll 列表。我使用输出窗口给出的完整路径;也许它接受通配符或简单的文件名。

回答by Hugo Nava Kopp

In my case it was because I had set "Enable .Net Source Stepping" to truein

在我的情况,那是因为我已经设置了“启用净源步进”为真

Tools > Options > Debugging > General. 

Rather than setting it to false, I set "Enable Just My Code" to true which automatically set "Enable .Net Source Stepping" to false. It gave me a warning before doing so:

我没有将其设置为 false,而是将“仅启用我的代码”设置为 true,这会自动将“启用 .Net 源步进”设置为 false。在这样做之前它给了我一个警告:

Enabling Just my code automatically disabled .Net framework source stepping

Which suggests Just My Codeand .Net source steppingare mutually exclusive.

这表明Just My Code.Net source stepping相互排斥的

I hope this helps someone.

我希望这可以帮助别人。

回答by adzm

You can also set up symbol server exclusions which will not be attempted to download in HKEY_CURRENT_USER\Software\Microsoft\Symbol Server\Exclusions or possibly also HKEY_LOCAL_MACHINE\Software\Microsoft\Symbol Server\Exclusions or via a .ini file at %WINDIR%\system32\inetsrv\Symsrv.ini (use the header [exclusions] and put each exclusion on its own line). The exclusions are simple pattern matches, so use msxml5.* for example.

您还可以在 HKEY_CURRENT_USER\Software\Microsoft\Symbol Server\Exclusions 或 HKEY_LOCAL_MACHINE\Software\Microsoft\Symbol Server\Exclusions 或通过 %WINDIR%\ 处的 .ini 文件设置不会尝试下载的符号服务器排除项system32\inetsrv\Symsrv.ini(使用标题 [排除] 并将每个排除放在自己的行上)。排除项是简单的模式匹配,因此例如使用 msxml5.*。

回答by Raf

Not only the _NT_SYMBOL_PATHcan cause this behavior, but for me it was the _NT_ALT_SYMBOL_PATHenvironment variable that was causing the delays.

不仅_NT_SYMBOL_PATH会导致这种行为,而且对我来说_NT_ALT_SYMBOL_PATH,导致延迟的是环境变量。

(I believe I added this variable when experimenting with WinDbg)

(我相信我在试验 WinDbg 时添加了这个变量)

回答by Jim Davis

In Visual Studio 2013 Pro, if the Microsoft Symbol Server is checked, VS will attempt to load all symbols on their server, causing a lot of extra time.

在 Visual Studio 2013 Pro 中,如果勾选了 Microsoft Symbol Server,VS 会尝试加载其服务器上的所有符号,造成大量额外时间。

回答by Martin.Martinsson

  • Load all symbol packages from MS website manually, put them on a SSD drive for speed :-)
  • If you have a "_NT_SYMBOL_PATH" environment variable, remove the part "http://msdl.microsoft.com/download/symbols" from "SRVe:\symbols*http://msdl.microsoft.com/download/symbols", so you have only the symbol path where your symbols live preciously downloaded.
  • Now you have support for symbols but they wont be downloaded from MS, but loaded from drive