mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
core/vm: removed own concoction of a mem dumper
Replaced custom implementation of memory dumper with hex.Dump which outputs exact same information as hexdump -C.
This commit is contained in:
parent
4e5ae46e74
commit
c7e04bf4c3
2 changed files with 4 additions and 18 deletions
|
|
@ -1 +1,3 @@
|
|||
push "hello"
|
||||
push 0
|
||||
mstore
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
"unicode"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
|
@ -183,24 +183,8 @@ func StdErrFormat(logs []StructLog) {
|
|||
fmt.Fprintf(os.Stderr, "%04d: %x\n", len(log.Stack)-i-1, common.LeftPadBytes(log.Stack[i].Bytes(), 32))
|
||||
}
|
||||
|
||||
const maxMem = 10
|
||||
addr := 0
|
||||
fmt.Fprintln(os.Stderr, "MEM =", len(log.Memory))
|
||||
for i := 0; i+16 <= len(log.Memory) && addr < maxMem; i += 16 {
|
||||
data := log.Memory[i : i+16]
|
||||
str := fmt.Sprintf("%04d: % x ", addr*16, data)
|
||||
for _, r := range data {
|
||||
if r == 0 {
|
||||
str += "."
|
||||
} else if unicode.IsPrint(rune(r)) {
|
||||
str += fmt.Sprintf("%s", string(r))
|
||||
} else {
|
||||
str += "?"
|
||||
}
|
||||
}
|
||||
addr++
|
||||
fmt.Fprintln(os.Stderr, str)
|
||||
}
|
||||
fmt.Fprintln(os.Stderr, hex.Dump(log.Memory))
|
||||
|
||||
fmt.Fprintln(os.Stderr, "STORAGE =", len(log.Storage))
|
||||
for h, item := range log.Storage {
|
||||
|
|
|
|||
Loading…
Reference in a new issue