From 3ebcf92b423e67b58a72a3fc126449e4e97bc4c8 Mon Sep 17 00:00:00 2001 From: dm4 Date: Fri, 6 Apr 2018 18:43:36 +0800 Subject: cmd/evm: print vm output when debug flag is on (#16326) --- core/vm/logger.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core') diff --git a/core/vm/logger.go b/core/vm/logger.go index 4c820d8b5..dde1903bf 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -45,6 +45,7 @@ type LogConfig struct { DisableMemory bool // disable memory capture DisableStack bool // disable stack capture DisableStorage bool // disable storage capture + Debug bool // print output during capture end Limit int // maximum length of output, but zero means unlimited } @@ -184,6 +185,12 @@ func (l *StructLogger) CaptureFault(env *EVM, pc uint64, op OpCode, gas, cost ui func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error { l.output = output l.err = err + if l.cfg.Debug { + fmt.Printf("0x%x\n", output) + if err != nil { + fmt.Printf(" error: %v\n", err) + } + } return nil } -- cgit v1.2.3