public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* SanitizerCoverage support
@ 2021-01-19  9:07 Roger Phillips
  2021-01-19 10:23 ` Martin Liška
  0 siblings, 1 reply; 9+ messages in thread
From: Roger Phillips @ 2021-01-19  9:07 UTC (permalink / raw)
  To: gcc

Greetings,

can you tell me if support of SanitizerCoverage is planned for gcc in the foreseeable future?

Regards

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SanitizerCoverage support
  2021-01-19  9:07 SanitizerCoverage support Roger Phillips
@ 2021-01-19 10:23 ` Martin Liška
  2021-01-19 10:33   ` Roger Phillips
  2021-01-19 14:51   ` Roger Phillips
  0 siblings, 2 replies; 9+ messages in thread
From: Martin Liška @ 2021-01-19 10:23 UTC (permalink / raw)
  To: Roger Phillips, gcc

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SanitizerCoverage support
  2021-01-19 10:23 ` Martin Liška
@ 2021-01-19 10:33   ` Roger Phillips
  2021-01-19 10:40     ` Martin Liška
  2021-01-19 14:51   ` Roger Phillips
  1 sibling, 1 reply; 9+ messages in thread
From: Roger Phillips @ 2021-01-19 10:33 UTC (permalink / raw)
  To: Martin Liška, gcc

Excellent! Since which version is this available?

________________________________
From: Martin Liška <mliska@suse.cz>
Sent: Tuesday, January 19, 2021 10:23 AM
To: Roger Phillips <heidegg@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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SanitizerCoverage support
  2021-01-19 10:33   ` Roger Phillips
@ 2021-01-19 10:40     ` Martin Liška
  2021-01-19 11:11       ` Roger Phillips
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Liška @ 2021-01-19 10:40 UTC (permalink / raw)
  To: Roger Phillips, gcc

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 <mliska@suse.cz>
> *Sent:* Tuesday, January 19, 2021 10:23 AM
> *To:* Roger Phillips <heidegg@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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SanitizerCoverage support
  2021-01-19 10:40     ` Martin Liška
@ 2021-01-19 11:11       ` Roger Phillips
  2021-01-20 11:40         ` Martin Liška
  0 siblings, 1 reply; 9+ messages in thread
From: Roger Phillips @ 2021-01-19 11:11 UTC (permalink / raw)
  To: Martin Liška, gcc

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SanitizerCoverage support
  2021-01-19 10:23 ` Martin Liška
  2021-01-19 10:33   ` Roger Phillips
@ 2021-01-19 14:51   ` Roger Phillips
  1 sibling, 0 replies; 9+ messages in thread
From: Roger Phillips @ 2021-01-19 14:51 UTC (permalink / raw)
  To: Martin Liška, gcc

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 <mliska@suse.cz>
Sent: Tuesday, January 19, 2021 10:23 AM
To: Roger Phillips <heidegg@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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SanitizerCoverage support
  2021-01-19 11:11       ` Roger Phillips
@ 2021-01-20 11:40         ` Martin Liška
  2021-01-20 22:50           ` Roger Phillips
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Liška @ 2021-01-20 11:40 UTC (permalink / raw)
  To: Roger Phillips, gcc; +Cc: weixi.wwx

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SanitizerCoverage support
  2021-01-20 11:40         ` Martin Liška
@ 2021-01-20 22:50           ` Roger Phillips
  2021-01-22 13:23             ` Martin Liška
  0 siblings, 1 reply; 9+ messages in thread
From: Roger Phillips @ 2021-01-20 22:50 UTC (permalink / raw)
  To: Martin Liška, gcc; +Cc: weixi.wwx

Would it be possible to replicate the sancov functionality on gcc just through special trace functions?

________________________________
From: Martin Liška <mliska@suse.cz>
Sent: Wednesday, January 20, 2021 11:40 AM
To: Roger Phillips <heidegg@hotmail.com>; gcc@gcc.gnu.org <gcc@gcc.gnu.org>
Cc: weixi.wwx@antfin.com <weixi.wwx@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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SanitizerCoverage support
  2021-01-20 22:50           ` Roger Phillips
@ 2021-01-22 13:23             ` Martin Liška
  0 siblings, 0 replies; 9+ messages in thread
From: Martin Liška @ 2021-01-22 13:23 UTC (permalink / raw)
  To: Roger Phillips, gcc; +Cc: weixi.wwx

On 1/20/21 11:50 PM, Roger Phillips wrote:
> Would it be possible to replicate the sancov functionality on gcc just through special trace functions?

I guess yes.
Please take a look at examples mentioned here:
https://clang.llvm.org/docs/SanitizerCoverage.html#tracing-pcs-with-guards

Martin

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-01-22 13:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19  9:07 SanitizerCoverage support Roger Phillips
2021-01-19 10:23 ` Martin Liška
2021-01-19 10:33   ` Roger Phillips
2021-01-19 10:40     ` Martin Liška
2021-01-19 11:11       ` Roger Phillips
2021-01-20 11:40         ` Martin Liška
2021-01-20 22:50           ` Roger Phillips
2021-01-22 13:23             ` Martin Liška
2021-01-19 14:51   ` Roger Phillips

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).