Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
4fd267a7
Commit
4fd267a7
authored
May 27, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sep debugger from main
parent
d694e00a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
222 additions
and
6 deletions
+222
-6
debugger.qml
ethereal/assets/debugger/debugger.qml
+114
-0
wallet.qml
ethereal/assets/qml/wallet.qml
+12
-2
debugger.go
ethereal/ui/debugger.go
+86
-0
ui_lib.go
ethereal/ui/ui_lib.go
+10
-4
No files found.
ethereal/assets/debugger/debugger.qml
0 → 100644
View file @
4fd267a7
import
QtQuick
2.0
import
QtQuick
.
Controls
1.0
;
import
QtQuick
.
Layouts
1.0
;
import
QtQuick
.
Dialogs
1.0
;
import
QtQuick
.
Window
2.1
;
import
QtQuick
.
Controls
.
Styles
1.1
import
Ethereum
1.0
ApplicationWindow
{
id
:
debugWindow
visible
:
false
title
:
"Debugger"
minimumWidth
:
600
minimumHeight
:
600
width
:
800
height
:
600
SplitView
{
anchors.fill
:
parent
property
var
asmModel
:
ListModel
{
id
:
asmModel
}
TableView
{
id
:
asmTableView
width
:
200
TableViewColumn
{
role
:
"value"
;
title
:
""
;
width
:
100
}
model
:
asmModel
}
Rectangle
{
anchors.left
:
asmTableView
.
right
anchors.right
:
parent
.
right
SplitView
{
orientation
:
Qt
.
Vertical
anchors.fill
:
parent
TableView
{
property
var
memModel
:
ListModel
{
id
:
memModel
}
height
:
parent
.
height
/
2
width
:
parent
.
width
TableViewColumn
{
id
:
mnumColmn
;
role
:
"num"
;
title
:
"#"
;
width
:
50
}
TableViewColumn
{
role
:
"value"
;
title
:
"Memory"
;
width
:
750
}
model
:
memModel
}
SplitView
{
orientation
:
Qt
.
Horizontal
TableView
{
property
var
debuggerLog
:
ListModel
{
id
:
debuggerLog
}
TableViewColumn
{
role
:
"value"
;
title
:
"Debug messages"
}
model
:
debuggerLog
}
TableView
{
property
var
stackModel
:
ListModel
{
id
:
stackModel
}
height
:
parent
.
height
/
2
width
:
parent
.
width
TableViewColumn
{
role
:
"value"
;
title
:
"Stack"
;
width
:
200
}
model
:
stackModel
}
}
}
}
}
statusBar
:
StatusBar
{
RowLayout
{
anchors.fill
:
parent
Button
{
property
var
enabled
:
true
id
:
debugNextButton
onClicked
:
{
//db.next()
}
text
:
"Next"
}
}
}
function
setAsm
(
asm
)
{
asmModel
.
append
({
asm
:
asm
})
}
function
setInstruction
(
num
)
{
asmTableView
.
selection
.
clear
()
asmTableView
.
selection
.
select
(
num
-
1
)
}
function
clearAsm
()
{
asmModel
.
clear
()
}
function
setMem
(
mem
)
{
memModel
.
append
({
num
:
mem
.
num
,
value
:
mem
.
value
})
}
function
clearMem
(){
memModel
.
clear
()
}
function
setStack
(
stack
)
{
stackModel
.
append
({
value
:
stack
})
}
function
addDebugMessage
(
message
){
debuggerLog
.
append
({
value
:
message
})
}
function
clearStack
()
{
stackModel
.
clear
()
}
}
ethereal/assets/qml/wallet.qml
View file @
4fd267a7
...
@@ -294,6 +294,7 @@ ApplicationWindow {
...
@@ -294,6 +294,7 @@ ApplicationWindow {
statusBar
:
StatusBar
{
statusBar
:
StatusBar
{
RowLayout
{
RowLayout
{
anchors.fill
:
parent
anchors.fill
:
parent
/*
Button {
Button {
property var enabled: true
property var enabled: true
id: connectButton
id: connectButton
...
@@ -304,10 +305,19 @@ ApplicationWindow {
...
@@ -304,10 +305,19 @@ ApplicationWindow {
}
}
text: "Connect"
text: "Connect"
}
}
*/
Button
{
property
var
enabled
:
true
id
:
debuggerWindow
onClicked
:
{
ui
.
startDebugger
()
}
text
:
"Debugger"
}
Button
{
Button
{
id
:
importAppButton
id
:
importAppButton
anchors.left
:
connectButton
.
right
anchors.left
:
debuggerWindow
.
right
anchors.leftMargin
:
5
anchors.leftMargin
:
5
onClicked
:
openAppDialog
.
open
()
onClicked
:
openAppDialog
.
open
()
text
:
"Import App"
text
:
"Import App"
...
@@ -473,7 +483,7 @@ ApplicationWindow {
...
@@ -473,7 +483,7 @@ ApplicationWindow {
}
}
height
:
parent
.
height
/
2
height
:
parent
.
height
/
2
width
:
parent
.
width
width
:
parent
.
width
TableViewColumn
{
role
:
"value"
;
title
:
"Stack"
;
width
:
parent
.
width
}
TableViewColumn
{
role
:
"value"
;
title
:
"Stack"
;
width
:
300
}
model
:
stackModel
model
:
stackModel
}
}
}
}
...
...
ethereal/ui/debugger.go
0 → 100644
View file @
4fd267a7
package
ethui
import
(
"fmt"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
"github.com/go-qml/qml"
)
type
DebuggerWindow
struct
{
win
*
qml
.
Window
engine
*
qml
.
Engine
lib
*
UiLib
Db
*
Debugger
}
func
NewDebuggerWindow
(
lib
*
UiLib
)
*
DebuggerWindow
{
engine
:=
qml
.
NewEngine
()
component
,
err
:=
engine
.
LoadFile
(
lib
.
AssetPath
(
"debugger/debugger.qml"
))
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
nil
}
win
:=
component
.
CreateWindow
(
nil
)
db
:=
&
Debugger
{
win
,
make
(
chan
bool
),
true
}
return
&
DebuggerWindow
{
engine
:
engine
,
win
:
win
,
lib
:
lib
,
Db
:
db
}
}
func
(
self
*
DebuggerWindow
)
Show
()
{
go
func
()
{
self
.
win
.
Show
()
self
.
win
.
Wait
()
}()
}
func
(
self
*
DebuggerWindow
)
DebugTx
(
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
data
string
)
{
state
:=
self
.
lib
.
eth
.
BlockChain
()
.
CurrentBlock
.
State
()
script
,
err
:=
ethutil
.
Compile
(
data
)
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Debugln
(
err
)
return
}
dis
:=
ethchain
.
Disassemble
(
script
)
self
.
lib
.
win
.
Root
()
.
Call
(
"clearAsm"
)
for
_
,
str
:=
range
dis
{
self
.
lib
.
win
.
Root
()
.
Call
(
"setAsm"
,
str
)
}
// Contract addr as test address
keyPair
:=
ethutil
.
GetKeyRing
()
.
Get
(
0
)
callerTx
:=
ethchain
.
NewContractCreationTx
(
ethutil
.
Big
(
valueStr
),
ethutil
.
Big
(
gasStr
),
ethutil
.
Big
(
gasPriceStr
),
script
)
callerTx
.
Sign
(
keyPair
.
PrivateKey
)
account
:=
self
.
lib
.
eth
.
StateManager
()
.
TransState
()
.
GetStateObject
(
keyPair
.
Address
())
contract
:=
ethchain
.
MakeContract
(
callerTx
,
state
)
callerClosure
:=
ethchain
.
NewClosure
(
account
,
contract
,
contract
.
Init
(),
state
,
ethutil
.
Big
(
gasStr
),
ethutil
.
Big
(
gasPriceStr
))
block
:=
self
.
lib
.
eth
.
BlockChain
()
.
CurrentBlock
vm
:=
ethchain
.
NewVm
(
state
,
self
.
lib
.
eth
.
StateManager
(),
ethchain
.
RuntimeVars
{
Origin
:
account
.
Address
(),
BlockNumber
:
block
.
BlockInfo
()
.
Number
,
PrevHash
:
block
.
PrevHash
,
Coinbase
:
block
.
Coinbase
,
Time
:
block
.
Time
,
Diff
:
block
.
Difficulty
,
})
self
.
Db
.
done
=
false
go
func
()
{
callerClosure
.
Call
(
vm
,
contract
.
Init
(),
self
.
Db
.
halting
)
state
.
Reset
()
self
.
Db
.
done
=
true
}()
}
func
(
self
*
DebuggerWindow
)
Next
()
{
self
.
Db
.
Next
()
}
ethereal/ui/ui_lib.go
View file @
4fd267a7
...
@@ -90,6 +90,12 @@ func (ui *UiLib) AssetPath(p string) string {
...
@@ -90,6 +90,12 @@ func (ui *UiLib) AssetPath(p string) string {
return
path
.
Join
(
ui
.
assetPath
,
p
)
return
path
.
Join
(
ui
.
assetPath
,
p
)
}
}
func
(
self
*
UiLib
)
StartDebugger
()
{
dbWindow
:=
NewDebuggerWindow
(
self
)
dbWindow
.
Show
()
}
func
DefaultAssetPath
()
string
{
func
DefaultAssetPath
()
string
{
var
base
string
var
base
string
// If the current working directory is the go-ethereum dir
// If the current working directory is the go-ethereum dir
...
@@ -163,9 +169,7 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string)
...
@@ -163,9 +169,7 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string)
}
}
func
(
ui
*
UiLib
)
Next
()
{
func
(
ui
*
UiLib
)
Next
()
{
if
!
ui
.
Db
.
done
{
ui
.
Db
.
Next
()
ui
.
Db
.
Next
()
}
}
}
type
Debugger
struct
{
type
Debugger
struct
{
...
@@ -200,5 +204,7 @@ out:
...
@@ -200,5 +204,7 @@ out:
}
}
func
(
d
*
Debugger
)
Next
()
{
func
(
d
*
Debugger
)
Next
()
{
d
.
N
<-
true
if
!
d
.
done
{
d
.
N
<-
true
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment