4

I'm trying to use __cyg_profile_func_* with -finstrument-functions to do specific checks before and after functions run (eg, to check for Mach port leaks and such). This is on OS X.

The code is written and functional, but I have a ton of undefined references to, for example,

std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::init(std::__1::basic_streambuf<wchar_t, std::__1::char_traits<wchar_t> >*) 

It seems like perhaps some sort of inlining is taking place, but the instrumentation is still trying to reference a non-inlined version of the function. Is it possible to exempt the standard C++ library from instrumentation? Or, possible to completely disable inlining in clang for this particular circumstance?

Cheers!

1
  • I'm having the exactly same problem. It seems like enabling -finstrument-functions makes clang unable to link against libc++ :/ Commented Nov 11, 2013 at 16:40

2 Answers 2

0

In gcc,-finstrument-functions-exclude-file-list=stdlib/include would do what you want. However, it is not implemented in clang yet (at least trunk doesn't recognize this option).

Sign up to request clarification or add additional context in comments.

Comments

0

Clang has an option -finstrument-functions-after-inlining which will work in this case. yes it is unfortunate clang does not support disabling instrumentation on a file/directory basis. If instrumentation is too much trouble then changing the source code of standard C++ library to add attributes may help as well. See: https://stackoverflow.com/a/69474100/811335

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.