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
50316a6a
Commit
50316a6a
authored
Aug 27, 2020
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify jump section
parent
e4e1f8a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
33 deletions
+33
-33
breakpointManager.js
libs/remix-debug/src/code/breakpointManager.js
+33
-33
No files found.
libs/remix-debug/src/code/breakpointManager.js
View file @
50316a6a
...
...
@@ -29,7 +29,10 @@ class BreakpointManager {
*
*/
async
jumpNextBreakpoint
(
fromStep
,
defaultToLimit
)
{
this
.
jump
(
fromStep
||
0
,
1
,
defaultToLimit
)
if
(
!
this
.
locationToRowConverter
)
{
return
console
.
log
(
'row converter not provided'
)
}
this
.
jump
(
fromStep
||
0
,
1
,
defaultToLimit
,
this
.
debugger
.
traceManager
.
trace
)
}
/**
...
...
@@ -38,7 +41,29 @@ class BreakpointManager {
*
*/
async
jumpPreviousBreakpoint
(
fromStep
,
defaultToLimit
)
{
this
.
jump
(
fromStep
||
0
,
-
1
,
defaultToLimit
)
if
(
!
this
.
locationToRowConverter
)
{
return
console
.
log
(
'row converter not provided'
)
}
this
.
jump
(
fromStep
||
0
,
-
1
,
defaultToLimit
,
this
.
debugger
.
traceManager
.
trace
)
}
depthChange
(
step
,
trace
)
{
return
trace
[
step
].
depth
!==
trace
[
step
-
1
].
depth
}
hitLine
(
currentStep
,
sourceLocation
,
previousSourceLocation
,
trace
)
{
// isJumpDestInstruction -> returning from a internal function call
// depthChange -> returning from an external call
// sourceLocation.start <= previousSourceLocation.start && ... -> previous src is contained in the current one
if
((
helper
.
isJumpDestInstruction
(
trace
[
currentStep
])
&&
previousSourceLocation
.
jump
===
'o'
)
||
this
.
depthChange
(
currentStep
,
trace
)
||
(
sourceLocation
.
start
<=
previousSourceLocation
.
start
&&
sourceLocation
.
start
+
sourceLocation
.
length
>=
previousSourceLocation
.
start
+
previousSourceLocation
.
length
))
{
return
false
}
this
.
event
.
trigger
(
'breakpointStep'
,
[
currentStep
])
this
.
event
.
trigger
(
'breakpointHit'
,
[
sourceLocation
,
currentStep
])
return
true
}
/**
...
...
@@ -47,55 +72,30 @@ class BreakpointManager {
* @param {Bool} defaultToLimit - if true jump to the limit (end if direction is 1, beginning if direction is -1) of the trace if no more breakpoint found
*
*/
async
jump
(
fromStep
,
direction
,
defaultToLimit
)
{
if
(
!
this
.
locationToRowConverter
)
{
console
.
log
(
'row converter not provided'
)
return
}
function
depthChange
(
step
,
trace
)
{
return
trace
[
step
].
depth
!==
trace
[
step
-
1
].
depth
}
function
hitLine
(
currentStep
,
sourceLocation
,
previousSourceLocation
,
self
)
{
// isJumpDestInstruction -> returning from a internal function call
// depthChange -> returning from an external call
// sourceLocation.start <= previousSourceLocation.start && ... -> previous src is contained in the current one
if
((
helper
.
isJumpDestInstruction
(
self
.
debugger
.
traceManager
.
trace
[
currentStep
])
&&
previousSourceLocation
.
jump
===
'o'
)
||
depthChange
(
currentStep
,
self
.
debugger
.
traceManager
.
trace
)
||
(
sourceLocation
.
start
<=
previousSourceLocation
.
start
&&
sourceLocation
.
start
+
sourceLocation
.
length
>=
previousSourceLocation
.
start
+
previousSourceLocation
.
length
))
{
return
false
}
self
.
event
.
trigger
(
'breakpointStep'
,
[
currentStep
])
self
.
event
.
trigger
(
'breakpointHit'
,
[
sourceLocation
,
currentStep
])
return
true
}
async
jump
(
fromStep
,
direction
,
defaultToLimit
,
trace
)
{
let
sourceLocation
let
previousSourceLocation
let
currentStep
=
fromStep
+
direction
let
lineHadBreakpoint
=
false
while
(
currentStep
>
0
&&
currentStep
<
t
his
.
debugger
.
traceManager
.
t
race
.
length
)
{
while
(
currentStep
>
0
&&
currentStep
<
trace
.
length
)
{
try
{
previousSourceLocation
=
sourceLocation
sourceLocation
=
await
this
.
debugger
.
callTree
.
extractValidSourceLocation
(
currentStep
)
}
catch
(
e
)
{
console
.
log
(
'cannot jump to breakpoint '
+
e
)
return
return
console
.
log
(
'cannot jump to breakpoint '
+
e
)
}
let
lineColumn
=
await
this
.
locationToRowConverter
(
sourceLocation
)
if
(
this
.
previousLine
!==
lineColumn
.
start
.
line
)
{
if
(
direction
===
-
1
&&
lineHadBreakpoint
)
{
// TODO : improve this when we will build the correct structure before hand
lineHadBreakpoint
=
false
if
(
hitLine
(
currentStep
+
1
,
previousSourceLocation
,
sourceLocation
,
this
))
{
if
(
this
.
hitLine
(
currentStep
+
1
,
previousSourceLocation
,
sourceLocation
,
trace
))
{
return
}
}
this
.
previousLine
=
lineColumn
.
start
.
line
if
(
this
.
hasBreakpointAtLine
(
sourceLocation
.
file
,
lineColumn
.
start
.
line
))
{
lineHadBreakpoint
=
true
if
(
direction
===
1
&&
hitLine
(
currentStep
,
sourceLocation
,
previousSourceLocation
,
this
))
{
if
(
direction
===
1
&&
this
.
hitLine
(
currentStep
,
sourceLocation
,
previousSourceLocation
,
trace
))
{
return
}
}
...
...
@@ -109,7 +109,7 @@ class BreakpointManager {
if
(
direction
===
-
1
)
{
this
.
event
.
trigger
(
'breakpointStep'
,
[
0
])
}
else
if
(
direction
===
1
)
{
this
.
event
.
trigger
(
'breakpointStep'
,
[
t
his
.
debugger
.
traceManager
.
t
race
.
length
-
1
])
this
.
event
.
trigger
(
'breakpointStep'
,
[
trace
.
length
-
1
])
}
}
...
...
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