From b3367ec0e3e69694481cccd9335a63d2c559a543 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 26 Jun 2014 10:37:48 +0200 Subject: [PATCH] Added option to not break eachline --- ethereal/assets/debugger/debugger.qml | 6 ++++++ ethereal/ui/debugger.go | 24 ++++++++++++++---------- ethereal/ui/gui.go | 4 ---- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index 31e0eb7816..6f53697c90 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -208,6 +208,12 @@ ApplicationWindow { } text: "Next" } + CheckBox { + id: breakEachLine + objectName: "breakEachLine" + text: "Break each instruction" + checked: true + } } } diff --git a/ethereal/ui/debugger.go b/ethereal/ui/debugger.go index 9d60c75875..f49741e09b 100644 --- a/ethereal/ui/debugger.go +++ b/ethereal/ui/debugger.go @@ -26,7 +26,7 @@ func NewDebuggerWindow(lib *UiLib) *DebuggerWindow { } win := component.CreateWindow(nil) - db := &Debugger{win, make(chan bool), make(chan bool), true, false} + db := &Debugger{win, make(chan bool), make(chan bool), true, false, true} return &DebuggerWindow{engine: engine, win: win, lib: lib, Db: db} } @@ -59,6 +59,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data if !self.Db.done { self.Db.Q <- true } + self.Db.breakOnInstr = self.win.Root().ObjectByName("breakEachLine").Bool("checked") defer func() { if r := recover(); r != nil { @@ -164,6 +165,7 @@ type Debugger struct { N chan bool Q chan bool done, interrupt bool + breakOnInstr bool } type storeVal struct { @@ -190,16 +192,18 @@ func (d *Debugger) halting(pc int, op ethchain.OpCode, mem *ethchain.Memory, sta d.win.Root().Call("setStorage", storeVal{fmt.Sprintf("% x", key), fmt.Sprintf("% x", node.Str())}) }) -out: - for { - select { - case <-d.N: - break out - case <-d.Q: - d.interrupt = true - d.clearBuffers() + if d.breakOnInstr { + out: + for { + select { + case <-d.N: + break out + case <-d.Q: + d.interrupt = true + d.clearBuffers() - return false + return false + } } } diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index 1037ba5acd..7b59e2fbc6 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -154,10 +154,6 @@ func (gui *Gui) createWindow(comp qml.Object) *qml.Window { gui.win = win gui.uiLib.win = win - db := &Debugger{gui.win, make(chan bool), make(chan bool), true, false} - gui.lib.Db = db - gui.uiLib.Db = db - return gui.win } func (gui *Gui) setInitialBlockChain() {