From f249ccaa89afa3340c3abd8578516b648e633e96 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 10 Jun 2015 16:46:43 +0200 Subject: cmd/evm: implements vm.Environment --- cmd/evm/main.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cmd') diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 561f1a943..599721c89 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -104,6 +104,7 @@ type VMEnv struct { depth int Gas *big.Int time int64 + logs []vm.StructLog } func NewEnv(state *state.StateDB, transactor common.Address, value *big.Int) *VMEnv { @@ -133,6 +134,12 @@ func (self *VMEnv) GetHash(n uint64) common.Hash { } return common.Hash{} } +func (self *VMEnv) AddStructLog(log vm.StructLog) { + self.logs = append(self.logs, log) +} +func (self *VMEnv) StructLogs() []vm.StructLog { + return self.logs +} func (self *VMEnv) AddLog(log *state.Log) { self.state.AddLog(log) } -- cgit v1.2.3 From 5cfae0536f8499634c2fa2eba9a71fec1c0d417b Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 10 Jun 2015 21:09:12 +0200 Subject: cmd/evm: print trace when running programs --- cmd/evm/main.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmd') diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 599721c89..7c9d27fac 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -59,6 +59,7 @@ func main() { logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.LogLevel(*loglevel))) + vm.Debug = true db, _ := ethdb.NewMemDatabase() statedb := state.New(common.Hash{}, db) sender := statedb.CreateAccount(common.StringToAddress("sender")) @@ -80,6 +81,8 @@ func main() { fmt.Println(string(statedb.Dump())) } + vm.StdErrFormat(vmenv.StructLogs()) + var mem runtime.MemStats runtime.ReadMemStats(&mem) fmt.Printf("vm took %v\n", time.Since(tstart)) -- cgit v1.2.3 From 9e9bd3555789f069b6cb1950fe329d307f951eab Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 11 Jun 2015 11:44:39 +0200 Subject: cmd/geth: Added optional debug flag for reprocess block --- cmd/geth/admin.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go index 13d10de32..b0b4e0954 100644 --- a/cmd/geth/admin.go +++ b/cmd/geth/admin.go @@ -271,9 +271,12 @@ func (js *jsre) debugBlock(call otto.FunctionCall) otto.Value { } tstart := time.Now() - old := vm.Debug - vm.Debug = true + + if len(call.ArgumentList) > 1 { + vm.Debug, _ = call.Argument(1).ToBoolean() + } + _, err = js.ethereum.BlockProcessor().RetryProcess(block) if err != nil { fmt.Println(err) -- cgit v1.2.3