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
2e4e965f
Commit
2e4e965f
authored
Feb 09, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add jumpPreviousBreakpoint
parent
37eff056
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
3 deletions
+36
-3
breakpointManager.js
src/code/breakpointManager.js
+32
-3
traceHelper.js
src/helpers/traceHelper.js
+4
-0
No files found.
src/code/breakpointManager.js
View file @
2e4e965f
'use strict'
var
EventManager
=
require
(
'../lib/eventManager'
)
var
helper
=
require
(
'../helpers/traceHelper'
)
/**
* allow to manage breakpoint
...
...
@@ -50,10 +51,26 @@ class BreakpointManager {
console
.
log
(
'row converter not provided'
)
return
}
function
hitLine
(
currentStep
,
sourceLocation
,
self
)
{
if
(
helper
.
isJumpDestInstruction
(
self
.
debugger
.
traceManager
.
trace
[
currentStep
])
||
helper
.
isReturnInstruction
(
self
.
debugger
.
traceManager
.
trace
[
currentStep
-
1
])
||
helper
.
isStopInstruction
(
self
.
debugger
.
traceManager
.
trace
[
currentStep
-
1
]))
{
return
false
}
else
{
self
.
debugger
.
stepManager
.
jumpTo
(
currentStep
)
self
.
event
.
trigger
(
'breakpointHit'
,
[
sourceLocation
])
return
true
}
}
var
sourceLocation
var
previousSourceLocation
var
currentStep
=
this
.
debugger
.
currentStepIndex
+
direction
var
lineHadBreakpoint
=
false
while
(
currentStep
>
0
&&
currentStep
<
this
.
debugger
.
traceManager
.
trace
.
length
)
{
try
{
previousSourceLocation
=
sourceLocation
sourceLocation
=
await
this
.
debugger
.
callTree
.
extractSourceLocation
(
currentStep
)
}
catch
(
e
)
{
console
.
log
(
'cannot jump to breakpoint '
+
e
)
...
...
@@ -61,11 +78,23 @@ class BreakpointManager {
}
var
lineColumn
=
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
if
(
hitLine
(
currentStep
+
1
,
previousSourceLocation
,
this
))
{
break
}
else
{
lineHadBreakpoint
=
false
}
}
this
.
previousLine
=
lineColumn
.
start
.
line
if
(
this
.
hasBreakpointAtLine
(
sourceLocation
.
file
,
lineColumn
.
start
.
line
))
{
this
.
debugger
.
stepManager
.
jumpTo
(
currentStep
)
this
.
event
.
trigger
(
'breakpointHit'
,
[
sourceLocation
])
break
lineHadBreakpoint
=
true
if
(
direction
===
1
)
{
if
(
hitLine
(
currentStep
,
sourceLocation
,
this
))
{
break
}
else
{
lineHadBreakpoint
=
false
}
}
}
}
currentStep
+=
direction
...
...
src/helpers/traceHelper.js
View file @
2e4e965f
...
...
@@ -25,6 +25,10 @@ module.exports = {
return
step
.
op
===
'RETURN'
},
isJumpDestInstruction
:
function
(
step
)
{
return
step
.
op
===
'JUMPDEST'
},
isStopInstruction
:
function
(
step
)
{
return
step
.
op
===
'STOP'
},
...
...
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