스택 오버 플로우를위한 OCaml 스택 트레이스가 잘립니다. 오류는 스택 오버 플로우 (최종 f5()
failwith "Oops"
에 변경이 하지 때 스택 트레이스스택 오버플로 후에 OCaml에서 완성되지 않은 스택 추적을 어떻게 얻을 수 있습니까?
let rec f0() = 1 + f1()
and f1() = 1 + f2()
and f2() = 1 + f3()
and f3() = 1 + f4()
and f4() = 1 + f5()
and f5() = 1 + f5()
let _ =
Printexc.record_backtrace true;
f0()
Fatal error: exception Stack overflow
Raised by primitive operation at file "stackoverflow.ml", line 6, characters 20-25
Called from file "stackoverflow.ml", line 6, characters 20-25
…
Called from file "stackoverflow.ml", line 6, characters 20-25
대비 : 예를 들어, 다음 프로그램은 아래와 스택 트레이스를 생성
Fatal error: exception Failure("Oops")
Raised at file "pervasives.ml", line 30, characters 22-33
Called from file "stackoverflow.ml", line 6, characters 20-35
Called from file "stackoverflow.ml", line 5, characters 20-25
Called from file "stackoverflow.ml", line 4, characters 20-25
Called from file "stackoverflow.ml", line 3, characters 20-25
Called from file "stackoverflow.ml", line 2, characters 20-25
Called from file "stackoverflow.ml", line 1, characters 20-25
Called from file "stackoverflow.ml", line 10, characters 2-7
OCaml이 스택 트레이스를 자르지 않게하려면 어떻게해야합니까?