Visual Studio 22 – Asan – 无法使用并重新启动外部符号化程序

huangapple go评论78阅读模式
英文:

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个操作:

0. 启用地址检查器
Visual Studio 22 – Asan – 无法使用并重新启动外部符号化程序

1. 关闭编辑并继续
Visual Studio 22 – Asan – 无法使用并重新启动外部符号化程序

2. 关闭/RTC1(运行时检查) ✅ 通过右键单击字段并删除值来关闭RTC1。
Visual Studio 22 – Asan – 无法使用并重新启动外部符号化程序

3. 关闭/INCREMENTAL(增量链接)
Visual Studio 22 – Asan – 无法使用并重新启动外部符号化程序


当我执行“从开发者命令提示符使用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:

0. Enable Address Sanitizer
Visual Studio 22 – Asan – 无法使用并重新启动外部符号化程序

1. Turn off edit and continue
Visual Studio 22 – Asan – 无法使用并重新启动外部符号化程序

2. Turn off /RTC1 (runtime checks) ✅ Turned off RTC1 by right clicking on the field and deleting the value.
Visual Studio 22 – Asan – 无法使用并重新启动外部符号化程序

3. Turn off /INCREMENTAL (incremental linking)
Visual Studio 22 – Asan – 无法使用并重新启动外部符号化程序


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

问题之前已经被提出。

https://developercommunity.visualstudio.com/t/Fail-to-use-and-restart-external-symbol/10222443?q=+Failed+to+use+and+restart+external+symbolizer

您可以对问题进行投票并留下评论以引起开发人员的注意。

该问题与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.

https://developercommunity.visualstudio.com/t/Fail-to-use-and-restart-external-symbol/10222443?q=+Failed+to+use+and+restart+external+symbolizer

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.

huangapple
  • 本文由 发表于 2023年7月28日 00:01:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76781556.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定