まず、システムトレース機能がありますが、アプリケーションから多用していませんが、スレッドセーフです。
http://pic.dhe.ibm.com/infocenter/aix/v6r1/topic/com.ibm.aix.genprogc/doc/genprogc/trace_facility.htm#yg3100thri
と
http://pic.dhe.ibm.com/infocenter/aix/v6r1/topic/com.ibm.aix.genprogc/doc/genprogc/tracing.htm?resultof=%22%61%70%70%6c%69%63%61%74%69%6f%6e%22%20%22%61%70%70%6c%69%63%22%20%22%74%72%61%63%65%22%20
これは非常に複雑なアプリケーションであれば、私は本当のトレースフックを配線し、トレース形式のファイルを開発します。それは費やされる時間の価値があるでしょう。以下は、より重大な方法です。
おそらく私がこれを追跡する方法は、家庭のトレースまたはログ機能を結ぶことです。コードで、ログルーチンへの呼び出しを振りかける。次に、コア・ファイルを調べて、ログ・バッファを調べると、ヒットしたログ・ポイントの順序がわかります。
これは、いくつかのポイントを追加し、コードの特定の部分にもっと多くのポイントが必要であり、ログポイントを追加するという繰り返しプロセスです。再試行する。繰り返す。
ログルーチンは実際には非常に簡単で、原子操作の1つを利用します。私はfetch_and_addを使用しています。あなたのコアファイルを取得し、配列をダンプするとき、あなたはテキストとしても進としてそれをダンプしてできるように
long array[4096]; /* some power of 2 in size is my preference */
unsigned int index; /* int -- not a long */
/* trace 5 words each time. */
void log(long *a, long b, long c, long d, long e)
{
/*
* the 5 equals the number of args. The 4095 is one less than the
* size of the array. You can use mod if you want. Also, note that
* there are flavors of fetch_and_add for different sized
* variables. Pick the one that matches the size of index.
*/
int i = fetch_and_add(&indx, 5) & 4095;
/*
* at this point, array[i] ... array[i+4] have been effectively
* reserved. The time taken between the fetch_and_add and updating
* the array does not need to be atomic or locked. The only
* possible exception is you don't want the log to wrap within this
* time but that would be very unlikely.
*/
array[i] = *a;
array[i+1] = b;
array[i+2] = c;
array[i+3] = d;
array[i+4] = e;
}
/* your original code spinkle calls to log */
int whatever(long arg1, int arg2)
{
log("WHT1", arg1, arg2, 0, 0);
foo = apple + pie;
bar = whisky + good;
dog = nice + pet;
cat = meow;
log("WHT2", foo, bar, log, dog);
/* ... */
}
最初の引数のトリックがあります。テキスト出力から、どのログポイントが呼び出されているかを素早く確認できます。 64ビットアプリケーションを使用している場合、4文字に制限するのではなく、8を使用します。
コアファイルではindexの値が重要です。それはヒットした最後のログポイントを示します。次に、ログ配列を後ろに移動して、前のログポイントを表示します。
グループの下でITtoolbox.comに強力なAIXサポートコミュニティがあります。 (私はそこに財政的関心がない、私は登録ユーザーだけです)。がんばろう。 – shellter