Hello,

I am writing to inquire about the availability of any
"__sanitizer_cov_trace_basic_block" implementations in gcc. I somewhat
learned from the following mail discussion (
https://gcc.gnu.org/pipermail/gcc-patches/2015-December/437137.html) that
`__sanitizer_cov_trace_basic_block` is provided; however, I cannot find a
implementation here. gcc also does not provide
`-fsanitize-coverage=trace-bb` option for use.

For the user space we may add it to
sanitizer_common/sanitizer_coverage_libcdep.cc,
however for userspace the benefit of having  __sanitizer_cov_trace_pc
is not so big because we already have __sanitizer_cov_trace_basic_block.
__sanitizer_cov_trace_basic_block has similar functionality but a bit
more hairy implementation in the compiler
and requires an initialization step done at module init, which in the
kernel we don't have.


Currently I want to record all the executed basic blocks and mapped them
back to *GIMPLE basic blocks*. While `__sanitizer_cov_trace_pc` can help to
log the program counter value, that's still not what I want. If I use
`__sanitizer_cov_trace_pc`, I would envision mapping the `pc` value to
assembly basic block info, and then map assembly program basic block back
to GIMPLE basic block. While it could be doable (suppose I disable all
optimization), it seems really clumsy. It seems to me
`__sanitizer_cov_trace_basic_block` allows to pass some parameters and
therefore I guess there is a way to directly pass the GIMPLE basic block id
as the input of `__sanitizer_cov_trace_basic_block`, while I just
cannot find a way of doing so for `__sanitizer_cov_trace_pc`. Am I missing
anything here?

Best,
Shuai

Reply via email to