diff options
Diffstat (limited to 'Mist')
-rw-r--r-- | Mist/assets/debugger/debugger.qml | 64 | ||||
-rw-r--r-- | Mist/assets/icecream.png | bin | 0 -> 4643 bytes | |||
-rw-r--r-- | Mist/assets/qml/wallet.qml | 14 | ||||
-rw-r--r-- | Mist/debugger.go | 24 | ||||
-rw-r--r-- | Mist/flags.go | 2 |
5 files changed, 84 insertions, 20 deletions
diff --git a/Mist/assets/debugger/debugger.qml b/Mist/assets/debugger/debugger.qml index 34fe01253..d4b8db576 100644 --- a/Mist/assets/debugger/debugger.qml +++ b/Mist/assets/debugger/debugger.qml @@ -86,8 +86,37 @@ ApplicationWindow { TableView { id: asmTableView width: 200 + headerVisible: false TableViewColumn{ role: "value" ; title: "" ; width: asmTableView.width - 2 } model: asmModel + /* + alternatingRowColors: false + itemDelegate: Item { + Rectangle { + anchors.fill: parent + color: "#DDD" + Text { + anchors { + left: parent.left + right: parent.right + leftMargin: 10 + verticalCenter: parent.verticalCenter + } + color: "#333" + elide: styleData.elideMode + text: styleData.value + font.pixelSize: 11 + MouseArea { + acceptedButtons: Qt.LeftButton + anchors.fill: parent + onClicked: { + mouse.accepted = true + } + } + } + } + } + */ } Rectangle { @@ -201,8 +230,8 @@ ApplicationWindow { } height: parent.height width: parent.width - stackTableView.width - TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} - TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} + TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50 } + TableViewColumn{ role: "value" ; title: "Memory" ; width: 750 } model: memModel } } @@ -225,7 +254,7 @@ ApplicationWindow { Rectangle { height: 200 - width: parent.width + width: parent.width * 0.66 TableView { id: logTableView property var logModel: ListModel { @@ -237,6 +266,7 @@ ApplicationWindow { model: logModel } } + } } } @@ -260,12 +290,37 @@ ApplicationWindow { exec() } } + + RowLayout { + anchors.left: dbgCommand.right + anchors.leftMargin: 10 + spacing: 5 + y: parent.height / 2 - this.height / 2 + + Text { + objectName: "stackFrame" + font.pixelSize: 10 + text: "<b>stack ptr</b>: 0" + } + + Text { + objectName: "stackSize" + font.pixelSize: 10 + text: "<b>stack size</b>: 0" + } + + Text { + objectName: "memSize" + font.pixelSize: 10 + text: "<b>mem size</b>: 0" + } + } } toolBar: ToolBar { height: 30 RowLayout { - spacing: 5 + spacing: 10 Button { property var enabled: true @@ -327,6 +382,7 @@ ApplicationWindow { function setInstruction(num) { asmTableView.selection.clear() asmTableView.selection.select(num) + asmTableView.positionViewAtRow(num, ListView.Center) } function setMem(mem) { diff --git a/Mist/assets/icecream.png b/Mist/assets/icecream.png Binary files differnew file mode 100644 index 000000000..2438ca845 --- /dev/null +++ b/Mist/assets/icecream.png diff --git a/Mist/assets/qml/wallet.qml b/Mist/assets/qml/wallet.qml index 9990da322..5b402a214 100644 --- a/Mist/assets/qml/wallet.qml +++ b/Mist/assets/qml/wallet.qml @@ -154,6 +154,7 @@ ApplicationWindow { Menu { title: "Developer" MenuItem { + iconSource: "../icecream.png" text: "Debugger" shortcut: "Ctrl+d" onTriggered: eth.startDebugger() @@ -253,16 +254,6 @@ ApplicationWindow { } } - /* - Button { - id: importAppButton - text: "Browser" - onClicked: { - eth.openBrowser() - } - } - */ - RowLayout { Label { id: walletValueLabel @@ -669,8 +660,7 @@ ApplicationWindow { Rectangle { id: mainView - - + color: "#00000000" anchors.right: parent.right anchors.left: parent.left anchors.bottom: parent.bottom diff --git a/Mist/debugger.go b/Mist/debugger.go index 7bc544377..a9086921d 100644 --- a/Mist/debugger.go +++ b/Mist/debugger.go @@ -5,6 +5,7 @@ import ( "math/big" "strconv" "strings" + "unicode" "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethstate" @@ -271,9 +272,20 @@ func (d *Debugger) halting(pc int, op ethvm.OpCode, mem *ethvm.Memory, stack *et d.win.Root().Call("clearStorage") addr := 0 - for i := 0; i+32 <= mem.Len(); i += 32 { - d.win.Root().Call("setMem", memAddr{fmt.Sprintf("%03d", addr), fmt.Sprintf("% x", mem.Data()[i:i+32])}) - addr++ + for i := 0; i+32 <= mem.Len(); i += 16 { + dat := mem.Data()[i : i+16] + var str string + + for _, d := range dat { + if unicode.IsGraphic(rune(d)) { + str += string(d) + } else { + str += "?" + } + } + + d.win.Root().Call("setMem", memAddr{fmt.Sprintf("%03d", addr), fmt.Sprintf("%s % x", str, dat)}) + addr += 16 } for _, val := range stack.Data() { @@ -284,6 +296,12 @@ func (d *Debugger) halting(pc int, op ethvm.OpCode, mem *ethvm.Memory, stack *et d.win.Root().Call("setStorage", storeVal{fmt.Sprintf("% x", key), fmt.Sprintf("% x", node.Str())}) }) + stackFrameAt := new(big.Int).SetBytes(mem.Get(0, 32)) + psize := mem.Len() - int(new(big.Int).SetBytes(mem.Get(0, 32)).Uint64()) + d.win.Root().ObjectByName("stackFrame").Set("text", fmt.Sprintf(`<b>stack ptr</b>: %v`, stackFrameAt)) + d.win.Root().ObjectByName("stackSize").Set("text", fmt.Sprintf(`<b>stack size</b>: %d`, psize)) + d.win.Root().ObjectByName("memSize").Set("text", fmt.Sprintf(`<b>mem size</b>: %v`, mem.Len())) + out: for { select { diff --git a/Mist/flags.go b/Mist/flags.go index 388280b8c..d2e7d3fb0 100644 --- a/Mist/flags.go +++ b/Mist/flags.go @@ -44,7 +44,7 @@ func defaultAssetPath() string { // assume a debug build and use the source directory as // asset directory. pwd, _ := os.Getwd() - if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "Mist") { + if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "mist") { assetPath = path.Join(pwd, "assets") } else { switch runtime.GOOS { |