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
bdad659a
Commit
bdad659a
authored
Jan 05, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add buildCallsPath to Util
parent
9f7bf14a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
util.js
src/helpers/util.js
+22
-2
traceManager.js
src/trace/traceManager.js
+10
-0
No files found.
src/helpers/util.js
View file @
bdad659a
...
...
@@ -85,7 +85,21 @@ module.exports = {
return
index
>=
0
?
array
[
index
]
:
null
},
findCall
:
findCall
findCall
:
findCall
,
buildCallsPath
:
buildCallsPath
}
/**
* Find calls path from @args rootCall which leads to @args index (recursive)
*
* @param {Int} index - index of the vmtrace
* @param {Object} rootCall - call tree, built by the trace analyser
* @return {Array} - return the calls path to @args index
*/
function
buildCallsPath
(
index
,
rootCall
)
{
var
ret
=
[]
findCallInternal
(
index
,
rootCall
,
ret
)
return
ret
}
/**
...
...
@@ -96,12 +110,18 @@ module.exports = {
* @return {Object} - return the call which include the @args index
*/
function
findCall
(
index
,
rootCall
)
{
var
ret
=
buildCallsPath
(
index
,
rootCall
)
return
ret
[
ret
.
length
-
1
]
}
function
findCallInternal
(
index
,
rootCall
,
callsPath
)
{
var
calls
=
Object
.
keys
(
rootCall
.
calls
)
var
ret
=
rootCall
callsPath
.
push
(
rootCall
)
for
(
var
k
in
calls
)
{
var
subCall
=
rootCall
.
calls
[
calls
[
k
]]
if
(
index
>=
subCall
.
start
&&
index
<=
subCall
.
return
)
{
ret
=
findCall
(
index
,
subCall
)
findCallInternal
(
index
,
subCall
,
callsPath
)
break
}
}
...
...
src/trace/traceManager.js
View file @
bdad659a
...
...
@@ -114,6 +114,16 @@ TraceManager.prototype.getCallDataAt = function (stepIndex, callback) {
callback
(
null
,
[
this
.
traceCache
.
callsData
[
callDataChange
]])
}
TraceManager
.
prototype
.
buildCallsPath
=
function
(
stepIndex
,
callback
)
{
var
check
=
this
.
checkRequestedStep
(
stepIndex
)
if
(
check
)
{
return
callback
(
check
,
null
)
}
var
callsPath
=
util
.
buildCallsPath
(
stepIndex
,
this
.
traceCache
.
callsTree
.
call
)
if
(
callsPath
===
null
)
return
callback
(
'no call path built'
,
null
)
callback
(
null
,
callsPath
)
}
TraceManager
.
prototype
.
getCallStackAt
=
function
(
stepIndex
,
callback
)
{
var
check
=
this
.
checkRequestedStep
(
stepIndex
)
if
(
check
)
{
...
...
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