|
|
@ -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} |
|
|
|
db := &Debugger{win, make(chan bool), make(chan bool), true, false} |
|
|
|
|
|
|
|
|
|
|
|
return &DebuggerWindow{engine: engine, win: win, lib: lib, Db: db} |
|
|
|
return &DebuggerWindow{engine: engine, win: win, lib: lib, Db: db} |
|
|
|
} |
|
|
|
} |
|
|
@ -60,6 +60,12 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data |
|
|
|
self.Db.Q <- true |
|
|
|
self.Db.Q <- true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer func() { |
|
|
|
|
|
|
|
if r := recover(); r != nil { |
|
|
|
|
|
|
|
self.Logf("compile FAULT: %v", r) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}() |
|
|
|
|
|
|
|
|
|
|
|
data := ethutil.StringToByteFunc(dataStr, func(s string) (ret []byte) { |
|
|
|
data := ethutil.StringToByteFunc(dataStr, func(s string) (ret []byte) { |
|
|
|
slice := strings.Split(dataStr, "\n") |
|
|
|
slice := strings.Split(dataStr, "\n") |
|
|
|
for _, dataItem := range slice { |
|
|
|
for _, dataItem := range slice { |
|
|
@ -131,7 +137,11 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data |
|
|
|
|
|
|
|
|
|
|
|
state.Reset() |
|
|
|
state.Reset() |
|
|
|
|
|
|
|
|
|
|
|
self.Db.done = true |
|
|
|
if !self.Db.interrupt { |
|
|
|
|
|
|
|
self.Db.done = true |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
self.Db.interrupt = false |
|
|
|
|
|
|
|
} |
|
|
|
}() |
|
|
|
}() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -149,10 +159,10 @@ func (self *DebuggerWindow) Next() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type Debugger struct { |
|
|
|
type Debugger struct { |
|
|
|
win *qml.Window |
|
|
|
win *qml.Window |
|
|
|
N chan bool |
|
|
|
N chan bool |
|
|
|
Q chan bool |
|
|
|
Q chan bool |
|
|
|
done bool |
|
|
|
done, interrupt bool |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type storeVal struct { |
|
|
|
type storeVal struct { |
|
|
@ -185,7 +195,8 @@ out: |
|
|
|
case <-d.N: |
|
|
|
case <-d.N: |
|
|
|
break out |
|
|
|
break out |
|
|
|
case <-d.Q: |
|
|
|
case <-d.Q: |
|
|
|
d.done = true |
|
|
|
d.interrupt = true |
|
|
|
|
|
|
|
d.clearBuffers() |
|
|
|
|
|
|
|
|
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
@ -194,6 +205,19 @@ out: |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (d *Debugger) clearBuffers() { |
|
|
|
|
|
|
|
out: |
|
|
|
|
|
|
|
// drain
|
|
|
|
|
|
|
|
for { |
|
|
|
|
|
|
|
select { |
|
|
|
|
|
|
|
case <-d.N: |
|
|
|
|
|
|
|
case <-d.Q: |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break out |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (d *Debugger) Next() { |
|
|
|
func (d *Debugger) Next() { |
|
|
|
if !d.done { |
|
|
|
if !d.done { |
|
|
|
d.N <- true |
|
|
|
d.N <- true |
|
|
|