PATCH RFC: More control over which functions are instrumented

Ian Lance Taylor iant@google.com
Wed Aug 1 21:51:00 GMT 2007


"Andrew Pinski" <pinskia@gmail.com> writes:

> On 01 Aug 2007 13:21:25 -0700, Ian Lance Taylor <iant@google.com> wrote:
> > We've had a -finstrument-functions option for a while, which inserts
> > calls to __cyg_profile_func_enter and __cyg_profile_func_exit at the
> > start and end of each function.  This can be handy, but it is rather
> > less handy in practice with C++.  The issue is simply that there are a
> > bunch of inline functions which it is uninteresting to instrument, and
> > these functions come from standard headers so you can't really avoid
> > compiling them with -finstrument-functions.
> 
> I rather have instrumentation done differently than it is now instead
> of these options.  Just have an option to turn off instrumentation for
> functions that get inlined (so the instrumentation happens after
> inlining).  These options help but you still have to maintain a list
> of functions which can get hard to maintain unlike instrumenting after
> inlining.

-finstrument-functions-exclude-function-list is there because it seems
odd to not have it, but the more commonly used option will be
-finstrument-functions-exclude-file-list.  Note that files are matched
as substrings, so you can say
-finstrument-functions-exclude-file-list=include/c++ to exclude any
function defined in a file in ...include/c++...

Turning off instrumentation for functions which are inlined is useful
but it is not the same.  It is reasonable to actually want
instrumentation for inlined functions that you wrote in an optimized
build.

That is, I see the ideas as independent; I don't see why one should
block the other.

Ian



More information about the Gcc-patches mailing list