On Fri, Aug 7, 2020 at 8:35 AM Shuai Wang via Gcc <gcc@gcc.gnu.org> wrote: > > Hello! > > I am working on a ARM GCC plugin which instruments each GIMPLE function > with some new function calls. > > Currently I want to skip certain functions by adding the > no_instrument_function attribute. However, I do see that in the > disassembled code, all functions are still instrumented. > > Am I missed anything here? From this page ( > https://www.keil.com/support/man/docs/armcc/armcc_chr1359124976163.htm), I > do see that no_instrument_function is used to skip --gnu_instrument, but > might not be applicable to my case where I use the following command to > compile: > > arm-none-eabi-g++ -fplugin=my_plugin.so -mcpu=cortex-m4 -mthumb > -mfloat-abi=soft -Og -fmessage-length=0 -fsigned-char -ffunction-sections > -fdata-sections -fno-move-loop-invariants -Wall -Wextra -g3 -DDEBUG > -DUSE_FULL_ASSERT -DOS_USE_SEMIHOSTING -DTRACE -DOS_USE_TRACE_SEMIH > OSTING_DEBUG -DSTM32F429xx -DUSE_HAL_DRIVER -DHSE_VALUE=8000000 > -DLOS_KERNEL_DEBUG_OUT > > But overall, could anyone shed some lights on: 1) how to skip instrument > certain functions with GCC plugin? 2: is it possible to check the function > attribute in GIMPLE code? If so, I can simply check if certain functions > are marked as "no_instrument_function" and skip by myself.
You can check lookup_attribute("no_instrument_function", DECL_ATTRIBUTES (cfun->decl)) > Thank you! > Shuai