Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #226 from goccy/feature/refactor-debug-vm
Refactor Debug mode for encoding
- Loading branch information
Showing
11 changed files
with
136 additions
and
5,242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package vm | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/goccy/go-json/internal/encoder" | ||
) | ||
|
||
func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt encoder.Option) ([]byte, error) { | ||
defer func() { | ||
if err := recover(); err != nil { | ||
fmt.Println("=============[DEBUG]===============") | ||
fmt.Println("* [TYPE]") | ||
fmt.Println(codeSet.Type) | ||
fmt.Printf("\n") | ||
fmt.Println("* [ALL OPCODE]") | ||
fmt.Println(codeSet.Code.Dump()) | ||
fmt.Printf("\n") | ||
fmt.Println("* [CONTEXT]") | ||
fmt.Printf("%+v\n", ctx) | ||
fmt.Println("===================================") | ||
panic(err) | ||
} | ||
}() | ||
|
||
return Run(ctx, b, codeSet, opt) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.