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
9bb4a102
Commit
9bb4a102
authored
Nov 30, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add methods needed for solidity code navigation
parent
cbfcccf0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
0 deletions
+79
-0
index.js
remix-debug/src/cmdline/index.js
+46
-0
stepManager.js
remix-debug/src/debugger/stepManager.js
+33
-0
No files found.
remix-debug/src/cmdline/index.js
View file @
9bb4a102
...
...
@@ -81,9 +81,18 @@ class CmdLine {
return
source
}
getCurrentLine
()
{
let
lineColumnPos
=
this
.
lineColumnPos
if
(
!
lineColumnPos
)
return
""
let
currentLineNumber
=
lineColumnPos
.
start
.
line
let
content
=
this
.
compilation
.
lastCompilationResult
.
source
.
sources
[
this
.
filename
].
content
.
split
(
"
\
n"
)
return
content
[
currentLineNumber
]
}
startDebug
(
txNumber
,
filename
,
cb
)
{
const
self
=
this
this
.
filename
=
filename
this
.
txHash
=
txNumber
this
.
debugger
.
debug
(
null
,
txNumber
,
null
,
()
=>
{
self
.
debugger
.
event
.
register
(
'newSourceLocation'
,
function
(
lineColumnPos
,
rawLocation
)
{
...
...
@@ -111,6 +120,13 @@ class CmdLine {
})
}
getVars
()
{
return
{
locals
:
this
.
solidityLocals
,
contract
:
this
.
solidityState
}
}
triggerSourceUpdate
()
{
this
.
events
.
emit
(
"source"
,
[
this
.
lineColumnPos
,
this
.
rawLocation
])
}
...
...
@@ -144,13 +160,43 @@ class CmdLine {
}
getTraceLength
()
{
if
(
!
this
.
debugger
.
step_manager
)
return
0
;
return
this
.
debugger
.
step_manager
.
traceLength
}
getCodeFirstStep
()
{
if
(
!
this
.
debugger
.
step_manager
)
return
0
;
return
this
.
debugger
.
step_manager
.
calculateFirstStep
()
}
getCodeTraceLength
()
{
if
(
!
this
.
debugger
.
step_manager
)
return
0
;
return
this
.
debugger
.
step_manager
.
calculateCodeLength
()
}
nextStep
()
{
if
(
!
this
.
debugger
.
step_manager
)
return
0
;
return
this
.
debugger
.
step_manager
.
nextStep
()
}
previousStep
()
{
if
(
!
this
.
debugger
.
step_manager
)
return
0
;
return
this
.
debugger
.
step_manager
.
previousStep
()
}
currentStep
()
{
if
(
!
this
.
debugger
.
step_manager
)
return
0
;
return
this
.
debugger
.
step_manager
.
currentStepIndex
}
canGoNext
()
{
return
this
.
currentStep
()
<
this
.
getCodeTraceLength
()
}
canGoPrevious
()
{
return
this
.
currentStep
()
>
this
.
getCodeFirstStep
()
}
unload
()
{
return
this
.
debugger
.
unload
()
}
...
...
remix-debug/src/debugger/stepManager.js
View file @
9bb4a102
...
...
@@ -10,6 +10,7 @@ class DebuggerStepManager {
this
.
traceManager
=
traceManager
this
.
currentStepIndex
=
0
this
.
traceLength
=
0
this
.
codeTraceLength
=
0
this
.
revertionPoint
=
null
this
.
listenToEvents
()
...
...
@@ -26,6 +27,7 @@ class DebuggerStepManager {
if
(
self
.
traceLength
!==
newLength
)
{
self
.
event
.
trigger
(
'traceLengthChanged'
,
[
newLength
])
self
.
traceLength
=
newLength
self
.
codeTraceLength
=
self
.
calculateCodeLength
()
}
self
.
jumpTo
(
0
)
})
...
...
@@ -156,6 +158,37 @@ class DebuggerStepManager {
this
.
debugger
.
breakpointManager
.
jumpPreviousBreakpoint
(
this
.
currentStepIndex
,
true
)
}
calculateFirstStep
()
{
let
step
=
this
.
resolveToReducedTrace
(
0
,
1
)
return
this
.
resolveToReducedTrace
(
step
,
1
)
}
calculateCodeStepList
()
{
let
step
=
0
let
steps
=
[]
while
(
step
<
this
.
traceLength
)
{
let
_step
=
this
.
resolveToReducedTrace
(
step
,
1
)
if
(
!
_step
)
break
;
steps
.
push
(
_step
)
step
+=
1
}
steps
=
steps
.
filter
((
item
,
pos
,
self
)
=>
{
return
steps
.
indexOf
(
item
)
===
pos
})
return
steps
}
calculateCodeLength
()
{
let
steps
=
this
.
calculateCodeStepList
().
reverse
()
return
this
.
calculateCodeStepList
().
reverse
()[
1
]
||
this
.
traceLength
;
}
nextStep
()
{
return
this
.
resolveToReducedTrace
(
this
.
currentStepIndex
,
1
);
}
previousStep
()
{
return
this
.
resolveToReducedTrace
(
this
.
currentStepIndex
,
-
1
);
}
resolveToReducedTrace
(
value
,
incr
)
{
if
(
this
.
debugger
.
callTree
.
reducedTrace
.
length
)
{
var
nextSource
=
util
.
findClosestIndex
(
value
,
this
.
debugger
.
callTree
.
reducedTrace
)
...
...
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