diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2022-06-13 13:32:53 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2022-06-13 13:35:33 +0200 |
commit | 3b598848f6fdbf7e76eaf2beec1ce94fc3a14b9b (patch) | |
tree | 0689dfb33dff5dfea9006f428831f3a6b4f5e1e6 /gcc/doc | |
parent | cb1ecf3819f19a4fc35468010b66b5c1a7b21ee8 (diff) | |
download | gcc-3b598848f6fdbf7e76eaf2beec1ce94fc3a14b9b.zip gcc-3b598848f6fdbf7e76eaf2beec1ce94fc3a14b9b.tar.gz gcc-3b598848f6fdbf7e76eaf2beec1ce94fc3a14b9b.tar.bz2 |
Introduce -finstrument-functions-once
The goal is to make it possible to use it in (large) production binaries
to do function-level coverage, so the overhead must be minimum and, in
particular, there is no protection against data races so the "once"
moniker is imprecise.
gcc/
* common.opt (finstrument-functions): Set explicit value.
(-finstrument-functions-once): New option.
* doc/invoke.texi (Program Instrumentation Options): Document it.
* gimplify.cc (build_instrumentation_call): New static function.
(gimplify_function_tree): Call it to emit the instrumentation calls
if -finstrument-functions[-once] is specified.
gcc/testsuite/
* gcc.dg/instrument-4.c: New test.
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 174bc09..b6c0305 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -618,7 +618,7 @@ Objective-C and Objective-C++ Dialects}. -fno-stack-limit -fsplit-stack @gol -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol -fvtv-counts -fvtv-debug @gol --finstrument-functions @gol +-finstrument-functions -finstrument-functions-once @gol -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}} @gol -fprofile-prefix-map=@var{old}=@var{new} @@ -16395,6 +16395,22 @@ cannot safely be called (perhaps signal handlers, if the profiling routines generate output or allocate memory). @xref{Common Function Attributes}. +@item -finstrument-functions-once +@opindex -finstrument-functions-once +This is similar to @option{-finstrument-functions}, but the profiling +functions are called only once per instrumented function, i.e. the first +profiling function is called after the first entry into the instrumented +function and the second profiling function is called before the exit +corresponding to this first entry. + +The definition of @code{once} for the purpose of this option is a little +vague because the implementation is not protected against data races. +As a result, the implementation only guarantees that the profiling +functions are called at @emph{least} once per process and at @emph{most} +once per thread, but the calls are always paired, that is to say, if a +thread calls the first function, then it will call the second function, +unless it never reaches the exit of the instrumented function. + @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @opindex finstrument-functions-exclude-file-list |