トレースライブラリとインタラクティブデバッガ¶
トレースライブラリとインタラクティブデバッガの用法です。
トレースライブラリの読み込み¶
トレースライブラリの使用前に tracelib.ring ライブラリを読み込みます。
load "tracelib.ring"
イベントをすべてトレースするには¶
この用例は トレースライブラリの用法としてイベントをすべてトレースするためのデモです。
# イベントをすべてトレース
trace(:AllEvents)
see "Hello, world!" + nl
see "Welcome" + nl
see "How are you?" +nl
mytest()
new myclass { mymethod() }
func mytest
see "Message from mytest" + nl
class myclass
func mymethod
see "Message from mymethod" + nl
関数と制御フローのトレース¶
この用例は関数と制御フローのトレースのデモとしての トレースライブラリの用法です。
Trace(:Functions)
test1()
func test1
see :test1 + nl
test2()
func test2
see :test2 + nl
see test3() + nl
func test3
see :test3 + nl
return "test 3 output"
エラーの渡しかた¶
この用例は トレースライブラリの用法であり、 エラーを渡すためのデモです!
Trace(:PassError)
test1()
func test1
x = 10
see :test1 + nl
test2() # ランタイムエラー!
see "We can continue!"
インタラクティブデバッガ¶
この用例は トレースライブラリの用法であり、 インタラクティブデバッガを使用したデモです。
Trace(:Debugger)
test1()
see "good bye!" + nl
func test1
x = 10
see :test1 + nl
t = 12
test2() # ランタイムエラー!
see "After Error!" +nl
see "t = " see t see nl
see "x = " see x see nl
プログラムを一行ずつ実行¶
この用例は トレースライブラリの用法であり、 プログラムを一行ずつ実行するデモです!
Trace(:LineByLine)
test1()
func test1
x = 10
see :test1 + nl
t = 12
test2()
see "After Error!" +nl
see "t = " + t + nl
ブレークポイント¶
この用例は トレースライブラリのブレークポイントの停止における 用法のデモンストレーションです!
test1()
func test1
x = 10
see :test1 + nl
t = 12
BreakPoint()
see "After breakpoint!" +nl
see "t = " + t + nl
see "End of program!" + nl
ブレークポイントの禁止¶
この用例はトレースライブラリの用法であり、 ブレークポイントを禁止する方法です!
NoBreakPoints()
test1()
func test1
x = 10
see :test1 + nl
t = 12
BreakPoint()
see "After breakpoint!" +nl
see "t = " + t + nl
see "End of program!" + nl
インタラクティブデバッガの用法¶
この用例はブレークポイントをインタラクティブデバッガで開きます!
load "tracelib.ring"
test1()
func test1
x = 10
see :test1 + nl
t = 12
BreakPoint()
see "After breakpoint!" +nl
see "t = " + t + nl
see "End of program!" + nl
スクリーンショット:
インタラクティブデバッガでブレークポイントを操作できます!

変数の値を表示できます。

変数値の変更後に実行を継続できます。

実行結果ウィンドウでもインタラクティブデバッガを操作できます。
