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
80b1017c
Commit
80b1017c
authored
Feb 06, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use row position instead of char location
parent
4072af01
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
25 deletions
+23
-25
breakpointManager.js
src/code/breakpointManager.js
+23
-25
No files found.
src/code/breakpointManager.js
View file @
80b1017c
...
...
@@ -2,42 +2,45 @@
var
EventManager
=
require
(
'../lib/eventManager'
)
class
breakpointManager
{
constructor
(
_debugger
)
{
constructor
(
_debugger
,
_locationToRowConverter
)
{
this
.
event
=
new
EventManager
()
this
.
debugger
=
_debugger
this
.
breakpoints
=
{}
this
.
isPlaying
=
false
this
.
breakpointHits
=
{}
this
.
locationToRowConverter
=
_locationToRowConverter
this
.
currentLine
}
async
play
()
{
if
(
this
.
hasBreakpoint
())
{
this
.
isPlaying
=
true
var
sourceLocation
for
(
var
currentStep
=
this
.
debugger
.
currentStepIndex
;
currentStep
<
this
.
debugger
.
traceManager
.
trace
.
length
;
currentStep
++
)
{
try
{
sourceLocation
=
await
this
.
debugger
.
callTree
.
extractSourceLocation
(
currentStep
)
}
catch
(
e
)
{
console
.
log
(
'cannot jump to breakpoint '
+
e
.
message
)
}
if
(
this
.
checkSourceLocation
(
sourceLocation
,
currentStep
))
{
this
.
debugger
.
stepManager
.
jumpTo
(
currentStep
)
this
.
event
.
trigger
(
'breakpointHit'
,
[
sourceLocation
])
break
this
.
isPlaying
=
true
var
sourceLocation
for
(
var
currentStep
=
this
.
debugger
.
currentStepIndex
+
1
;
currentStep
<
this
.
debugger
.
traceManager
.
trace
.
length
;
currentStep
++
)
{
try
{
sourceLocation
=
await
this
.
debugger
.
callTree
.
extractSourceLocation
(
currentStep
)
}
catch
(
e
)
{
console
.
log
(
'cannot jump to breakpoint '
+
e
.
message
)
}
if
(
this
.
locationToRowConverter
)
{
var
lineColumn
=
this
.
locationToRowConverter
(
sourceLocation
)
if
(
this
.
currentLine
===
lineColumn
.
start
.
line
)
{
continue
}
this
.
currentLine
=
lineColumn
.
start
.
line
}
if
(
this
.
checkSourceLocation
(
sourceLocation
,
currentStep
,
this
.
currentLine
))
{
this
.
debugger
.
stepManager
.
jumpTo
(
currentStep
)
this
.
event
.
trigger
(
'breakpointHit'
,
[
sourceLocation
])
break
}
}
}
checkSourceLocation
(
sourceLocation
,
currentStep
)
{
checkSourceLocation
(
sourceLocation
,
currentStep
,
currentLine
)
{
if
(
this
.
breakpoints
[
sourceLocation
.
file
])
{
var
sources
=
this
.
breakpoints
[
sourceLocation
.
file
]
for
(
var
k
in
sources
)
{
var
source
=
sources
[
k
]
if
(
sourceLocation
.
start
>=
source
.
start
&&
sourceLocation
.
start
<
source
.
end
&&
(
this
.
breakpointHits
[
source
.
file
][
source
.
row
]
===
currentStep
||
this
.
breakpointHits
[
source
.
file
][
source
.
row
]
===
-
1
))
{
this
.
breakpointHits
[
source
.
file
][
source
.
row
]
=
currentStep
if
(
currentLine
===
source
.
row
)
{
return
true
}
}
...
...
@@ -59,10 +62,6 @@ class breakpointManager {
this
.
breakpoints
[
sourceLocation
.
file
]
=
[]
}
this
.
breakpoints
[
sourceLocation
.
file
].
push
(
sourceLocation
)
if
(
!
this
.
breakpointHits
[
sourceLocation
.
file
])
{
this
.
breakpointHits
[
sourceLocation
.
file
]
=
{}
}
this
.
breakpointHits
[
sourceLocation
.
file
][
sourceLocation
.
row
]
=
-
1
}
remove
(
sourceLocation
)
{
...
...
@@ -72,7 +71,6 @@ class breakpointManager {
var
source
=
sources
[
k
]
if
(
sourceLocation
.
start
===
source
.
start
&&
sourceLocation
.
length
===
source
.
length
)
{
sources
.
splice
(
k
,
1
)
this
.
breakpointHits
[
sourceLocation
.
file
][
source
.
row
]
=
undefined
break
}
}
...
...
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