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
3df99cd3
Commit
3df99cd3
authored
Jan 05, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update TraceManager to use the new callstree
parent
858f17d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
36 deletions
+15
-36
traceManager.js
src/trace/traceManager.js
+9
-23
traceStepManager.js
src/trace/traceStepManager.js
+6
-13
No files found.
src/trace/traceManager.js
View file @
3df99cd3
...
@@ -101,14 +101,7 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback, address
...
@@ -101,14 +101,7 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback, address
}
}
TraceManager
.
prototype
.
getAddresses
=
function
(
callback
)
{
TraceManager
.
prototype
.
getAddresses
=
function
(
callback
)
{
var
addresses
=
[
this
.
tx
.
to
]
callback
(
null
,
this
.
traceCache
.
addresses
)
for
(
var
k
in
this
.
traceCache
.
calls
)
{
var
address
=
this
.
traceCache
.
calls
[
k
].
address
if
(
address
&&
addresses
.
join
(
''
).
indexOf
(
address
)
===
-
1
)
{
addresses
.
push
(
address
)
}
}
callback
(
null
,
addresses
)
}
}
TraceManager
.
prototype
.
getCallDataAt
=
function
(
stepIndex
,
callback
)
{
TraceManager
.
prototype
.
getCallDataAt
=
function
(
stepIndex
,
callback
)
{
...
@@ -126,9 +119,9 @@ TraceManager.prototype.getCallStackAt = function (stepIndex, callback) {
...
@@ -126,9 +119,9 @@ TraceManager.prototype.getCallStackAt = function (stepIndex, callback) {
if
(
check
)
{
if
(
check
)
{
return
callback
(
check
,
null
)
return
callback
(
check
,
null
)
}
}
var
call
StackChange
=
util
.
findLowerBoundValue
(
stepIndex
,
this
.
traceCache
.
callChanges
)
var
call
=
util
.
findCall
(
stepIndex
,
this
.
traceCache
.
callsTree
.
call
)
if
(
call
StackChange
===
null
)
return
callback
(
'no callstack found'
,
null
)
if
(
call
===
null
)
return
callback
(
'no callstack found'
,
null
)
callback
(
null
,
this
.
traceCache
.
calls
[
callStackChange
]
.
callStack
)
callback
(
null
,
call
.
callStack
)
}
}
TraceManager
.
prototype
.
getStackAt
=
function
(
stepIndex
,
callback
)
{
TraceManager
.
prototype
.
getStackAt
=
function
(
stepIndex
,
callback
)
{
...
@@ -151,7 +144,7 @@ TraceManager.prototype.getLastCallChangeSince = function (stepIndex, callback) {
...
@@ -151,7 +144,7 @@ TraceManager.prototype.getLastCallChangeSince = function (stepIndex, callback) {
if
(
check
)
{
if
(
check
)
{
return
callback
(
check
,
null
)
return
callback
(
check
,
null
)
}
}
var
callChange
=
util
.
find
LowerBoundValue
(
stepIndex
,
this
.
traceCache
.
callChanges
)
var
callChange
=
util
.
find
Call
(
stepIndex
,
this
.
traceCache
.
callsTree
.
call
)
if
(
callChange
===
null
)
{
if
(
callChange
===
null
)
{
callback
(
null
,
0
)
callback
(
null
,
0
)
}
else
{
}
else
{
...
@@ -164,21 +157,14 @@ TraceManager.prototype.getCurrentCalledAddressAt = function (stepIndex, callback
...
@@ -164,21 +157,14 @@ TraceManager.prototype.getCurrentCalledAddressAt = function (stepIndex, callback
if
(
check
)
{
if
(
check
)
{
return
callback
(
check
,
null
)
return
callback
(
check
,
null
)
}
}
var
self
=
this
this
.
getLastCallChangeSince
(
stepIndex
,
function
(
error
,
resp
)
{
this
.
getLastCallChangeSince
(
stepIndex
,
function
(
error
,
addressIndex
)
{
if
(
error
)
{
if
(
error
)
{
callback
(
error
,
null
)
callback
(
error
,
null
)
}
else
{
}
else
{
if
(
addressIndex
===
0
)
{
if
(
resp
)
{
callback
(
null
,
self
.
tx
.
to
)
callback
(
null
,
resp
.
address
)
}
else
{
}
else
{
var
callStack
=
self
.
traceCache
.
calls
[
addressIndex
].
callStack
callback
(
'unable to get current called address. '
+
stepIndex
+
' does not match with a CALL'
)
var
calledAddress
=
callStack
[
callStack
.
length
-
1
]
if
(
calledAddress
)
{
callback
(
null
,
calledAddress
)
}
else
{
callback
(
'unable to get current called address. '
+
stepIndex
+
' does not match with a CALL'
,
null
)
}
}
}
}
}
})
})
...
...
src/trace/traceStepManager.js
View file @
3df99cd3
...
@@ -33,25 +33,18 @@ TraceStepManager.prototype.findStepOverForward = function (currentStep) {
...
@@ -33,25 +33,18 @@ TraceStepManager.prototype.findStepOverForward = function (currentStep) {
}
}
TraceStepManager
.
prototype
.
findNextCall
=
function
(
currentStep
)
{
TraceStepManager
.
prototype
.
findNextCall
=
function
(
currentStep
)
{
var
callChanges
=
this
.
traceAnalyser
.
traceCache
.
callChanges
var
call
=
util
.
findCall
(
currentStep
,
this
.
traceAnalyser
.
traceCache
.
callsTree
.
call
)
var
stepIndex
=
util
.
findLowerBound
(
currentStep
,
callChanges
)
var
subCalls
=
Object
.
keys
(
call
.
calls
)
var
callchange
=
callChanges
[
stepIndex
+
1
]
if
(
subCalls
.
length
)
{
if
(
callchange
&&
this
.
isCallInstruction
(
callchange
-
1
))
{
return
call
.
calls
[
subCalls
[
0
]].
start
-
1
return
callchange
-
1
}
else
{
}
else
{
return
currentStep
return
currentStep
}
}
}
}
TraceStepManager
.
prototype
.
findStepOut
=
function
(
currentStep
)
{
TraceStepManager
.
prototype
.
findStepOut
=
function
(
currentStep
)
{
var
callChanges
=
this
.
traceAnalyser
.
traceCache
.
callChanges
var
call
=
util
.
findCall
(
currentStep
,
this
.
traceAnalyser
.
traceCache
.
callsTree
.
call
)
var
stepIndex
=
util
.
findLowerBound
(
currentStep
,
callChanges
)
return
call
.
return
var
call
=
this
.
traceAnalyser
.
traceCache
.
calls
[
callChanges
[
stepIndex
]]
if
(
call
&&
call
.
return
)
{
return
call
.
return
}
else
{
return
currentStep
}
}
}
module
.
exports
=
TraceStepManager
module
.
exports
=
TraceStepManager
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