英文:
Visual Studio 22 - Asan - Failed to use and restart external symbolizer
问题
我正在尝试为Visual Studio 2022设置Asan地址检查器。我正在按照MS的此指南操作:https://learn.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-170#ide-msbuild
我成功(大部分,我认为是)按照说明操作了。
但是在运行Asan代码时,我收到了以下警告:
==14676==WARNING: Failed to use and restart external symbolizer!
#0 0x7ff67ec8109f in main C:\Users\Vader\source\repos\AsanTest\AsanTest\main.cpp:5
#1 0x7ff67ec81f68 in invoke_main D:\a\_work\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
#2 0x7ff67ec81ebd in __scrt_common_main_seh D:\a\_work\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
#3 0x7ff67ec81d7d in __scrt_common_main D:\a\_work\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:330
#4 0x7ff67ec81fdd in mainCRTStartup D:\a\_work\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:16
#5 0x7ffe54d07613 in BaseThreadInitThunk+0x13 (C:\Windows\System32\KERNEL32.DLL+0x180017613)
#6 0x7ffe563226b0 in RtlUserThreadStart+0x20 (C:\Windows\SYSTEM32\ntdll.dll+0x1800526b0)
说明中提到要执行4个操作:
2. 关闭/RTC1(运行时检查) ✅ 通过右键单击字段并删除值来关闭RTC1。
当我执行“从开发者命令提示符使用AddressSanitizer”时,我没有收到此警告。
测试代码
#include <stdio.h>
int x[100];
int main() {
printf("Hello!\n");
x[100] = 5; // Boom!
return 0;
}
英文:
I am trying to setup Asan Address Sanitizer for Visual Studio 2022. I am following this guide from MS: https://learn.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-170#ide-msbuild
I was able to (mostly, I think) follow the instructions.
But I get this warning when running my code with Asan.
==14676==WARNING: Failed to use and restart external symbolizer!
#0 0x7ff67ec8109f in main C:\Users\Vader\source\repos\AsanTest\AsanTest\main.cpp:5
#1 0x7ff67ec81f68 in invoke_main D:\a\_work\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
#2 0x7ff67ec81ebd in __scrt_common_main_seh D:\a\_work\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
#3 0x7ff67ec81d7d in __scrt_common_main D:\a\_work\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:330
#4 0x7ff67ec81fdd in mainCRTStartup D:\a\_work\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:16
#5 0x7ffe54d07613 in BaseThreadInitThunk+0x13 (C:\Windows\System32\KERNEL32.DLL+0x180017613)
#6 0x7ffe563226b0 in RtlUserThreadStart+0x20 (C:\Windows\SYSTEM32\ntdll.dll+0x1800526b0)
The instructions say to do 4 things:
1. Turn off edit and continue ✅
2. Turn off /RTC1 (runtime checks) ✅ Turned off RTC1 by right clicking on the field and deleting the value.
3. Turn off /INCREMENTAL (incremental linking) ✅
When I do the "Use AddressSanitizer from a developer command prompt" I do not get this warning.
The test code
#include <stdio.h>
int x[100];
int main() {
printf("Hello!\n");
x[100] = 5; // Boom!
return 0;
}
答案1
得分: 2
问题之前已经被提出。
您可以对问题进行投票并留下评论以引起开发人员的注意。
该问题与Visual Studio调试环境相关。在Visual Studio中运行的相同程序会输出警告"Failed to use and restart external symbolizer",但在cmd中不会。
在项目的属性->调试->环境中有以下内容:
PATH=C:\Program Files\Microsoft Visual Studio22\Community\VC\Tools\MSVC.36.32532\bin\HostX86\x86;%PATH%
ASAN_SYMBOLIZER_PATH=C:\Program Files\Microsoft Visual Studio22\Community\VC\Tools\MSVC.36.32532\bin\HostX86\x86
删除这个变量,警告就会消失。
英文:
The problem has been asked before.
You can vote on issues and leave comments to bring developers attention.
The problem is related to the Visual Studio debugging environment. The same program running in visual studio will output a warning Failed to use and restart external symbolizer
,but not on cmd.
There is
PATH=C:\Program Files\Microsoft Visual Studio22\Community\VC\Tools\MSVC.36.32532\bin\HostX86\x86;%PATH%
ASAN_SYMBOLIZER_PATH=C:\Program Files\Microsoft Visual Studio22\Community\VC\Tools\MSVC.36.32532\bin\HostX86\x86
in Project's properties-> Debugging->Environment.
Remove the variable and the warning disappears.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论