简体   繁体   English

clang 消毒剂错误回调

[英]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.

相关问题 当clang-sanitizer发现错误时,如何终止clang-instrumented程序? - How to terminate clang-instrumented program when clang-sanitizer finds an error? 在Windows上使用-faddress-sanitizer进行操作 - Clang with -faddress-sanitizer on Windows 我怎么应该在铿锵声中使用消毒杀菌剂? - How I'm supposed to use the sanitizer in clang? 如果只有主应用程序是用 clang 编译的,可以使用 clang Address Sanitizer 吗? - Can clang Address Sanitizer be used if only main application was compiled with clang? 为什么ulimit -v不能在clang的地址清洁剂下工作? - why does ulimit -v not work under clang's address sanitizer? 指针数组中的转换和写入报告使用clang消毒器的地址未对齐 - Casting and writing in pointer array reports misaligned address with clang sanitizer 使用Clang的“未定义”消毒剂时未定义符号 - Undefined symbols when using Clang's “undefined” sanitizer clang++ 内存清理器报告未初始化值的使用 - clang++ memory sanitizer reports use-of-uninitialized-value 使用Clang的UB消毒剂构建的程序的额外输出 - Additional output from program built with the UB sanitizer of Clang 为什么 clang 消毒剂认为这个无符号数的左移是未定义的? - Why does the clang sanitizer think this left shift of an unsigned number is undefined?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM