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 <mli...@suse.cz>
Sent: Tuesday, January 19, 2021 10:23 AM
To: Roger Phillips <heid...@hotmail.com>; gcc@gcc.gnu.org <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

Reply via email to