forked from TrueCloudLab/neoneo-go
compiler: quick and dirty inspection fix for JMP instrs
These were interpreted completely wrong, they actually have two next bytes indicating an offset. This patch is a quick fix, actually more work is needed here to properly display various instructions.
This commit is contained in:
parent
1a4055a962
commit
7cd91610df
1 changed files with 6 additions and 0 deletions
|
@ -122,6 +122,12 @@ func CompileAndInspect(src string) error {
|
|||
}
|
||||
fmt.Fprintf(w, "%d\t0x%x\t%s\t\n", i, b[i], instr)
|
||||
i++
|
||||
if instr == vm.JMP || instr == vm.JMPIF || instr == vm.JMPIFNOT || instr == vm.CALL {
|
||||
for x := 0; x < 2; x++ {
|
||||
fmt.Fprintf(w, "%d\t0x%x\t%d\t\n", i, b[i + x], b[i + x])
|
||||
}
|
||||
i += 2
|
||||
}
|
||||
}
|
||||
w.Flush()
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue