From d3e31a4a6db6166b0639f0e9be5f70d5035baeeb Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 11 Jul 2014 16:04:27 +0200 Subject: [PATCH] Special diff output + debugger changes --- ethereal/assets/debugger/debugger.qml | 2 +- ethereal/debugger.go | 13 +++++++++++-- ethereum/flags.go | 2 ++ ethereum/main.go | 8 ++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index f204647c8..4d01ea183 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -116,7 +116,7 @@ ApplicationWindow { id: compileTimer interval: 500 ; running: true ; repeat: true onTriggered: { - dbg.compile(codeEditor.text) + dbg.autoComp(codeEditor.text) } } } diff --git a/ethereal/debugger.go b/ethereal/debugger.go index 64ca316f8..997c2e8dd 100644 --- a/ethereal/debugger.go +++ b/ethereal/debugger.go @@ -74,6 +74,13 @@ func (self *DebuggerWindow) Compile(code string) { } } +// Used by QML +func (self *DebuggerWindow) AutoComp(code string) { + if self.Db.done { + self.Compile(code) + } +} + func (self *DebuggerWindow) ClearLog() { self.win.Root().Call("clearLog") } @@ -110,8 +117,6 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data return } - self.SetAsm(script) - var ( gas = ethutil.Big(gasStr) gasPrice = ethutil.Big(gasPriceStr) @@ -257,6 +262,10 @@ func (self *Debugger) StepHook(pc int, op ethchain.OpCode, mem *ethchain.Memory, return self.halting(pc, op, mem, stack, stateObject) } +func (self *Debugger) SetCode(byteCode []byte) { + self.main.SetAsm(byteCode) +} + func (self *Debugger) BreakPoints() []int64 { return self.breakPoints } diff --git a/ethereum/flags.go b/ethereum/flags.go index d5a9c3a8a..af0fd9a69 100644 --- a/ethereum/flags.go +++ b/ethereum/flags.go @@ -11,6 +11,7 @@ import ( var Identifier string var KeyRing string +var DiffTool bool var KeyStore string var StartRpc bool var RpcPort int @@ -66,6 +67,7 @@ func Init() { flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)") flag.IntVar(&LogLevel, "loglevel", int(ethlog.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") + flag.BoolVar(&DiffTool, "difftool", false, "creates output for diff'ing. Sets LogLevel=0") flag.BoolVar(&StartMining, "mine", false, "start dagger mining") flag.BoolVar(&StartJsConsole, "js", false, "launches javascript console") diff --git a/ethereum/main.go b/ethereum/main.go index e4d73d494..39226c1d2 100644 --- a/ethereum/main.go +++ b/ethereum/main.go @@ -2,6 +2,7 @@ package main import ( "github.com/ethereum/eth-go/ethlog" + "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/go-ethereum/utils" "runtime" ) @@ -20,7 +21,14 @@ func main() { // precedence: code-internal flag default < config file < environment variables < command line Init() // parsing command line + + // If the difftool option is selected ignore all other log output + if DiffTool { + LogLevel = 0 + } + utils.InitConfig(ConfigFile, Datadir, "ETH") + ethutil.Config.Diff = DiffTool utils.InitDataDir(Datadir)