Add debug code

This commit is contained in:
Masaaki Goshima 2021-03-18 21:48:22 +09:00
parent 141e3992af
commit afef1e7140
1 changed files with 10 additions and 0 deletions

View File

@ -50,6 +50,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
ctxptr := ctx.Ptr()
code := codeSet.Code
defer func() {
if err := recover(); err != nil {
fmt.Println("error occurred", err)
fmt.Println(codeSet.Code.Dump())
fmt.Printf("code = %+v\n", code)
fmt.Println("code.op = ", code.Op, "idx = ", code.DisplayIdx, "p = ", load(ctxptr, code.Idx))
panic(err)
}
}()
for {
switch code.Op {
default: