2009-04-18 102 views

回答

8

SMLNJ faq的第3.3節:

問:是否有SML/NJ調試器? 發生過什麼Tolmach的 調試器SML/NJ 0.93?

答:簡短的回答是否定的。

Also:

Debugging SML 

    * For years, no one had an SML debugger 

    * Why? 
      o No one had any bugs? 
      o It is hard to write a debugger for SML 
      o The user community wasn’t large enough 

    * Likely all three are true 

a .NET compiler,雖然號稱有一些調試的支持..

10

目前還沒有任何基於STEP的調試器。

您可以通過以下操作獲得堆棧回溯:

- CM.make "$smlnj-tdp/back-trace.cm"; 
[library $smlnj-tdp/back-trace.cm is stable] 
[library $smlnj-tdp/plugins.cm is stable] 
[library $SMLNJ-LIB/Util/smlnj-lib.cm is stable] 
[library $smlnj/compiler/current.cm is stable] 
[library $smlnj/compiler/x86.cm is stable] 
[library $smlnj/viscomp/core.cm is stable] 
[library $smlnj/viscomp/parser.cm is stable] 
[library $smlnj/viscomp/basics.cm is stable] 
[library $smlnj/viscomp/elaborate.cm is stable] 
[library $smlnj/viscomp/elabdata.cm is stable] 
[library $smlnj/MLRISC/MLRISC.cm is stable] 
[library $SMLNJ-MLRISC/MLRISC.cm is stable] 
[library $Lib.cm(=$SMLNJ-MLRISC)/Lib.cm is stable] 
[library $Control.cm(=$SMLNJ-MLRISC)/Control.cm is stable] 
[library $Graphs.cm(=$SMLNJ-MLRISC)/Graphs.cm is stable] 
[library $smlnj/MLRISC/Control.cm is stable] 
[library $smlnj/viscomp/debugprof.cm is stable] 
[library $smlnj/viscomp/execute.cm is stable] 
[library $smlnj/internal/smlnj-version.cm is stable] 
[library $smlnj/viscomp/x86.cm is stable] 
[New bindings added.] 
val it = true : bool 
- SMLofNJ.Internals.TDP.mode := true; 
[autoloading] 
[autoloading done] 
val it =() : unit 
- 

然後,您可以加載一些代碼,而不是隻打印例外,你會得到一個模擬棧回溯。按照上述步驟進行操作後,您必須重新編譯代碼,否則這將不起作用!

- exception Foo; 
exception Foo 
- fun otherFun() = raise Foo; 
val otherFun = fn : unit -> 'a 
- fun raiseAtZero(n) = if (n > 0) then raiseAtZero(n-1) else otherFun(); 
val raiseAtZero = fn : int -> 'a 
- raiseAtZero 10; 
stdIn:9.1-9.15 Warning: type vars not generalized because of 
    value restriction are instantiated to dummy types (X1,X2,...) 

*** BACK-TRACE *** 
GOTO stdIn:7.5-7.27: otherFun[2] 
      (from: stdIn:8.60-8.70: raiseAtZero[2]) 
CALL-(stdIn:8.5-8.70: raiseAtZero[2] 
      (from: stdIn:9.1-9.15: it) 
GOTO stdIn:5.5-5.27: otherFun[2] 
      (from: stdIn:6.60-6.70: raiseAtZero[2]) 
CALL-(stdIn:6.5-6.70: raiseAtZero[2] 
      (from: stdIn:6.71-6.86: it) 

uncaught exception Foo 
    raised at: stdIn:7.24-7.27 
- 
2

Poly/ML是最好的未知執行標準ML的。它從早期開始就有一個命令行調試器(至少在20世紀90年代)。最近,它已通過Isabelle/PIDE獲得了完整的IDE支持,例如,請參閱ML,其中還包括源代碼級調試器。

相關問題