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
090447c6
Commit
090447c6
authored
May 28, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Data and script in the debugger accept "0x" values and regular scripting
parent
198ef971
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
25 deletions
+45
-25
debugger.qml
ethereal/assets/debugger/debugger.qml
+5
-1
debugger.go
ethereal/ui/debugger.go
+40
-24
No files found.
ethereal/assets/debugger/debugger.qml
View file @
090447c6
...
@@ -14,6 +14,9 @@ ApplicationWindow {
...
@@ -14,6 +14,9 @@ ApplicationWindow {
width
:
1290
width
:
1290
height
:
900
height
:
900
property
alias
codeText
:
codeEditor
.
text
property
alias
dataText
:
rawDataField
.
text
MenuBar
{
MenuBar
{
Menu
{
Menu
{
title
:
"Debugger"
title
:
"Debugger"
...
@@ -167,6 +170,7 @@ ApplicationWindow {
...
@@ -167,6 +170,7 @@ ApplicationWindow {
}
}
}
}
}
}
toolBar
:
ToolBar
{
toolBar
:
ToolBar
{
RowLayout
{
RowLayout
{
spacing
:
5
spacing
:
5
...
@@ -205,7 +209,7 @@ ApplicationWindow {
...
@@ -205,7 +209,7 @@ ApplicationWindow {
function
setInstruction
(
num
)
{
function
setInstruction
(
num
)
{
asmTableView
.
selection
.
clear
()
asmTableView
.
selection
.
clear
()
asmTableView
.
selection
.
select
(
num
-
1
)
asmTableView
.
selection
.
select
(
num
)
}
}
function
setMem
(
mem
)
{
function
setMem
(
mem
)
{
...
...
ethereal/ui/debugger.go
View file @
090447c6
...
@@ -9,6 +9,23 @@ import (
...
@@ -9,6 +9,23 @@ import (
"strings"
"strings"
)
)
func
formatData
(
data
string
)
[]
byte
{
if
len
(
data
)
==
0
{
return
nil
}
// Simple stupid
d
:=
new
(
big
.
Int
)
if
data
[
0
:
1
]
==
"
\"
"
&&
data
[
len
(
data
)
-
1
:
]
==
"
\"
"
{
d
.
SetBytes
([]
byte
(
data
[
1
:
len
(
data
)
-
1
]))
}
else
if
data
[
:
2
]
==
"0x"
{
d
.
SetBytes
(
ethutil
.
FromHex
(
data
[
2
:
]))
}
else
{
d
.
SetString
(
data
,
0
)
}
return
ethutil
.
BigToBytes
(
d
,
256
)
}
type
DebuggerWindow
struct
{
type
DebuggerWindow
struct
{
win
*
qml
.
Window
win
*
qml
.
Window
engine
*
qml
.
Engine
engine
*
qml
.
Engine
...
@@ -41,21 +58,12 @@ func (self *DebuggerWindow) Show() {
...
@@ -41,21 +58,12 @@ func (self *DebuggerWindow) Show() {
}()
}()
}
}
func
formatData
(
data
string
)
[]
byte
{
func
(
self
*
DebuggerWindow
)
SetCode
(
code
string
)
{
if
len
(
data
)
==
0
{
self
.
win
.
Set
(
"codeText"
,
code
)
return
nil
}
}
// Simple stupid
d
:=
new
(
big
.
Int
)
if
data
[
0
:
1
]
==
"
\"
"
&&
data
[
len
(
data
)
-
1
:
]
==
"
\"
"
{
d
.
SetBytes
([]
byte
(
data
[
1
:
len
(
data
)
-
1
]))
}
else
if
data
[
:
2
]
==
"0x"
{
d
.
SetBytes
(
ethutil
.
FromHex
(
data
[
2
:
]))
}
else
{
d
.
SetString
(
data
,
0
)
}
return
ethutil
.
BigToBytes
(
d
,
256
)
func
(
self
*
DebuggerWindow
)
SetData
(
data
string
)
{
self
.
win
.
Set
(
"dataText"
,
data
)
}
}
func
(
self
*
DebuggerWindow
)
Debug
(
valueStr
,
gasStr
,
gasPriceStr
,
scriptStr
,
dataStr
string
)
{
func
(
self
*
DebuggerWindow
)
Debug
(
valueStr
,
gasStr
,
gasPriceStr
,
scriptStr
,
dataStr
string
)
{
...
@@ -63,22 +71,28 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
...
@@ -63,22 +71,28 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
self
.
Db
.
Q
<-
true
self
.
Db
.
Q
<-
true
}
}
dataSlice
:=
strings
.
Split
(
dataStr
,
"
\n
"
)
var
data
[]
byte
for
_
,
dataItem
:=
range
dataSlice
{
d
:=
formatData
(
dataItem
)
data
=
append
(
data
,
d
...
)
}
state
:=
self
.
lib
.
eth
.
BlockChain
()
.
CurrentBlock
.
State
()
defer
func
()
{
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
if
r
:=
recover
();
r
!=
nil
{
fmt
.
Println
(
r
)
fmt
.
Println
(
r
)
self
.
Db
.
done
=
true
}
}
}()
}()
script
,
err
:=
ethutil
.
Compile
(
scriptStr
)
data
:=
ethutil
.
StringToByteFunc
(
dataStr
,
func
(
s
string
)
(
ret
[]
byte
)
{
slice
:=
strings
.
Split
(
dataStr
,
"
\n
"
)
for
_
,
dataItem
:=
range
slice
{
d
:=
formatData
(
dataItem
)
ret
=
append
(
ret
,
d
...
)
}
return
})
var
err
error
script
:=
ethutil
.
StringToByteFunc
(
scriptStr
,
func
(
s
string
)
(
ret
[]
byte
)
{
ret
,
err
=
ethutil
.
Compile
(
s
)
return
})
if
err
!=
nil
{
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Debugln
(
err
)
ethutil
.
Config
.
Log
.
Debugln
(
err
)
...
@@ -91,11 +105,13 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
...
@@ -91,11 +105,13 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
for
_
,
str
:=
range
dis
{
for
_
,
str
:=
range
dis
{
self
.
win
.
Root
()
.
Call
(
"setAsm"
,
str
)
self
.
win
.
Root
()
.
Call
(
"setAsm"
,
str
)
}
}
// Contract addr as test address
// Contract addr as test address
keyPair
:=
ethutil
.
GetKeyRing
()
.
Get
(
0
)
keyPair
:=
ethutil
.
GetKeyRing
()
.
Get
(
0
)
callerTx
:=
ethchain
.
NewContractCreationTx
(
ethutil
.
Big
(
valueStr
),
ethutil
.
Big
(
gasStr
),
ethutil
.
Big
(
gasPriceStr
),
script
)
callerTx
:=
ethchain
.
NewContractCreationTx
(
ethutil
.
Big
(
valueStr
),
ethutil
.
Big
(
gasStr
),
ethutil
.
Big
(
gasPriceStr
),
script
)
callerTx
.
Sign
(
keyPair
.
PrivateKey
)
callerTx
.
Sign
(
keyPair
.
PrivateKey
)
state
:=
self
.
lib
.
eth
.
BlockChain
()
.
CurrentBlock
.
State
()
account
:=
self
.
lib
.
eth
.
StateManager
()
.
TransState
()
.
GetAccount
(
keyPair
.
Address
())
account
:=
self
.
lib
.
eth
.
StateManager
()
.
TransState
()
.
GetAccount
(
keyPair
.
Address
())
contract
:=
ethchain
.
MakeContract
(
callerTx
,
state
)
contract
:=
ethchain
.
MakeContract
(
callerTx
,
state
)
callerClosure
:=
ethchain
.
NewClosure
(
account
,
contract
,
script
,
state
,
ethutil
.
Big
(
gasStr
),
ethutil
.
Big
(
gasPriceStr
))
callerClosure
:=
ethchain
.
NewClosure
(
account
,
contract
,
script
,
state
,
ethutil
.
Big
(
gasStr
),
ethutil
.
Big
(
gasPriceStr
))
...
...
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