[llvm] [Instrumentation] Mark instrumented calls as implicit (PR #106447)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 11:00:53 PDT 2024
vitalybuka wrote:
> This needs to be tested against actual users of this API before it's merged. The example given in the docs (https://clang.llvm.org/docs/SanitizerCoverage.html)
>
> ```c
> extern "C" void __sanitizer_cov_trace_pc_guard(uint32_t *guard) {
> if (!*guard) return; // Duplicate the guard check.
> // If you set *guard to 0 this code will not be called again for this edge.
> // Now you can get the PC and do whatever you want:
> // store it somewhere or symbolize it and print right away.
> // The values of `*guard` are as you set them in
> // __sanitizer_cov_trace_pc_guard_init and so you can make them consecutive
> // and use them to dereference an array or a bit vector.
> void *PC = __builtin_return_address(0);
> char PcDescr[1024];
> // This function is a part of the sanitizer run-time.
> // To use it, link with AddressSanitizer or other sanitizer.
> __sanitizer_symbolize_pc(PC, "%p %F %L", PcDescr, sizeof(PcDescr));
> printf("guard: %p %x PC %s\n", guard, *guard, PcDescr);
> }
> ```
>
> Seems very likely to break (__sanitizer_symbolize_pc will end up finding the line 0 location with the instrumentation sequence in #54873).
I wondering if https://clang.llvm.org/docs/SanitizerCoverage.html#id16 will still work?
https://github.com/llvm/llvm-project/pull/106447
More information about the llvm-commits
mailing list