Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
505d7436
Commit
505d7436
authored
May 19, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add error param in callback functions
parent
28cb70ee
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
84 additions
and
38 deletions
+84
-38
asmCode.js
src/asmCode.js
+10
-2
calldataPanel.js
src/calldataPanel.js
+4
-2
callstackPanel.js
src/callstackPanel.js
+4
-2
memoryPanel.js
src/memoryPanel.js
+4
-2
stackPanel.js
src/stackPanel.js
+4
-2
stepManager.js
src/stepManager.js
+5
-1
sticker.js
src/sticker.js
+20
-4
storagePanel.js
src/storagePanel.js
+4
-2
traceManager.js
src/traceManager.js
+25
-19
vmDebugger.js
src/vmDebugger.js
+4
-2
No files found.
src/asmCode.js
View file @
505d7436
...
@@ -48,8 +48,12 @@ module.exports = React.createClass({
...
@@ -48,8 +48,12 @@ module.exports = React.createClass({
if
(
nextProps
.
currentStepIndex
<
0
)
return
if
(
nextProps
.
currentStepIndex
<
0
)
return
codeResolver
.
setWeb3
(
this
.
context
.
web3
)
codeResolver
.
setWeb3
(
this
.
context
.
web3
)
var
self
=
this
var
self
=
this
this
.
context
.
traceManager
.
getCurrentCalledAddressAt
(
nextProps
.
currentStepIndex
,
function
(
address
)
{
this
.
context
.
traceManager
.
getCurrentCalledAddressAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
address
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
ensureCodeLoaded
(
address
,
nextProps
.
currentStepIndex
)
self
.
ensureCodeLoaded
(
address
,
nextProps
.
currentStepIndex
)
}
})
})
},
},
...
@@ -77,10 +81,14 @@ module.exports = React.createClass({
...
@@ -77,10 +81,14 @@ module.exports = React.createClass({
setInstructionIndex
:
function
(
address
,
step
)
{
setInstructionIndex
:
function
(
address
,
step
)
{
var
self
=
this
var
self
=
this
this
.
context
.
traceManager
.
getCurrentPC
(
step
,
function
(
instIndex
)
{
this
.
context
.
traceManager
.
getCurrentPC
(
step
,
function
(
error
,
instIndex
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
self
.
setState
({
selected
:
codeResolver
.
getInstructionIndex
(
address
,
instIndex
)
selected
:
codeResolver
.
getInstructionIndex
(
address
,
instIndex
)
})
})
}
})
})
}
}
})
})
src/calldataPanel.js
View file @
505d7436
...
@@ -30,8 +30,10 @@ module.exports = React.createClass({
...
@@ -30,8 +30,10 @@ module.exports = React.createClass({
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
var
self
=
this
this
.
context
.
traceManager
.
getCallDataAt
(
nextProps
.
currentStepIndex
,
function
(
calldata
)
{
this
.
context
.
traceManager
.
getCallDataAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
calldata
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
self
.
setState
({
data
:
calldata
data
:
calldata
})
})
...
...
src/callstackPanel.js
View file @
505d7436
...
@@ -30,8 +30,10 @@ module.exports = React.createClass({
...
@@ -30,8 +30,10 @@ module.exports = React.createClass({
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
var
self
=
this
this
.
context
.
traceManager
.
getCallStackAt
(
nextProps
.
currentStepIndex
,
function
(
callstack
)
{
this
.
context
.
traceManager
.
getCallStackAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
callstack
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
self
.
setState
({
data
:
callstack
data
:
callstack
})
})
...
...
src/memoryPanel.js
View file @
505d7436
...
@@ -31,8 +31,10 @@ module.exports = React.createClass({
...
@@ -31,8 +31,10 @@ module.exports = React.createClass({
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
var
self
=
this
this
.
context
.
traceManager
.
getMemoryAt
(
nextProps
.
currentStepIndex
,
function
(
memory
)
{
this
.
context
.
traceManager
.
getMemoryAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
memory
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
self
.
setState
({
data
:
self
.
formatMemory
(
memory
,
16
)
data
:
self
.
formatMemory
(
memory
,
16
)
})
})
...
...
src/stackPanel.js
View file @
505d7436
...
@@ -30,8 +30,10 @@ module.exports = React.createClass({
...
@@ -30,8 +30,10 @@ module.exports = React.createClass({
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
var
self
=
this
this
.
context
.
traceManager
.
getStackAt
(
nextProps
.
currentStepIndex
,
function
(
stack
)
{
this
.
context
.
traceManager
.
getStackAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
stack
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
self
.
setState
({
data
:
stack
data
:
stack
})
})
...
...
src/stepManager.js
View file @
505d7436
...
@@ -54,8 +54,12 @@ module.exports = React.createClass({
...
@@ -54,8 +54,12 @@ module.exports = React.createClass({
newTraceAvailable
:
function
()
{
newTraceAvailable
:
function
()
{
this
.
init
()
this
.
init
()
var
self
=
this
var
self
=
this
this
.
context
.
traceManager
.
getLength
(
function
(
length
)
{
this
.
context
.
traceManager
.
getLength
(
function
(
error
,
length
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
traceLength
:
length
})
self
.
setState
({
traceLength
:
length
})
}
})
})
},
},
...
...
src/sticker.js
View file @
505d7436
...
@@ -84,28 +84,44 @@ module.exports = React.createClass({
...
@@ -84,28 +84,44 @@ module.exports = React.createClass({
if
(
nextProps
.
currentStepIndex
<
0
)
return
if
(
nextProps
.
currentStepIndex
<
0
)
return
var
self
=
this
var
self
=
this
this
.
context
.
traceManager
.
getCurrentStep
(
nextProps
.
currentStepIndex
,
function
(
step
)
{
this
.
context
.
traceManager
.
getCurrentStep
(
nextProps
.
currentStepIndex
,
function
(
error
,
step
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
self
.
setState
({
step
:
step
step
:
step
})
})
}
})
})
this
.
context
.
traceManager
.
getMemExpand
(
nextProps
.
currentStepIndex
,
function
(
addmem
)
{
this
.
context
.
traceManager
.
getMemExpand
(
nextProps
.
currentStepIndex
,
function
(
error
,
addmem
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
self
.
setState
({
addmemory
:
addmem
addmemory
:
addmem
})
})
}
})
})
this
.
context
.
traceManager
.
getStepCost
(
nextProps
.
currentStepIndex
,
function
(
gas
)
{
this
.
context
.
traceManager
.
getStepCost
(
nextProps
.
currentStepIndex
,
function
(
error
,
gas
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
self
.
setState
({
gas
:
gas
gas
:
gas
})
})
}
})
})
this
.
context
.
traceManager
.
getRemainingGas
(
nextProps
.
currentStepIndex
,
function
(
remaingas
)
{
this
.
context
.
traceManager
.
getRemainingGas
(
nextProps
.
currentStepIndex
,
function
(
error
,
remaingas
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
self
.
setState
({
remaininGas
:
remaingas
remaininGas
:
remaingas
})
})
}
})
})
}
}
})
})
src/storagePanel.js
View file @
505d7436
...
@@ -31,8 +31,10 @@ module.exports = React.createClass({
...
@@ -31,8 +31,10 @@ module.exports = React.createClass({
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
var
self
=
this
this
.
context
.
traceManager
.
getStorageAt
(
nextProps
.
currentStepIndex
,
this
.
context
.
tx
.
blockNumber
.
toString
(),
this
.
context
.
tx
.
transactionIndex
,
function
(
storage
)
{
this
.
context
.
traceManager
.
getStorageAt
(
nextProps
.
currentStepIndex
,
this
.
context
.
tx
.
blockNumber
.
toString
(),
this
.
context
.
tx
.
transactionIndex
,
function
(
error
,
storage
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
self
.
setState
({
data
:
storage
data
:
storage
})
})
...
...
src/traceManager.js
View file @
505d7436
...
@@ -136,14 +136,14 @@ module.exports = {
...
@@ -136,14 +136,14 @@ module.exports = {
// API section
// API section
getLength
:
function
(
callback
)
{
getLength
:
function
(
callback
)
{
if
(
!
this
.
trace
)
callback
(
0
)
if
(
!
this
.
trace
)
callback
(
'no trace available'
,
null
)
callback
(
this
.
trace
.
length
)
callback
(
null
,
this
.
trace
.
length
)
},
},
getStorageAt
:
function
(
stepIndex
,
blockNumber
,
txIndex
,
callback
)
{
getStorageAt
:
function
(
stepIndex
,
blockNumber
,
txIndex
,
callback
)
{
var
stoChange
=
this
.
findLowerBound
(
stepIndex
,
this
.
vmTraceChangesRef
)
var
stoChange
=
this
.
findLowerBound
(
stepIndex
,
this
.
vmTraceChangesRef
)
if
(
!
stoChange
)
{
if
(
!
stoChange
)
{
return
{}
callback
(
'cannot rebuild storage'
,
null
)
}
}
var
changeRefs
=
this
.
vmTraceIndexByStorageChange
[
stoChange
]
var
changeRefs
=
this
.
vmTraceIndexByStorageChange
[
stoChange
]
...
@@ -160,20 +160,20 @@ module.exports = {
...
@@ -160,20 +160,20 @@ module.exports = {
}
}
}
}
}
}
callback
(
storage
)
callback
(
null
,
storage
)
})
})
},
},
getCallDataAt
:
function
(
stepIndex
,
callback
)
{
getCallDataAt
:
function
(
stepIndex
,
callback
)
{
var
callDataChange
=
this
.
findLowerBound
(
stepIndex
,
this
.
callDataChanges
)
var
callDataChange
=
this
.
findLowerBound
(
stepIndex
,
this
.
callDataChanges
)
if
(
!
callDataChange
)
return
[
''
]
if
(
!
callDataChange
)
return
callback
(
'no calldata found'
,
null
)
callback
([
this
.
trace
[
callDataChange
].
calldata
])
callback
(
null
,
[
this
.
trace
[
callDataChange
].
calldata
])
},
},
getCallStackAt
:
function
(
stepIndex
,
callback
)
{
getCallStackAt
:
function
(
stepIndex
,
callback
)
{
var
callStackChange
=
this
.
findLowerBound
(
stepIndex
,
this
.
depthChanges
)
var
callStackChange
=
this
.
findLowerBound
(
stepIndex
,
this
.
depthChanges
)
if
(
!
callStackChange
)
return
''
if
(
!
callStackChange
)
return
callback
(
'no callstack found'
,
null
)
callback
(
this
.
callStack
[
callStackChange
].
stack
)
callback
(
null
,
this
.
callStack
[
callStackChange
].
stack
)
},
},
getStackAt
:
function
(
stepIndex
,
callback
)
{
getStackAt
:
function
(
stepIndex
,
callback
)
{
...
@@ -181,46 +181,52 @@ module.exports = {
...
@@ -181,46 +181,52 @@ module.exports = {
if
(
this
.
trace
[
stepIndex
].
stack
)
{
// there's always a stack
if
(
this
.
trace
[
stepIndex
].
stack
)
{
// there's always a stack
stack
=
this
.
trace
[
stepIndex
].
stack
.
slice
(
0
)
stack
=
this
.
trace
[
stepIndex
].
stack
.
slice
(
0
)
stack
.
reverse
()
stack
.
reverse
()
callback
(
stack
)
callback
(
null
,
stack
)
}
else
{
callback
(
'no stack found'
,
null
)
}
}
},
},
getLastDepthIndexChangeSince
:
function
(
stepIndex
,
callback
)
{
getLastDepthIndexChangeSince
:
function
(
stepIndex
,
callback
)
{
var
depthIndex
=
this
.
findLowerBound
(
stepIndex
,
this
.
depthChanges
)
var
depthIndex
=
this
.
findLowerBound
(
stepIndex
,
this
.
depthChanges
)
callback
(
depthIndex
)
callback
(
null
,
depthIndex
)
},
},
getCurrentCalledAddressAt
:
function
(
stepIndex
,
callback
)
{
getCurrentCalledAddressAt
:
function
(
stepIndex
,
callback
)
{
var
self
=
this
var
self
=
this
this
.
getLastDepthIndexChangeSince
(
stepIndex
,
function
(
addressIndex
)
{
this
.
getLastDepthIndexChangeSince
(
stepIndex
,
function
(
error
,
addressIndex
)
{
callback
(
self
.
resolveAddress
(
addressIndex
))
if
(
error
)
{
callback
(
error
,
null
)
}
else
{
callback
(
null
,
self
.
resolveAddress
(
addressIndex
))
}
})
})
},
},
getMemoryAt
:
function
(
stepIndex
,
callback
)
{
getMemoryAt
:
function
(
stepIndex
,
callback
)
{
var
lastChanges
=
this
.
findLowerBound
(
stepIndex
,
this
.
memoryChanges
)
var
lastChanges
=
this
.
findLowerBound
(
stepIndex
,
this
.
memoryChanges
)
if
(
!
lastChanges
)
return
''
if
(
!
lastChanges
)
return
callback
(
'no memory found'
,
null
)
callback
(
this
.
trace
[
lastChanges
].
memory
)
callback
(
null
,
this
.
trace
[
lastChanges
].
memory
)
},
},
getCurrentPC
:
function
(
stepIndex
,
callback
)
{
getCurrentPC
:
function
(
stepIndex
,
callback
)
{
callback
(
this
.
trace
[
stepIndex
].
pc
)
callback
(
null
,
this
.
trace
[
stepIndex
].
pc
)
},
},
getCurrentStep
:
function
(
stepIndex
,
callback
)
{
getCurrentStep
:
function
(
stepIndex
,
callback
)
{
callback
(
this
.
trace
[
stepIndex
].
steps
)
callback
(
null
,
this
.
trace
[
stepIndex
].
steps
)
},
},
getMemExpand
:
function
(
stepIndex
,
callback
)
{
getMemExpand
:
function
(
stepIndex
,
callback
)
{
callback
(
this
.
trace
[
stepIndex
].
memexpand
?
this
.
trace
[
stepIndex
].
memexpand
:
''
)
callback
(
null
,
this
.
trace
[
stepIndex
].
memexpand
?
this
.
trace
[
stepIndex
].
memexpand
:
''
)
},
},
getStepCost
:
function
(
stepIndex
,
callback
)
{
getStepCost
:
function
(
stepIndex
,
callback
)
{
callback
(
this
.
trace
[
stepIndex
].
gascost
)
callback
(
null
,
this
.
trace
[
stepIndex
].
gascost
)
},
},
getRemainingGas
:
function
(
stepIndex
,
callback
)
{
getRemainingGas
:
function
(
stepIndex
,
callback
)
{
callback
(
this
.
trace
[
stepIndex
].
gas
)
callback
(
null
,
this
.
trace
[
stepIndex
].
gas
)
},
},
// step section
// step section
...
...
src/vmDebugger.js
View file @
505d7436
...
@@ -73,8 +73,10 @@ module.exports = React.createClass({
...
@@ -73,8 +73,10 @@ module.exports = React.createClass({
if
(
nextProps
.
currentStepIndex
<
0
)
return
if
(
nextProps
.
currentStepIndex
<
0
)
return
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
var
self
=
this
this
.
context
.
traceManager
.
getCurrentCalledAddressAt
(
nextProps
.
currentStepIndex
,
function
(
address
)
{
this
.
context
.
traceManager
.
getCurrentCalledAddressAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
address
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
self
.
setState
({
currentAddress
:
address
currentAddress
:
address
})
})
...
...
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