阻止 Visual Studio 尝试加载特定 DLL 的符号
我已将 Visual Studio 2005 设置为使用 Microsoft 的符号服务器。 我还安装了 UltraMon,它将钩子 DLL 注入每个进程。 每当我开始调试我的 MFC 应用程序时,Visual Studio 都会说:
"Loading symbols for C:\Program Files\UltraMon\RTSUltraMonHookX32.dll..."
从眨眼到几十秒。 它永远不会找到那些符号......我可以告诉它不要费心寻找吗?
(我尝试创建一个空的 RTSUltraMonHookX32.pdb
文件,但 Visual Studio 发现它不好并继续查找。)
I have Visual Studio 2005 set up to use Microsoft's symbol servers. I also have UltraMon installed, which injects a hook DLL into every process. Whenever I start debugging my MFC application, Visual Studio says:
"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.pdb
file, but Visual Studio sees that it's not good and carries on looking.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
您无法以非常细粒度的方式执行此操作,但您可以禁用自动符号加载,然后通过“模块”窗口(调试 -> Windows -> 模块)手动选择要加载的符号。
禁用自动符号加载
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
另请检查您是否没有“_NT_SYMBOL_PATH”环境变量。 如果你有这个 var 符号,无论 VS 设置如何都会加载。
Also check that you have no "_NT_SYMBOL_PATH" environment variable. If you have this var symbols will load regardless of VS settings.
从 Visual Studio 2010 开始,您可以转到:
并输入加载时间过长的 dll 列表。 我使用输出窗口给出的完整路径; 也许它接受通配符或简单的文件名。
From Visual Studio 2010 onwards, you can go to:
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.
就我而言,这是因为我已将“启用 .Net 源步进”设置为 true,而
不是将其设置为 false,而是将“仅启用我的代码”设置为 true,这会自动设置“启用 .Net”源步进”为 false。 在这样做之前,它给了我一个警告:
这表明
Just My Code
和.Net 源代码步进
是互斥的。我希望这可以帮助别人。
In my case it was because I had set "Enable .Net Source Stepping" to true in
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:
Which suggests
Just My Code
and.Net source stepping
are mutually exclusive.I hope this helps someone.
如果你进入调试选项-> 符号然后选中“仅加载指定的符号”,它不会自动加载符号并且调试器工作没有问题。
If you go to Debug Options -> Symbols and then check "load only specified symbols" , it won't load symbols automatically and the debugger works without problem.
您还可以在 HKEY_CURRENT_USER\Software\Microsoft\Symbol Server\Exclusions 或 HKEY_LOCAL_MACHINE\Software\Microsoft\Symbol Server\Exclusions 中或通过位于 %WINDIR%\ 的 .ini 文件中设置不会尝试下载的符号服务器排除项。 system32\inetsrv\Symsrv.ini(使用标题 [exclusions] 并将每个排除项放在自己的行上)。 排除是简单的模式匹配,因此请使用 msxml5.* 例如。
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.
不仅
_NT_SYMBOL_PATH
会导致这种行为,而且对我来说,是_NT_ALT_SYMBOL_PATH
环境变量导致了延迟。(我相信我在尝试 WinDbg 时添加了这个变量)
Not only the
_NT_SYMBOL_PATH
can cause this behavior, but for me it was the_NT_ALT_SYMBOL_PATH
environment variable that was causing the delays.(I believe I added this variable when experimenting with WinDbg)
在Visual Studio 2013 Pro中,如果选中了Microsoft Symbol Server,VS将尝试加载其服务器上的所有符号,从而导致大量额外时间。
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.
VS 2022:看看工具 -> 选项-> 调试-> 输出窗口-> 常规输出设置。
提供对发出的信息的精细控制。
为我的项目做了这个技巧,甚至在 Docker 中从 VS 调试时也受到尊重。
VS 2022: Have a look at Tools -> Options -> Debugging -> Output Window -> General Output Settings.
Offers granular Control over the emitted nessages.
Did the trick for my project, and is even respected when debugging from VS in Docker.