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
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
101 additions
and
55 deletions
+101
-55
asmCode.js
src/asmCode.js
+14
-6
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
+6
-2
sticker.js
src/sticker.js
+32
-16
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({
if
(
nextProps
.
currentStepIndex
<
0
)
return
codeResolver
.
setWeb3
(
this
.
context
.
web3
)
var
self
=
this
this
.
context
.
traceManager
.
getCurrentCalledAddressAt
(
nextProps
.
currentStepIndex
,
function
(
address
)
{
self
.
ensureCodeLoaded
(
address
,
nextProps
.
currentStepIndex
)
this
.
context
.
traceManager
.
getCurrentCalledAddressAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
address
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
ensureCodeLoaded
(
address
,
nextProps
.
currentStepIndex
)
}
})
},
...
...
@@ -77,10 +81,14 @@ module.exports = React.createClass({
setInstructionIndex
:
function
(
address
,
step
)
{
var
self
=
this
this
.
context
.
traceManager
.
getCurrentPC
(
step
,
function
(
instIndex
)
{
self
.
setState
({
selected
:
codeResolver
.
getInstructionIndex
(
address
,
instIndex
)
})
this
.
context
.
traceManager
.
getCurrentPC
(
step
,
function
(
error
,
instIndex
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
selected
:
codeResolver
.
getInstructionIndex
(
address
,
instIndex
)
})
}
})
}
})
src/calldataPanel.js
View file @
505d7436
...
...
@@ -30,8 +30,10 @@ module.exports = React.createClass({
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
this
.
context
.
traceManager
.
getCallDataAt
(
nextProps
.
currentStepIndex
,
function
(
calldata
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
this
.
context
.
traceManager
.
getCallDataAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
calldata
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
data
:
calldata
})
...
...
src/callstackPanel.js
View file @
505d7436
...
...
@@ -30,8 +30,10 @@ module.exports = React.createClass({
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
this
.
context
.
traceManager
.
getCallStackAt
(
nextProps
.
currentStepIndex
,
function
(
callstack
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
this
.
context
.
traceManager
.
getCallStackAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
callstack
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
data
:
callstack
})
...
...
src/memoryPanel.js
View file @
505d7436
...
...
@@ -31,8 +31,10 @@ module.exports = React.createClass({
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
this
.
context
.
traceManager
.
getMemoryAt
(
nextProps
.
currentStepIndex
,
function
(
memory
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
this
.
context
.
traceManager
.
getMemoryAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
memory
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
data
:
self
.
formatMemory
(
memory
,
16
)
})
...
...
src/stackPanel.js
View file @
505d7436
...
...
@@ -30,8 +30,10 @@ module.exports = React.createClass({
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
this
.
context
.
traceManager
.
getStackAt
(
nextProps
.
currentStepIndex
,
function
(
stack
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
this
.
context
.
traceManager
.
getStackAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
stack
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
data
:
stack
})
...
...
src/stepManager.js
View file @
505d7436
...
...
@@ -54,8 +54,12 @@ module.exports = React.createClass({
newTraceAvailable
:
function
()
{
this
.
init
()
var
self
=
this
this
.
context
.
traceManager
.
getLength
(
function
(
length
)
{
self
.
setState
({
traceLength
:
length
})
this
.
context
.
traceManager
.
getLength
(
function
(
error
,
length
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
traceLength
:
length
})
}
})
},
...
...
src/sticker.js
View file @
505d7436
...
...
@@ -84,28 +84,44 @@ module.exports = React.createClass({
if
(
nextProps
.
currentStepIndex
<
0
)
return
var
self
=
this
this
.
context
.
traceManager
.
getCurrentStep
(
nextProps
.
currentStepIndex
,
function
(
step
)
{
self
.
setState
({
step
:
step
})
this
.
context
.
traceManager
.
getCurrentStep
(
nextProps
.
currentStepIndex
,
function
(
error
,
step
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
step
:
step
})
}
})
this
.
context
.
traceManager
.
getMemExpand
(
nextProps
.
currentStepIndex
,
function
(
addmem
)
{
self
.
setState
({
addmemory
:
addmem
})
this
.
context
.
traceManager
.
getMemExpand
(
nextProps
.
currentStepIndex
,
function
(
error
,
addmem
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
addmemory
:
addmem
})
}
})
this
.
context
.
traceManager
.
getStepCost
(
nextProps
.
currentStepIndex
,
function
(
gas
)
{
self
.
setState
({
gas
:
gas
})
this
.
context
.
traceManager
.
getStepCost
(
nextProps
.
currentStepIndex
,
function
(
error
,
gas
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
gas
:
gas
})
}
})
this
.
context
.
traceManager
.
getRemainingGas
(
nextProps
.
currentStepIndex
,
function
(
remaingas
)
{
self
.
setState
({
remaininGas
:
remaingas
})
this
.
context
.
traceManager
.
getRemainingGas
(
nextProps
.
currentStepIndex
,
function
(
error
,
remaingas
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
self
.
setState
({
remaininGas
:
remaingas
})
}
})
}
})
src/storagePanel.js
View file @
505d7436
...
...
@@ -31,8 +31,10 @@ module.exports = React.createClass({
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
this
.
context
.
traceManager
.
getStorageAt
(
nextProps
.
currentStepIndex
,
this
.
context
.
tx
.
blockNumber
.
toString
(),
this
.
context
.
tx
.
transactionIndex
,
function
(
storage
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
this
.
context
.
traceManager
.
getStorageAt
(
nextProps
.
currentStepIndex
,
this
.
context
.
tx
.
blockNumber
.
toString
(),
this
.
context
.
tx
.
transactionIndex
,
function
(
error
,
storage
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
data
:
storage
})
...
...
src/traceManager.js
View file @
505d7436
...
...
@@ -136,14 +136,14 @@ module.exports = {
// API section
getLength
:
function
(
callback
)
{
if
(
!
this
.
trace
)
callback
(
0
)
callback
(
this
.
trace
.
length
)
if
(
!
this
.
trace
)
callback
(
'no trace available'
,
null
)
callback
(
null
,
this
.
trace
.
length
)
},
getStorageAt
:
function
(
stepIndex
,
blockNumber
,
txIndex
,
callback
)
{
var
stoChange
=
this
.
findLowerBound
(
stepIndex
,
this
.
vmTraceChangesRef
)
if
(
!
stoChange
)
{
return
{}
callback
(
'cannot rebuild storage'
,
null
)
}
var
changeRefs
=
this
.
vmTraceIndexByStorageChange
[
stoChange
]
...
...
@@ -160,20 +160,20 @@ module.exports = {
}
}
}
callback
(
storage
)
callback
(
null
,
storage
)
})
},
getCallDataAt
:
function
(
stepIndex
,
callback
)
{
var
callDataChange
=
this
.
findLowerBound
(
stepIndex
,
this
.
callDataChanges
)
if
(
!
callDataChange
)
return
[
''
]
callback
([
this
.
trace
[
callDataChange
].
calldata
])
if
(
!
callDataChange
)
return
callback
(
'no calldata found'
,
null
)
callback
(
null
,
[
this
.
trace
[
callDataChange
].
calldata
])
},
getCallStackAt
:
function
(
stepIndex
,
callback
)
{
var
callStackChange
=
this
.
findLowerBound
(
stepIndex
,
this
.
depthChanges
)
if
(
!
callStackChange
)
return
''
callback
(
this
.
callStack
[
callStackChange
].
stack
)
if
(
!
callStackChange
)
return
callback
(
'no callstack found'
,
null
)
callback
(
null
,
this
.
callStack
[
callStackChange
].
stack
)
},
getStackAt
:
function
(
stepIndex
,
callback
)
{
...
...
@@ -181,46 +181,52 @@ module.exports = {
if
(
this
.
trace
[
stepIndex
].
stack
)
{
// there's always a stack
stack
=
this
.
trace
[
stepIndex
].
stack
.
slice
(
0
)
stack
.
reverse
()
callback
(
stack
)
callback
(
null
,
stack
)
}
else
{
callback
(
'no stack found'
,
null
)
}
},
getLastDepthIndexChangeSince
:
function
(
stepIndex
,
callback
)
{
var
depthIndex
=
this
.
findLowerBound
(
stepIndex
,
this
.
depthChanges
)
callback
(
depthIndex
)
callback
(
null
,
depthIndex
)
},
getCurrentCalledAddressAt
:
function
(
stepIndex
,
callback
)
{
var
self
=
this
this
.
getLastDepthIndexChangeSince
(
stepIndex
,
function
(
addressIndex
)
{
callback
(
self
.
resolveAddress
(
addressIndex
))
this
.
getLastDepthIndexChangeSince
(
stepIndex
,
function
(
error
,
addressIndex
)
{
if
(
error
)
{
callback
(
error
,
null
)
}
else
{
callback
(
null
,
self
.
resolveAddress
(
addressIndex
))
}
})
},
getMemoryAt
:
function
(
stepIndex
,
callback
)
{
var
lastChanges
=
this
.
findLowerBound
(
stepIndex
,
this
.
memoryChanges
)
if
(
!
lastChanges
)
return
''
callback
(
this
.
trace
[
lastChanges
].
memory
)
if
(
!
lastChanges
)
return
callback
(
'no memory found'
,
null
)
callback
(
null
,
this
.
trace
[
lastChanges
].
memory
)
},
getCurrentPC
:
function
(
stepIndex
,
callback
)
{
callback
(
this
.
trace
[
stepIndex
].
pc
)
callback
(
null
,
this
.
trace
[
stepIndex
].
pc
)
},
getCurrentStep
:
function
(
stepIndex
,
callback
)
{
callback
(
this
.
trace
[
stepIndex
].
steps
)
callback
(
null
,
this
.
trace
[
stepIndex
].
steps
)
},
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
)
{
callback
(
this
.
trace
[
stepIndex
].
gascost
)
callback
(
null
,
this
.
trace
[
stepIndex
].
gascost
)
},
getRemainingGas
:
function
(
stepIndex
,
callback
)
{
callback
(
this
.
trace
[
stepIndex
].
gas
)
callback
(
null
,
this
.
trace
[
stepIndex
].
gas
)
},
// step section
...
...
src/vmDebugger.js
View file @
505d7436
...
...
@@ -73,8 +73,10 @@ module.exports = React.createClass({
if
(
nextProps
.
currentStepIndex
<
0
)
return
if
(
window
.
ethDebuggerSelectedItem
!==
nextProps
.
currentStepIndex
)
return
var
self
=
this
this
.
context
.
traceManager
.
getCurrentCalledAddressAt
(
nextProps
.
currentStepIndex
,
function
(
address
)
{
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
this
.
context
.
traceManager
.
getCurrentCalledAddressAt
(
nextProps
.
currentStepIndex
,
function
(
error
,
address
)
{
if
(
error
)
{
console
.
log
(
error
)
}
else
if
(
window
.
ethDebuggerSelectedItem
===
nextProps
.
currentStepIndex
)
{
self
.
setState
({
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