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
c055231b
Commit
c055231b
authored
Aug 28, 2020
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify BreakpointManager
parent
50316a6a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
9 deletions
+30
-9
Ethdebugger.js
libs/remix-debug/src/Ethdebugger.js
+1
-0
breakpointManager.js
libs/remix-debug/src/code/breakpointManager.js
+15
-7
debugger.js
libs/remix-debug/src/debugger/debugger.js
+7
-1
debugger.js
libs/remix-debug/test/debugger.js
+7
-1
No files found.
libs/remix-debug/src/Ethdebugger.js
View file @
c055231b
...
@@ -46,6 +46,7 @@ Ethdebugger.prototype.setManagers = function () {
...
@@ -46,6 +46,7 @@ Ethdebugger.prototype.setManagers = function () {
this
.
storageResolver
=
null
this
.
storageResolver
=
null
this
.
callTree
=
new
InternalCallTree
(
this
.
event
,
this
.
traceManager
,
this
.
solidityProxy
,
this
.
codeManager
,
{
includeLocalVariables
:
true
})
this
.
callTree
=
new
InternalCallTree
(
this
.
event
,
this
.
traceManager
,
this
.
solidityProxy
,
this
.
codeManager
,
{
includeLocalVariables
:
true
})
this
.
event
.
trigger
(
'managersChanged'
)
}
}
Ethdebugger
.
prototype
.
resolveStep
=
function
(
index
)
{
Ethdebugger
.
prototype
.
resolveStep
=
function
(
index
)
{
...
...
libs/remix-debug/src/code/breakpointManager.js
View file @
c055231b
...
@@ -15,14 +15,22 @@ class BreakpointManager {
...
@@ -15,14 +15,22 @@ class BreakpointManager {
* @param {Object} _debugger - type of EthDebugger
* @param {Object} _debugger - type of EthDebugger
* @return {Function} _locationToRowConverter - function implemented by editor which return a column/line position for a char source location
* @return {Function} _locationToRowConverter - function implemented by editor which return a column/line position for a char source location
*/
*/
constructor
(
_debugger
,
_locationToRowConverter
)
{
constructor
(
{
traceManager
,
callTree
,
solidityProxy
,
locationToRowConverter
}
)
{
this
.
event
=
new
EventManager
()
this
.
event
=
new
EventManager
()
this
.
debugger
=
_debugger
this
.
traceManager
=
traceManager
this
.
callTree
=
callTree
this
.
solidityProxy
=
solidityProxy
this
.
breakpoints
=
{}
this
.
breakpoints
=
{}
this
.
locationToRowConverter
=
_
locationToRowConverter
this
.
locationToRowConverter
=
locationToRowConverter
this
.
previousLine
this
.
previousLine
}
}
setManagers
({
traceManager
,
callTree
,
solidityProxy
})
{
this
.
traceManager
=
traceManager
this
.
callTree
=
callTree
this
.
solidityProxy
=
solidityProxy
}
/**
/**
* start looking for the next breakpoint
* start looking for the next breakpoint
* @param {Bool} defaultToLimit - if true jump to the end of the trace if no more breakpoint found
* @param {Bool} defaultToLimit - if true jump to the end of the trace if no more breakpoint found
...
@@ -32,7 +40,7 @@ class BreakpointManager {
...
@@ -32,7 +40,7 @@ class BreakpointManager {
if
(
!
this
.
locationToRowConverter
)
{
if
(
!
this
.
locationToRowConverter
)
{
return
console
.
log
(
'row converter not provided'
)
return
console
.
log
(
'row converter not provided'
)
}
}
this
.
jump
(
fromStep
||
0
,
1
,
defaultToLimit
,
this
.
debugger
.
traceManager
.
trace
)
this
.
jump
(
fromStep
||
0
,
1
,
defaultToLimit
,
this
.
traceManager
.
trace
)
}
}
/**
/**
...
@@ -44,7 +52,7 @@ class BreakpointManager {
...
@@ -44,7 +52,7 @@ class BreakpointManager {
if
(
!
this
.
locationToRowConverter
)
{
if
(
!
this
.
locationToRowConverter
)
{
return
console
.
log
(
'row converter not provided'
)
return
console
.
log
(
'row converter not provided'
)
}
}
this
.
jump
(
fromStep
||
0
,
-
1
,
defaultToLimit
,
this
.
debugger
.
traceManager
.
trace
)
this
.
jump
(
fromStep
||
0
,
-
1
,
defaultToLimit
,
this
.
traceManager
.
trace
)
}
}
depthChange
(
step
,
trace
)
{
depthChange
(
step
,
trace
)
{
...
@@ -80,7 +88,7 @@ class BreakpointManager {
...
@@ -80,7 +88,7 @@ class BreakpointManager {
while
(
currentStep
>
0
&&
currentStep
<
trace
.
length
)
{
while
(
currentStep
>
0
&&
currentStep
<
trace
.
length
)
{
try
{
try
{
previousSourceLocation
=
sourceLocation
previousSourceLocation
=
sourceLocation
sourceLocation
=
await
this
.
debugger
.
callTree
.
extractValidSourceLocation
(
currentStep
)
sourceLocation
=
await
this
.
callTree
.
extractValidSourceLocation
(
currentStep
)
}
catch
(
e
)
{
}
catch
(
e
)
{
return
console
.
log
(
'cannot jump to breakpoint '
+
e
)
return
console
.
log
(
'cannot jump to breakpoint '
+
e
)
}
}
...
@@ -121,7 +129,7 @@ class BreakpointManager {
...
@@ -121,7 +129,7 @@ class BreakpointManager {
* @return {Bool} return true if the given @arg fileIndex @arg line refers to a breakpoint
* @return {Bool} return true if the given @arg fileIndex @arg line refers to a breakpoint
*/
*/
hasBreakpointAtLine
(
fileIndex
,
line
)
{
hasBreakpointAtLine
(
fileIndex
,
line
)
{
const
filename
=
this
.
debugger
.
solidityProxy
.
fileNameFromIndex
(
fileIndex
)
const
filename
=
this
.
solidityProxy
.
fileNameFromIndex
(
fileIndex
)
if
(
!
(
filename
&&
this
.
breakpoints
[
filename
]))
{
if
(
!
(
filename
&&
this
.
breakpoints
[
filename
]))
{
return
false
return
false
}
}
...
...
libs/remix-debug/src/debugger/debugger.js
View file @
c055231b
...
@@ -21,10 +21,16 @@ function Debugger (options) {
...
@@ -21,10 +21,16 @@ function Debugger (options) {
compilationResult
:
this
.
compilationResult
compilationResult
:
this
.
compilationResult
})
})
this
.
breakPointManager
=
new
BreakpointManager
(
this
.
debugger
,
async
(
sourceLocation
)
=>
{
const
{
traceManager
,
callTree
,
solidityProxy
}
=
this
.
debugger
this
.
breakPointManager
=
new
BreakpointManager
({
traceManager
,
callTree
,
solidityProxy
,
locationToRowConverter
:
async
(
sourceLocation
)
=>
{
const
compilationResult
=
await
this
.
compilationResult
()
const
compilationResult
=
await
this
.
compilationResult
()
if
(
!
compilationResult
)
return
{
start
:
null
,
end
:
null
}
if
(
!
compilationResult
)
return
{
start
:
null
,
end
:
null
}
return
this
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
sourceLocation
,
sourceLocation
.
file
,
compilationResult
.
source
.
sources
,
compilationResult
.
data
.
sources
)
return
this
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
sourceLocation
,
sourceLocation
.
file
,
compilationResult
.
source
.
sources
,
compilationResult
.
data
.
sources
)
}})
this
.
breakPointManager
.
event
.
register
(
'managersChanged'
,
()
=>
{
const
{
traceManager
,
callTree
,
solidityProxy
}
=
this
.
debugger
this
.
breakPointManager
.
setManagers
({
traceManager
,
callTree
,
solidityProxy
})
})
})
this
.
breakPointManager
.
event
.
register
(
'breakpointStep'
,
(
step
)
=>
{
this
.
breakPointManager
.
event
.
register
(
'breakpointStep'
,
(
step
)
=>
{
...
...
libs/remix-debug/test/debugger.js
View file @
c055231b
...
@@ -273,8 +273,14 @@ function testDebugging (debugManager) {
...
@@ -273,8 +273,14 @@ function testDebugging (debugManager) {
tape
(
'breakPointManager'
,
(
t
)
=>
{
tape
(
'breakPointManager'
,
(
t
)
=>
{
t
.
plan
(
2
)
t
.
plan
(
2
)
var
sourceMappingDecoder
=
new
SourceMappingDecoder
()
var
sourceMappingDecoder
=
new
SourceMappingDecoder
()
var
breakPointManager
=
new
BreakpointManager
(
debugManager
,
(
rawLocation
)
=>
{
const
{
traceManager
,
callTree
,
solidityProxy
}
=
debugManager
var
breakPointManager
=
new
BreakpointManager
({
traceManager
,
callTree
,
solidityProxy
,
locationToRowConverter
:
async
(
rawLocation
)
=>
{
return
sourceMappingDecoder
.
convertOffsetToLineColumn
(
rawLocation
,
sourceMappingDecoder
.
getLinebreakPositions
(
ballot
))
return
sourceMappingDecoder
.
convertOffsetToLineColumn
(
rawLocation
,
sourceMappingDecoder
.
getLinebreakPositions
(
ballot
))
}})
breakPointManager
.
event
.
register
(
'managersChanged'
,
()
=>
{
const
{
traceManager
,
callTree
,
solidityProxy
}
=
debugManager
breakPointManager
.
setManagers
({
traceManager
,
callTree
,
solidityProxy
})
})
})
breakPointManager
.
add
({
fileName
:
'test.sol'
,
row
:
38
})
breakPointManager
.
add
({
fileName
:
'test.sol'
,
row
:
38
})
...
...
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