no_instrument_function attribute ignored by -Os
Groleo Marius
groleo@gmail.com
Wed Jul 7 08:02:00 GMT 2010
Hi,
I tried using -finstrument-functions and -Os flags at the same time but
the compiled test program segfaults due to recursive calls:
$> gcc -g -Os -finstrument-functions ptrace.c && ./a.out
Segmentation fault (core dumped)
$> gdb a.out core
#0 0x080485b7 in __cyg_profile_func_enter (this_fn=0x80485a2,
call_site=0x80485bc) at ptrace.c:15
#1 0x080485bc in __cyg_profile_func_enter (this_fn=0x80485a2,
call_site=0x80485bc) at ptrace.c:15
#2 0x080485bc in __cyg_profile_func_enter (this_fn=0x80485a2,
call_site=0x80485bc) at ptrace.c:15
#3 0x080485bc in __cyg_profile_func_enter (this_fn=0x80485a2,
call_site=0x80485bc) at ptrace.c:15
#4 0x080485bc in __cyg_profile_func_enter (this_fn=0x80485a2,
call_site=0x80485bc) at ptrace.c:15
I disabled function instrumentation for __cyg_profile_func_enter using
__attribute__ ((no_instrument_function))
but it looks like it's ignored.
Does -Os behavior specifically ignores the 'no_instrument_function' attribute ?
Taking -Os out makes it work:
$> gcc -g -finstrument-functions ptrace.c && ./a.out
enter 0x8048552
enter 0x804851f
enter 0x80484ec
enter 0x80484be
exit 0x80484be
exit 0x80484ec
exit 0x804851f
enter 0x80484be
exit 0x80484be
exit 0x8048552
--
Regards!
http://groleo.wordpress.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ptrace.c
Type: text/x-csrc
Size: 633 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20100707/5eafd3b9/attachment.bin>
More information about the Gcc
mailing list