Added option to not break eachline

This commit is contained in:
obscuren 2014-06-26 10:37:48 +02:00
parent 1268413ba7
commit b3367ec0e3
3 changed files with 20 additions and 14 deletions

View File

@ -208,6 +208,12 @@ ApplicationWindow {
} }
text: "Next" text: "Next"
} }
CheckBox {
id: breakEachLine
objectName: "breakEachLine"
text: "Break each instruction"
checked: true
}
} }
} }

View File

@ -26,7 +26,7 @@ func NewDebuggerWindow(lib *UiLib) *DebuggerWindow {
} }
win := component.CreateWindow(nil) 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} 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 { if !self.Db.done {
self.Db.Q <- true self.Db.Q <- true
} }
self.Db.breakOnInstr = self.win.Root().ObjectByName("breakEachLine").Bool("checked")
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
@ -164,6 +165,7 @@ type Debugger struct {
N chan bool N chan bool
Q chan bool Q chan bool
done, interrupt bool done, interrupt bool
breakOnInstr bool
} }
type storeVal struct { 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())}) d.win.Root().Call("setStorage", storeVal{fmt.Sprintf("% x", key), fmt.Sprintf("% x", node.Str())})
}) })
out: if d.breakOnInstr {
for { out:
select { for {
case <-d.N: select {
break out case <-d.N:
case <-d.Q: break out
d.interrupt = true case <-d.Q:
d.clearBuffers() d.interrupt = true
d.clearBuffers()
return false return false
}
} }
} }

View File

@ -154,10 +154,6 @@ func (gui *Gui) createWindow(comp qml.Object) *qml.Window {
gui.win = win gui.win = win
gui.uiLib.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 return gui.win
} }
func (gui *Gui) setInitialBlockChain() { func (gui *Gui) setInitialBlockChain() {