SanitizerCoverage support
Greetings, can you tell me if support of SanitizerCoverage is planned for gcc in the foreseeable future? Regards
Re: SanitizerCoverage support
Excellent! Since which version is this available? From: Martin Liška Sent: Tuesday, January 19, 2021 10:23 AM To: Roger Phillips ; gcc@gcc.gnu.org Subject: Re: SanitizerCoverage support On 1/19/21 10:07 AM, Roger Phillips via Gcc wrote: > Greetings, > > can you tell me if support of SanitizerCoverage is planned for gcc in the > foreseeable future? > > Regards > Hello. We do support it, please see 'man gcc': -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp Martin
Re: SanitizerCoverage support
Oh btw: Does any of these two modes allow me to generate sancov files on function level? My intent is to record program flow, then visualize the diff between the runs. Most examples I see use edge,bb,func modes so I'm not sure trace-pc and trace-pc-cmp are enough. From: Martin Liška Sent: Tuesday, January 19, 2021 10:40 AM To: Roger Phillips ; gcc@gcc.gnu.org Subject: Re: SanitizerCoverage support On 1/19/21 11:33 AM, Roger Phillips wrote: > Excellent! Since which version is this available? Hello. The option -fsanitize-coverage=trace-pc is available since 6.1.0 and -fsanitize-coverage=trace-cmp since 8.1.0. Martin > > -- > *From:* Martin Liška > *Sent:* Tuesday, January 19, 2021 10:23 AM > *To:* Roger Phillips ; gcc@gcc.gnu.org > *Subject:* Re: SanitizerCoverage support > On 1/19/21 10:07 AM, Roger Phillips via Gcc wrote: >> Greetings, >> >> can you tell me if support of SanitizerCoverage is planned for gcc in the >> foreseeable future? >> >> Regards >> > > Hello. > > We do support it, please see 'man gcc': > > -fsanitize-coverage=trace-pc > -fsanitize-coverage=trace-cmp > > Martin
Re: SanitizerCoverage support
I tried -fsanitize-coverage=trace-pc with g++ 7.5.0 on a X64 Ubuntu system. The linker complained that a function __sanitizer_cov_trace_pc was undefined. So I added it in my program like this: extern "C" void __sanitizer_cov_trace_pc() { printf("Address: %p\n", __builtin_return_address(0)); } I then build with g++ -std=c++11 -g -O0 -fsanitize-coverage=trace-pc ./test.cpp -o ./test Unfortunately, the function seems to call itself recursively and finishes with a stack overflow. What do I do wrong? I would also rather use prefabricated functions for sancov. Regards From: Martin Liška Sent: Tuesday, January 19, 2021 10:23 AM To: Roger Phillips ; gcc@gcc.gnu.org Subject: Re: SanitizerCoverage support On 1/19/21 10:07 AM, Roger Phillips via Gcc wrote: > Greetings, > > can you tell me if support of SanitizerCoverage is planned for gcc in the > foreseeable future? > > Regards > Hello. We do support it, please see 'man gcc': -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp Martin
Re: SanitizerCoverage support
Would it be possible to replicate the sancov functionality on gcc just through special trace functions? From: Martin Liška Sent: Wednesday, January 20, 2021 11:40 AM To: Roger Phillips ; gcc@gcc.gnu.org Cc: weixi@antfin.com Subject: Re: SanitizerCoverage support On 1/19/21 12:11 PM, Roger Phillips wrote: > Does any of these two modes allow me to generate sancov files on function > level? My intent is to record program flow, then visualize the diff between > the runs. Most examples I see use edge,bb,func modes so I'm not sure trace-pc > and trace-pc-cmp are enough. I think we likely miss the functionality. I briefly looked at: https://clang.llvm.org/docs/SanitizerCoverage.html and as shown here: https://clang.llvm.org/docs/SanitizerCoverage.html#default-implementation On the other hand, the functionality should be in sanitizer so we may use it. Martin