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
80b87ef2
Commit
80b87ef2
authored
Dec 14, 2020
by
aniket-engg
Committed by
Aniket
Dec 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
traceManager and traceStepManager updated
parent
d2161740
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
37 deletions
+40
-37
traceManager.ts
libs/remix-debug/src/trace/traceManager.ts
+0
-0
traceStepManager.ts
libs/remix-debug/src/trace/traceStepManager.ts
+40
-37
No files found.
libs/remix-debug/src/trace/traceManager.ts
View file @
80b87ef2
This diff is collapsed.
Click to expand it.
libs/remix-debug/src/trace/traceStepManager.ts
View file @
80b87ef2
...
...
@@ -4,52 +4,55 @@ const traceHelper = require('./traceHelper')
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
const
util
=
remixLib
.
util
function
TraceStepManager
(
_traceAnalyser
)
{
this
.
traceAnalyser
=
_traceAnalyser
}
export
class
TraceStepManager
{
TraceStepManager
.
prototype
.
isCallInstruction
=
function
(
index
)
{
const
state
=
this
.
traceAnalyser
.
trace
[
index
]
return
traceHelper
.
isCallInstruction
(
state
)
&&
!
traceHelper
.
isCallToPrecompiledContract
(
index
,
this
.
traceAnalyser
.
trace
)
}
traceAnalyser
TraceStepManager
.
prototype
.
isReturnInstruction
=
function
(
index
)
{
const
state
=
this
.
traceAnalyser
.
trace
[
index
]
return
traceHelper
.
isReturnInstruction
(
state
)
}
constructor
(
_traceAnalyser
)
{
this
.
traceAnalyser
=
_traceAnalyser
}
TraceStepManager
.
prototype
.
findStepOverBack
=
function
(
currentStep
)
{
if
(
this
.
isReturnInstruction
(
currentStep
))
{
const
call
=
util
.
findCall
(
currentStep
,
this
.
traceAnalyser
.
traceCache
.
callsTree
.
call
)
return
call
.
start
>
0
?
call
.
start
-
1
:
0
isCallInstruction
(
index
)
{
const
state
=
this
.
traceAnalyser
.
trace
[
index
]
return
traceHelper
.
isCallInstruction
(
state
)
&&
!
traceHelper
.
isCallToPrecompiledContract
(
index
,
this
.
traceAnalyser
.
trace
)
}
return
currentStep
>
0
?
currentStep
-
1
:
0
}
TraceStepManager
.
prototype
.
findStepOverForward
=
function
(
currentStep
)
{
if
(
this
.
isCallInstruction
(
currentStep
))
{
const
call
=
util
.
findCall
(
currentStep
+
1
,
this
.
traceAnalyser
.
traceCache
.
callsTree
.
call
)
return
call
.
return
+
1
<
this
.
traceAnalyser
.
trace
.
length
?
call
.
return
+
1
:
this
.
traceAnalyser
.
trace
.
length
-
1
isReturnInstruction
(
index
)
{
const
state
=
this
.
traceAnalyser
.
trace
[
index
]
return
traceHelper
.
isReturnInstruction
(
state
)
}
findStepOverBack
(
currentStep
)
{
if
(
this
.
isReturnInstruction
(
currentStep
))
{
const
call
=
util
.
findCall
(
currentStep
,
this
.
traceAnalyser
.
traceCache
.
callsTree
.
call
)
return
call
.
start
>
0
?
call
.
start
-
1
:
0
}
return
currentStep
>
0
?
currentStep
-
1
:
0
}
return
this
.
traceAnalyser
.
trace
.
length
>=
currentStep
+
1
?
currentStep
+
1
:
currentStep
}
TraceStepManager
.
prototype
.
findNextCall
=
function
(
currentStep
)
{
const
call
=
util
.
findCall
(
currentStep
,
this
.
traceAnalyser
.
traceCache
.
callsTree
.
call
)
const
subCalls
=
Object
.
keys
(
call
.
calls
)
if
(
subCalls
.
length
)
{
var
callStart
=
util
.
findLowerBound
(
currentStep
,
subCalls
)
+
1
if
(
subCalls
.
length
>
callStart
)
{
return
subCalls
[
callStart
]
-
1
findStepOverForward
(
currentStep
)
{
if
(
this
.
isCallInstruction
(
currentStep
))
{
const
call
=
util
.
findCall
(
currentStep
+
1
,
this
.
traceAnalyser
.
traceCache
.
callsTree
.
call
)
return
call
.
return
+
1
<
this
.
traceAnalyser
.
trace
.
length
?
call
.
return
+
1
:
this
.
traceAnalyser
.
trace
.
length
-
1
}
return
this
.
traceAnalyser
.
trace
.
length
>=
currentStep
+
1
?
currentStep
+
1
:
currentStep
}
findNextCall
(
currentStep
)
{
const
call
=
util
.
findCall
(
currentStep
,
this
.
traceAnalyser
.
traceCache
.
callsTree
.
call
)
const
subCalls
=
Object
.
keys
(
call
.
calls
)
if
(
subCalls
.
length
)
{
var
callStart
=
util
.
findLowerBound
(
currentStep
,
subCalls
)
+
1
if
(
subCalls
.
length
>
callStart
)
{
return
parseInt
(
subCalls
[
callStart
])
-
1
}
return
currentStep
}
return
currentStep
}
return
currentStep
}
TraceStepManager
.
prototype
.
findStepOut
=
function
(
currentStep
)
{
const
call
=
util
.
findCall
(
currentStep
,
this
.
traceAnalyser
.
traceCache
.
callsTree
.
call
)
return
call
.
return
findStepOut
(
currentStep
)
{
const
call
=
util
.
findCall
(
currentStep
,
this
.
traceAnalyser
.
traceCache
.
callsTree
.
call
)
return
call
.
return
}
}
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