aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-10 04:04:16 +0800
committerobscuren <geffobscura@gmail.com>2014-06-10 04:04:16 +0800
commitba3623d0cc0608f2d73e10e61a184238924fccdb (patch)
tree288d081c532bc2397809c95497f1e8d23df6cadc
parentcc20b0e3a0754c77fe04a8b5c5668d0eda955bcf (diff)
downloadgo-tangerine-ba3623d0cc0608f2d73e10e61a184238924fccdb.tar
go-tangerine-ba3623d0cc0608f2d73e10e61a184238924fccdb.tar.gz
go-tangerine-ba3623d0cc0608f2d73e10e61a184238924fccdb.tar.bz2
go-tangerine-ba3623d0cc0608f2d73e10e61a184238924fccdb.tar.lz
go-tangerine-ba3623d0cc0608f2d73e10e61a184238924fccdb.tar.xz
go-tangerine-ba3623d0cc0608f2d73e10e61a184238924fccdb.tar.zst
go-tangerine-ba3623d0cc0608f2d73e10e61a184238924fccdb.zip
Fixed debugger hang
-rw-r--r--ethereal/assets/debugger/debugger.qml2
-rw-r--r--ethereal/ui/debugger.go38
-rw-r--r--ethereal/ui/gui.go2
3 files changed, 33 insertions, 9 deletions
diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml
index ca67e857d..bc34233fd 100644
--- a/ethereal/assets/debugger/debugger.qml
+++ b/ethereal/assets/debugger/debugger.qml
@@ -163,7 +163,7 @@ ApplicationWindow {
height: parent.height
width: parent.width
TableViewColumn{ id: key ; role: "key" ; title: "#" ; width: storageTableView.width / 2}
- TableViewColumn{ role: "value" ; title: "value" ; width: storageTableView.width / 2}
+ TableViewColumn{ role: "value" ; title: "Storage" ; width: storageTableView.width / 2}
model: storageModel
}
}
diff --git a/ethereal/ui/debugger.go b/ethereal/ui/debugger.go
index a4489cdf4..919407b34 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}
+ db := &Debugger{win, make(chan bool), make(chan bool), true, false}
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
}
+ defer func() {
+ if r := recover(); r != nil {
+ self.Logf("compile FAULT: %v", r)
+ }
+ }()
+
data := ethutil.StringToByteFunc(dataStr, func(s string) (ret []byte) {
slice := strings.Split(dataStr, "\n")
for _, dataItem := range slice {
@@ -131,7 +137,11 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
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 {
- win *qml.Window
- N chan bool
- Q chan bool
- done bool
+ win *qml.Window
+ N chan bool
+ Q chan bool
+ done, interrupt bool
}
type storeVal struct {
@@ -185,7 +195,8 @@ out:
case <-d.N:
break out
case <-d.Q:
- d.done = true
+ d.interrupt = true
+ d.clearBuffers()
return false
}
@@ -194,6 +205,19 @@ out:
return true
}
+func (d *Debugger) clearBuffers() {
+out:
+ // drain
+ for {
+ select {
+ case <-d.N:
+ case <-d.Q:
+ default:
+ break out
+ }
+ }
+}
+
func (d *Debugger) Next() {
if !d.done {
d.N <- true
diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go
index 4dda5017f..5954df70c 100644
--- a/ethereal/ui/gui.go
+++ b/ethereal/ui/gui.go
@@ -154,7 +154,7 @@ 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}
+ db := &Debugger{gui.win, make(chan bool), make(chan bool), true, false}
gui.lib.Db = db
gui.uiLib.Db = db