私はCバイナリファイル(ソースコードが利用可能)と事前定義された作業負荷を持っています。私は、すべての関数呼び出しとそのそれぞれのパラメータ、および戻り値を呼び出し順に記録したい。例えば、以下のコードで:各C関数呼び出しのすべてのパラメータ値を記録します
int myfunc(int value){
return value*2;
}
int main(void){
int i;
i = myfunc(10);
i = myfunc(12);
i = myfunc(20);
return 0;
}
それは、このようなログファイルになりshoud:
int main()
int myfunc(10)
myfunc return 20
int myfunc(12)
myfunc return 24
int myfunc(21)
myfunc return 42
main return 0
を私はすでにそれを行うにはインテルPINを使用しようとした、そしてそれは非常にうまく機能ただし、変数がポインタ、配列、構造体またはtypedefの場合は例外です。私はすべての変数が必要です。
私はソースコードを持っており、デバッグオプションを使用してコンパイルできます。
アイデア?
P.S.私の実際の作業負荷は90種類の機能から約5000回の呼び出しを持つため、手動でデバッグすることは不可能です。
編集:
(gdb) help command
Set commands to be executed when a breakpoint is hit.
Give breakpoint number as argument after "commands".
With no argument, the targeted breakpoint is the last one set.
The commands themselves follow starting on the next line.
Type a line containing "end" to indicate the end of them.
Give "silent" as the first line to make the breakpoint silent;
then no output is printed when it is hit, except what the commands print.
チェックアウト私のアプローチ:OSは、あなたが実行時にブレークポイント「イベント」を使用して関数呼び出しとその戻り値を追跡するためgdb
を使用することができますアーチのLinuxの64ビット
[Systemtap](https://sourceware.org/systemtap/)の1つのオプションがあります。あなたのOSは指定されていませんが、SystemtapはLinux用です。 – kaylum
Tks @kaylum、Systemtapを試して、動作すればここに投稿します。 – William