07/09/10 22:48:15 5JM4Hlqf
>> 546
再コンパイルなら以下。再コンパイルしたくないならしらん。
--- preload.c ---
#include <stdio.h>
void __attribute__((no_instrument_function)) __cyg_profile_func_enter(void *this, void *callsite)
{
printf("+ [%p]\n", this);
}
void __attribute__((no_instrument_function)) __cyg_profile_func_exit(void *this, void *callsite)
{
printf("- [%p]\n", this);
}
--------------
(1) LD_PRELOAD用の共有ファイル作る。
$ gcc -shared -fPIC -Wall -o libpreload.so preload.c
(2)トレースしたいバイナリを-finstrument-functionsつきでコンパイルしとく。
(3)トレースとる。
$ LD_PRELOAD=./preload.so target_binary