Oracle® Solaris Studio 12.4: dbx コマンドによるデバッグ

印刷ビューの終了

更新: 2015 年 1 月
 
 

呼び出しのトレース

プログラムがコアダンプで停止し、そこに至るまでの呼び出しのシーケンスを見つけることが必要になる場合があります。このシーケンスをスタックトレースといいます。

where コマンドは、プログラムフロー内のどこで実行が停止し、実行がどのようにしてこの位置に到達したか、つまり呼び出されたルーチンのスタックトレースを表示します。

ShowTrace.f は、スタックトレースを表示するために、呼び出しシーケンス内の数レベル深い位置までコアダンプを取得するように記述されたプログラムです。

Note the reverse order:
demo% f77 -silent -g ShowTrace.f
demo% a.out
MAIN called calc, calc called calcb.
*** TERMINATING a.out
*** Received signal 11 (SIGSEGV)
Segmentation Fault (core dumped)
quil 174% dbx a.out
Execution stopped, line 23
Reading symbolic information for a.out
...
(dbx) run
calcB called from calc, line 9
Running: a.out
(process id 1089)
calc called from MAIN, line 3
signal SEGV (no mapping at the fault address) in calcb at line 23 in file "ShowTrace.f"
   23                   v(j) = (i * 10)
(dbx) where -V
=>[1] calcb(v = ARRAY , m = 2), line 23 in "ShowTrace.f"
  [2] calc(a = ARRAY , m = 2, d = 0), line 9 in "ShowTrace.f"
  [3] MAIN(), line 3 in "ShowTrace.f"
(dbx)
Show the sequence of calls, starting at where the execution stopped: