http://www.katdc.com/kosforum/download.htm
http://blog.linux.org.tw/~jserv/archives/001870.html
http://www-128.ibm.com/developerworks/cn/linux/l-graphvis/
http://www.study-area.org/cyril/opentools/opentools/gcc.html
透過 GCC Function instrumentation 的機制。該機制出現於 GCC 2.x
#include <stdio.h>
#define DUMP(func, call) \
printf("%s: func = %p, called by = %p\n", __FUNCTION__, func, call)
void __attribute__((__no_instrument_function__))
__cyg_profile_func_enter(void *this_func, void *call_site)
{
DUMP(this_func, call_site);
}
void __attribute__((__no_instrument_function__))
__cyg_profile_func_exit(void *this_func, void *call_site)
{
DUMP(this_func, call_site);
}
main()
{
puts("Hello World!");
return 0;
}
編譯與執行:$ gcc -finstrument-functions hello.c -o hello
$ ./hello
__cyg_profile_func_enter: func = 0x8048468, called by = 0xb7e36ebc
Hello World!
__cyg_profile_func_exit: func = 0x8048468, called by = 0xb7e36ebc
沒有留言:
張貼留言