(************************************************************ exception_trace.ml Created : Fri Nov 21 10:54:26 2003 Last modified: Fri Nov 21 11:12:02 2003 Compile: ocamlc -g exception_trace.ml -o exception_trace # FTP Directory: sources/ocaml # ************************************************************) (* http://pauillac.inria.fr/~aschmitt/cwn/2002.01.08.html#3 例外が発生したときにどこから例外が投げられたのかを見る。 ocaml -g でコンパイルする かつ、 バイトコードを ocmalrun -b で実行する aki|10:59|~/test> ocamlc -g exception_trace.ml -o exception_trace aki|11:03|~/test> ocamlrun -b ./exception_trace Fatal error: exception Not_found Raised at file "exception_trace.ml", line 21, character 26 Called from file "exception_trace.ml", line 26, character 12 *) let i () = raise Not_found let h () = i () let g () = h () let f () = g () let _ = f ()