Special diff output + debugger changes

This commit is contained in:
obscuren 2014-07-11 16:04:27 +02:00
parent c2bca5939d
commit d3e31a4a6d
4 changed files with 22 additions and 3 deletions

View File

@ -116,7 +116,7 @@ ApplicationWindow {
id: compileTimer id: compileTimer
interval: 500 ; running: true ; repeat: true interval: 500 ; running: true ; repeat: true
onTriggered: { onTriggered: {
dbg.compile(codeEditor.text) dbg.autoComp(codeEditor.text)
} }
} }
} }

View File

@ -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() { func (self *DebuggerWindow) ClearLog() {
self.win.Root().Call("clearLog") self.win.Root().Call("clearLog")
} }
@ -110,8 +117,6 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
return return
} }
self.SetAsm(script)
var ( var (
gas = ethutil.Big(gasStr) gas = ethutil.Big(gasStr)
gasPrice = ethutil.Big(gasPriceStr) 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) return self.halting(pc, op, mem, stack, stateObject)
} }
func (self *Debugger) SetCode(byteCode []byte) {
self.main.SetAsm(byteCode)
}
func (self *Debugger) BreakPoints() []int64 { func (self *Debugger) BreakPoints() []int64 {
return self.breakPoints return self.breakPoints
} }

View File

@ -11,6 +11,7 @@ import (
var Identifier string var Identifier string
var KeyRing string var KeyRing string
var DiffTool bool
var KeyStore string var KeyStore string
var StartRpc bool var StartRpc bool
var RpcPort int var RpcPort int
@ -66,6 +67,7 @@ func Init() {
flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file")
flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)") 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.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(&StartMining, "mine", false, "start dagger mining")
flag.BoolVar(&StartJsConsole, "js", false, "launches javascript console") flag.BoolVar(&StartJsConsole, "js", false, "launches javascript console")

View File

@ -2,6 +2,7 @@ package main
import ( import (
"github.com/ethereum/eth-go/ethlog" "github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/utils" "github.com/ethereum/go-ethereum/utils"
"runtime" "runtime"
) )
@ -20,7 +21,14 @@ func main() {
// precedence: code-internal flag default < config file < environment variables < command line // precedence: code-internal flag default < config file < environment variables < command line
Init() // parsing 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") utils.InitConfig(ConfigFile, Datadir, "ETH")
ethutil.Config.Diff = DiffTool
utils.InitDataDir(Datadir) utils.InitDataDir(Datadir)