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
cf76ba27
Commit
cf76ba27
authored
Jul 12, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fix ui
- display full storage changes at the last RETURN - fix bug (display RETURN VALUE) - fix ui
parent
9305829a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
56 deletions
+74
-56
BasicPanel.js
src/BasicPanel.js
+5
-6
FullStoragesChanges.js
src/FullStoragesChanges.js
+43
-27
VmDebugger.js
src/VmDebugger.js
+16
-16
traceAnalyser.js
src/trace/traceAnalyser.js
+4
-3
traceManager.js
src/trace/traceManager.js
+6
-4
No files found.
src/BasicPanel.js
View file @
cf76ba27
...
@@ -3,10 +3,9 @@ var style = require('./styles/basicStyles')
...
@@ -3,10 +3,9 @@ var style = require('./styles/basicStyles')
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
var
ui
=
require
(
'./helpers/ui'
)
var
ui
=
require
(
'./helpers/ui'
)
function
BasicPanel
(
_name
,
_
id
,
_
width
,
_height
)
{
function
BasicPanel
(
_name
,
_width
,
_height
)
{
this
.
data
this
.
data
this
.
name
=
_name
this
.
name
=
_name
this
.
id
=
_id
this
.
width
=
_width
this
.
width
=
_width
this
.
height
=
_height
this
.
height
=
_height
this
.
view
this
.
view
...
@@ -17,20 +16,20 @@ BasicPanel.prototype.update = function () {
...
@@ -17,20 +16,20 @@ BasicPanel.prototype.update = function () {
}
}
BasicPanel
.
prototype
.
hide
=
function
()
{
BasicPanel
.
prototype
.
hide
=
function
()
{
document
.
getElementById
(
this
.
id
+
'container'
)
.
style
.
display
=
'none'
this
.
view
.
style
.
display
=
'none'
}
}
BasicPanel
.
prototype
.
show
=
function
()
{
BasicPanel
.
prototype
.
show
=
function
()
{
document
.
getElementById
(
this
.
id
+
'container'
)
.
style
.
display
=
'block'
this
.
view
.
style
.
display
=
'block'
}
}
BasicPanel
.
prototype
.
render
=
function
()
{
BasicPanel
.
prototype
.
render
=
function
()
{
var
view
=
yo
`<div id='
${
this
.
id
}
container' style=
${
ui
.
formatCss
({
'width'
:
this
.
width
},
style
.
panel
.
container
)}
>
var
view
=
yo
`<div id='container' style=
${
ui
.
formatCss
({
'width'
:
this
.
width
},
style
.
panel
.
container
)}
>
<div style=
${
ui
.
formatCss
(
style
.
panel
.
title
)}
>
<div style=
${
ui
.
formatCss
(
style
.
panel
.
title
)}
>
${
this
.
name
}
${
this
.
name
}
</div>
</div>
<div style=
${
ui
.
formatCss
({
'height'
:
this
.
height
},
style
.
panel
.
tableContainer
)}
>
<div style=
${
ui
.
formatCss
({
'height'
:
this
.
height
},
style
.
panel
.
tableContainer
)}
>
<pre style=
${
ui
.
formatCss
(
style
.
panel
.
table
,
style
.
font
)}
id='basicpanel' >
${
this
.
data
}
</pre>
<pre style=
${
ui
.
formatCss
(
{
'width'
:
this
.
width
},
style
.
panel
.
table
,
style
.
font
)}
id='basicpanel' >
${
this
.
data
}
</pre>
</div>
</div>
</div>`
</div>`
if
(
!
this
.
view
)
{
if
(
!
this
.
view
)
{
...
...
src/FullStoragesChanges.js
View file @
cf76ba27
'use strict'
'use strict'
var
StoragePanel
=
require
(
'./Storage
Panel'
)
var
BasicPanel
=
require
(
'./Basic
Panel'
)
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
function
FullStoragesChanges
(
_parent
,
_traceManager
)
{
function
FullStoragesChanges
(
_parent
,
_traceManager
)
{
this
.
parent
=
_parent
this
.
parent
=
_parent
this
.
traceManager
=
_traceManager
this
.
traceManager
=
_traceManager
this
.
addresses
=
[]
this
.
view
this
.
traceLength
this
.
basicPanel
=
new
BasicPanel
(
'Full Storages Changes'
,
'1205px'
,
'100px'
)
this
.
init
()
this
.
init
()
this
.
panels
=
{}
}
}
FullStoragesChanges
.
prototype
.
render
=
function
()
{
FullStoragesChanges
.
prototype
.
render
=
function
()
{
return
yo
`<div><div>Full Storages Changes</div><div>
${
this
.
view
}
</div></div>`
var
view
=
yo
`<div id='fullstorageschangespanel' >
${
this
.
basicPanel
.
render
()}
</div>`
if
(
!
this
.
view
)
{
this
.
view
=
view
}
return
view
}
FullStoragesChanges
.
prototype
.
hide
=
function
()
{
this
.
view
.
style
.
display
=
'none'
}
FullStoragesChanges
.
prototype
.
show
=
function
()
{
this
.
view
.
style
.
display
=
'block'
}
}
FullStoragesChanges
.
prototype
.
init
=
function
()
{
FullStoragesChanges
.
prototype
.
init
=
function
()
{
var
self
=
this
var
self
=
this
this
.
parent
.
register
(
'newTraceLoaded'
,
this
,
function
(
length
)
{
this
.
parent
.
register
(
'newTraceLoaded'
,
this
,
function
(
length
)
{
self
.
panels
=
{}
self
.
panels
=
[]
self
.
traceManager
.
getAddresses
(
function
(
addresses
)
{
self
.
traceManager
.
getAddresses
(
function
(
error
,
addresses
)
{
for
(
var
k
in
addresses
)
{
if
(
!
error
)
{
self
.
panels
[
addresses
]
=
new
StoragePanel
(
self
.
traceManager
,
self
.
traceManager
,
k
)
self
.
addresses
=
addresses
self
.
panels
[
addresses
].
disable
=
true
self
.
basicPanel
.
data
=
''
yo
.
update
(
self
.
view
,
self
.
render
())
self
.
hide
()
}
})
self
.
traceManager
.
getLength
(
function
(
error
,
length
)
{
if
(
!
error
)
{
self
.
traceLength
=
length
}
}
})
})
})
})
...
@@ -29,29 +52,22 @@ FullStoragesChanges.prototype.init = function () {
...
@@ -29,29 +52,22 @@ FullStoragesChanges.prototype.init = function () {
if
(
index
<
0
)
return
if
(
index
<
0
)
return
if
(
self
.
parent
.
currentStepIndex
!==
index
)
return
if
(
self
.
parent
.
currentStepIndex
!==
index
)
return
self
.
traceManager
.
getLength
(
function
(
error
,
length
)
{
if
(
index
===
self
.
traceLength
-
1
)
{
if
(
!
error
)
{
var
storageJSON
=
{}
for
(
var
k
in
self
.
panels
)
{
for
(
var
k
in
self
.
addresses
)
{
self
.
panels
[
k
].
disabled
=
index
!==
length
-
1
self
.
traceManager
.
getStorageAt
(
index
,
null
,
function
(
error
,
result
)
{
}
if
(
!
error
)
{
if
(
index
!==
length
-
1
)
{
storageJSON
[
self
.
addresses
[
k
]]
=
result
self
.
view
=
''
self
.
basicPanel
.
data
=
JSON
.
stringify
(
storageJSON
,
null
,
'
\
t'
)
if
(
self
.
view
)
{
yo
.
update
(
self
.
view
,
self
.
render
())
yo
.
update
(
self
.
view
,
self
.
render
())
self
.
show
()
}
}
}
}
,
self
.
addresses
[
k
])
}
}
})
}
else
{
self
.
hide
()
}
})
})
}
}
FullStoragesChanges
.
prototype
.
renderAssemblyItems
=
function
()
{
if
(
this
.
panels
)
{
this
.
codeView
=
this
.
panels
.
map
(
function
(
item
,
i
)
{
return
yo
`<div>
${
item
.
render
()}
</div>`
})
return
this
.
codeView
}
}
module
.
exports
=
FullStoragesChanges
module
.
exports
=
FullStoragesChanges
src/VmDebugger.js
View file @
cf76ba27
...
@@ -18,9 +18,9 @@ function VmDebugger (_parent, _traceManager, _web3) {
...
@@ -18,9 +18,9 @@ function VmDebugger (_parent, _traceManager, _web3) {
this
.
memoryPanel
=
new
MemoryPanel
(
_parent
,
_traceManager
)
this
.
memoryPanel
=
new
MemoryPanel
(
_parent
,
_traceManager
)
this
.
calldataPanel
=
new
CalldataPanel
(
_parent
,
_traceManager
)
this
.
calldataPanel
=
new
CalldataPanel
(
_parent
,
_traceManager
)
this
.
callstackPanel
=
new
CallstackPanel
(
_parent
,
_traceManager
)
this
.
callstackPanel
=
new
CallstackPanel
(
_parent
,
_traceManager
)
/* Return values - */
/* Return values - */
this
.
returnValuesPanel
=
new
BasicPanel
(
'Return Value
s'
,
'returnvalues'
,
'auto
'
,
'100px'
)
this
.
returnValuesPanel
=
new
BasicPanel
(
'Return Value
'
,
'1205px
'
,
'100px'
)
_parent
.
register
(
'indexChanged'
,
this
.
returnValuesPanel
,
function
(
index
)
{
_parent
.
register
(
'indexChanged'
,
this
.
returnValuesPanel
,
function
(
index
)
{
var
self
=
this
var
self
=
this
_traceManager
.
getReturnValue
(
index
,
function
(
error
,
returnValue
)
{
_traceManager
.
getReturnValue
(
index
,
function
(
error
,
returnValue
)
{
...
@@ -37,9 +37,9 @@ function VmDebugger (_parent, _traceManager, _web3) {
...
@@ -37,9 +37,9 @@ function VmDebugger (_parent, _traceManager, _web3) {
})
})
})
})
/* Return values - */
/* Return values - */
this
.
fullStoragesChangesPanel
=
new
FullStoragesChangesPanel
(
_parent
,
_traceManager
)
this
.
fullStoragesChangesPanel
=
new
FullStoragesChangesPanel
(
_parent
,
_traceManager
)
this
.
view
this
.
view
var
self
=
this
var
self
=
this
_parent
.
register
(
'newTraceLoaded'
,
this
,
function
()
{
_parent
.
register
(
'newTraceLoaded'
,
this
,
function
()
{
...
@@ -54,7 +54,17 @@ VmDebugger.prototype.render = function () {
...
@@ -54,7 +54,17 @@ VmDebugger.prototype.render = function () {
var
view
=
yo
`<div id='vmdebugger' style='display:none'>
var
view
=
yo
`<div id='vmdebugger' style='display:none'>
<div style=
${
ui
.
formatCss
(
style
.
container
)}
>
<div style=
${
ui
.
formatCss
(
style
.
container
)}
>
<table>
<table>
<tbody>
<tbody>
<tr>
<td colspan='2'>
${
this
.
returnValuesPanel
.
render
()}
</td>
</tr>
<tr>
<td colspan='2'>
${
this
.
fullStoragesChangesPanel
.
render
()}
</td>
</tr>
<tr>
<tr>
<td>
<td>
${
this
.
asmCode
.
render
()}
${
this
.
asmCode
.
render
()}
...
@@ -78,17 +88,7 @@ VmDebugger.prototype.render = function () {
...
@@ -78,17 +88,7 @@ VmDebugger.prototype.render = function () {
<td>
<td>
${
this
.
callstackPanel
.
render
()}
${
this
.
callstackPanel
.
render
()}
</td>
</td>
</tr>
</tr>
<tr>
<td colspan='2'>
${
this
.
returnValuesPanel
.
render
()}
</td>
</tr>
<tr>
<td colspan='2'>
${
this
.
fullStoragesChangesPanel
.
render
()}
</td>
</tr>
</tbody>
</tbody>
</table>
</table>
</div>
</div>
...
...
src/trace/traceAnalyser.js
View file @
cf76ba27
...
@@ -16,6 +16,7 @@ TraceAnalyser.prototype.analyse = function (trace, tx, callback) {
...
@@ -16,6 +16,7 @@ TraceAnalyser.prototype.analyse = function (trace, tx, callback) {
lastCallIndex
:
0
lastCallIndex
:
0
}
}
var
callStack
=
[
tx
.
to
]
var
callStack
=
[
tx
.
to
]
this
.
traceCache
.
pushCallChanges
(
0
,
0
,
callStack
[
0
])
this
.
traceCache
.
pushCallStack
(
0
,
{
this
.
traceCache
.
pushCallStack
(
0
,
{
callStack
:
callStack
.
slice
(
0
)
callStack
:
callStack
.
slice
(
0
)
})
})
...
@@ -36,8 +37,8 @@ TraceAnalyser.prototype.analyse = function (trace, tx, callback) {
...
@@ -36,8 +37,8 @@ TraceAnalyser.prototype.analyse = function (trace, tx, callback) {
TraceAnalyser
.
prototype
.
buildReturnValues
=
function
(
index
,
step
)
{
TraceAnalyser
.
prototype
.
buildReturnValues
=
function
(
index
,
step
)
{
if
(
traceHelper
.
isReturnInstruction
(
step
))
{
if
(
traceHelper
.
isReturnInstruction
(
step
))
{
var
offset
=
2
*
parseInt
(
step
.
stack
[
step
.
stack
.
length
-
1
])
var
offset
=
2
*
parseInt
(
step
.
stack
[
step
.
stack
.
length
-
1
]
,
16
)
var
size
=
2
*
parseInt
(
step
.
stack
[
step
.
stack
.
length
-
2
])
var
size
=
2
*
parseInt
(
step
.
stack
[
step
.
stack
.
length
-
2
]
,
16
)
var
memory
=
this
.
trace
[
this
.
traceCache
.
memoryChanges
[
this
.
traceCache
.
memoryChanges
.
length
-
1
]].
memory
var
memory
=
this
.
trace
[
this
.
traceCache
.
memoryChanges
[
this
.
traceCache
.
memoryChanges
.
length
-
1
]].
memory
this
.
traceCache
.
pushReturnValue
(
index
,
'0x'
+
memory
.
join
(
''
).
substr
(
offset
,
size
))
this
.
traceCache
.
pushReturnValue
(
index
,
'0x'
+
memory
.
join
(
''
).
substr
(
offset
,
size
))
}
}
...
@@ -76,7 +77,7 @@ TraceAnalyser.prototype.buildMemory = function (index, step) {
...
@@ -76,7 +77,7 @@ TraceAnalyser.prototype.buildMemory = function (index, step) {
}
}
TraceAnalyser
.
prototype
.
buildStorage
=
function
(
index
,
step
,
context
)
{
TraceAnalyser
.
prototype
.
buildStorage
=
function
(
index
,
step
,
context
)
{
if
(
traceHelper
.
newContextStorage
(
step
))
{
if
(
traceHelper
.
newContextStorage
(
step
)
&&
!
traceHelper
.
isCallToPrecompiledContract
(
index
,
this
.
trace
)
)
{
var
calledAddress
=
traceHelper
.
resolveCalledAddress
(
index
,
this
.
trace
)
var
calledAddress
=
traceHelper
.
resolveCalledAddress
(
index
,
this
.
trace
)
if
(
calledAddress
)
{
if
(
calledAddress
)
{
context
.
currentStorageAddress
=
calledAddress
context
.
currentStorageAddress
=
calledAddress
...
...
src/trace/traceManager.js
View file @
cf76ba27
...
@@ -78,9 +78,9 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback, address
...
@@ -78,9 +78,9 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback, address
if
(
check
)
{
if
(
check
)
{
return
callback
(
check
,
null
)
return
callback
(
check
,
null
)
}
}
var
stoChange
=
traceHelper
.
findLowerBound
(
stepIndex
,
this
.
traceCache
.
storageChanges
)
if
(
stoChange
===
undefined
)
return
callback
(
'no storage found'
,
null
)
if
(
!
address
)
{
if
(
!
address
)
{
var
stoChange
=
traceHelper
.
findLowerBound
(
stepIndex
,
this
.
traceCache
.
storageChanges
)
if
(
stoChange
===
undefined
)
return
callback
(
'no storage found'
,
null
)
address
=
this
.
traceCache
.
sstore
[
stoChange
].
address
address
=
this
.
traceCache
.
sstore
[
stoChange
].
address
}
}
var
storage
=
{}
var
storage
=
{}
...
@@ -107,9 +107,11 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback, address
...
@@ -107,9 +107,11 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback, address
}
}
TraceManager
.
prototype
.
getAddresses
=
function
(
callback
)
{
TraceManager
.
prototype
.
getAddresses
=
function
(
callback
)
{
var
addresses
=
{}
var
addresses
=
[
this
.
tx
.
to
]
for
(
var
k
in
this
.
traceCache
.
calls
)
{
for
(
var
k
in
this
.
traceCache
.
calls
)
{
addresses
[
this
.
traceCache
.
calls
[
k
].
address
]
=
''
if
(
this
.
traceCache
.
calls
[
k
].
address
)
{
addresses
.
push
(
this
.
traceCache
.
calls
[
k
].
address
)
}
}
}
callback
(
null
,
addresses
)
callback
(
null
,
addresses
)
}
}
...
...
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