[英]clang sanitizer callback on error
Is it possible to set some sort of a callback, which will be called when clang sanitizers find an error?是否可以设置某种回调,当 clang 消毒剂发现错误时将调用该回调? I need to print some useful information, such as - test name.
我需要打印一些有用的信息,例如 - 测试名称。
PS Tests are kept/stored as XML files, not in C++, that is why stack trace won't tell me the failed test name. PS 测试作为 XML 文件保存/存储,而不是在 C++ 中,这就是堆栈跟踪不会告诉我失败的测试名称的原因。
There are __sanitizer_set_death_callback
and __asan_set_error_report_callback
(declared in asan_interface.h ).有
__sanitizer_set_death_callback
和__asan_set_error_report_callback
(在asan_interface.h 中声明)。
Also as pointed by willir, it may be enough to just run with ASAN_OPTIONS=abort_on_error=1
.同样正如 willir 所指出的那样,仅使用
ASAN_OPTIONS=abort_on_error=1
运行可能就足够了。 This will cause Asan to call abort
on error and many unit testing frameworks can then skip failing test and continue execution.这将导致 Asan 在出错时调用
abort
,然后许多单元测试框架可以跳过失败的测试并继续执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.