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
dc1b07bc
Commit
dc1b07bc
authored
Oct 03, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move debugger to its own folder
parent
973907b8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
159 deletions
+15
-159
debugger.js
src/app/debugger/debugger.js
+0
-70
debugger.js
src/app/debugger/debugger/debugger.js
+15
-89
No files found.
src/app/debugger/debugger.js
deleted
100644 → 0
View file @
973907b8
'use strict'
var
Ethdebugger
=
require
(
'remix-debug'
).
EthDebugger
var
remixLib
=
require
(
'remix-lib'
)
var
EventManager
=
remixLib
.
EventManager
function
Debugger
(
options
)
{
var
self
=
this
this
.
event
=
new
EventManager
()
this
.
executionContext
=
options
.
executionContext
this
.
offsetToLineColumnConverter
=
options
.
offsetToLineColumnConverter
this
.
compiler
=
options
.
compiler
this
.
debugger
=
new
Ethdebugger
(
{
executionContext
:
this
.
executionContext
,
compilationResult
:
()
=>
{
var
compilationResult
=
this
.
compiler
.
lastCompilationResult
if
(
compilationResult
)
{
return
compilationResult
.
data
}
return
null
}
})
this
.
breakPointManager
=
new
remixLib
.
code
.
BreakpointManager
(
this
.
debugger
,
(
sourceLocation
)
=>
{
return
self
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
sourceLocation
,
sourceLocation
.
file
,
this
.
compiler
.
lastCompilationResult
.
source
.
sources
,
this
.
compiler
.
lastCompilationResult
.
data
.
sources
)
},
(
step
)
=>
{
self
.
event
.
trigger
(
'breakpointStep'
,
[
step
])
})
this
.
debugger
.
setBreakpointManager
(
this
.
breakPointManager
)
this
.
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
// TODO: was already broken
//self.switchProvider(context)
})
this
.
debugger
.
event
.
register
(
'newTraceLoaded'
,
this
,
function
()
{
self
.
event
.
trigger
(
'debuggerStatus'
,
[
true
])
})
this
.
debugger
.
event
.
register
(
'traceUnloaded'
,
this
,
function
()
{
self
.
event
.
trigger
(
'debuggerStatus'
,
[
false
])
})
this
.
debugger
.
addProvider
(
'vm'
,
this
.
executionContext
.
vm
())
this
.
debugger
.
addProvider
(
'injected'
,
this
.
executionContext
.
internalWeb3
())
this
.
debugger
.
addProvider
(
'web3'
,
this
.
executionContext
.
internalWeb3
())
this
.
debugger
.
switchProvider
(
this
.
executionContext
.
getProvider
())
}
Debugger
.
prototype
.
registerAndHighlightCodeItem
=
function
(
index
)
{
const
self
=
this
// register selected code item, highlight the corresponding source location
if
(
!
self
.
compiler
.
lastCompilationResult
)
return
self
.
debugger
.
traceManager
.
getCurrentCalledAddressAt
(
index
,
(
error
,
address
)
=>
{
if
(
error
)
return
console
.
log
(
error
)
self
.
debugger
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
index
,
self
.
compiler
.
lastCompilationResult
.
data
.
contracts
,
function
(
error
,
rawLocation
)
{
if
(
!
error
&&
self
.
compiler
.
lastCompilationResult
&&
self
.
compiler
.
lastCompilationResult
.
data
)
{
var
lineColumnPos
=
self
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
,
self
.
compiler
.
lastCompilationResult
.
source
.
sources
)
self
.
event
.
trigger
(
'newSourceLocation'
,
[
lineColumnPos
,
rawLocation
])
}
else
{
self
.
event
.
trigger
(
'newSourceLocation'
,
[
null
])
}
})
})
}
module
.
exports
=
Debugger
src/app/debugger/debugger/debugger.js
View file @
dc1b07bc
...
...
@@ -2,33 +2,29 @@
var
Ethdebugger
=
require
(
'remix-debug'
).
EthDebugger
var
remixLib
=
require
(
'remix-lib'
)
var
EventManager
=
remixLib
.
EventManager
var
traceHelper
=
remixLib
.
helpers
.
trace
var
StepManager
=
require
(
'./stepManager'
)
var
VmDebuggerLogic
=
require
(
'./VmDebugger'
)
function
Debugger
(
options
)
{
var
self
=
this
this
.
event
=
new
EventManager
()
this
.
executionContext
=
options
.
executionContext
// dependencies
this
.
offsetToLineColumnConverter
=
options
.
offsetToLineColumnConverter
this
.
compiler
sArtefacts
=
options
.
compilersArtefacts
this
.
compiler
=
options
.
compiler
this
.
debugger
=
new
Ethdebugger
({
executionContext
:
options
.
executionContext
,
this
.
debugger
=
new
Ethdebugger
(
{
executionContext
:
this
.
executionContext
,
compilationResult
:
()
=>
{
if
(
this
.
compilersArtefacts
[
'__last'
])
return
this
.
compilersArtefacts
[
'__last'
].
getData
()
var
compilationResult
=
this
.
compiler
.
lastCompilationResult
if
(
compilationResult
)
{
return
compilationResult
.
data
}
return
null
}
})
this
.
breakPointManager
=
new
remixLib
.
code
.
BreakpointManager
(
this
.
debugger
,
(
sourceLocation
)
=>
{
if
(
!
this
.
compilersArtefacts
[
'__last'
])
return
null
let
compilationData
=
this
.
compilersArtefacts
[
'__last'
].
getData
()
if
(
!
compilationData
)
return
null
return
self
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
sourceLocation
,
sourceLocation
.
file
,
compilationData
.
sources
,
compilationData
.
sources
)
return
self
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
sourceLocation
,
sourceLocation
.
file
,
this
.
compiler
.
lastCompilationResult
.
source
.
sources
,
this
.
compiler
.
lastCompilationResult
.
data
.
sources
)
},
(
step
)
=>
{
self
.
event
.
trigger
(
'breakpointStep'
,
[
step
])
})
...
...
@@ -36,7 +32,8 @@ function Debugger (options) {
this
.
debugger
.
setBreakpointManager
(
this
.
breakPointManager
)
this
.
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
self
.
debugger
.
switchProvider
(
context
)
// TODO: was already broken
//self.switchProvider(context)
})
this
.
debugger
.
event
.
register
(
'newTraceLoaded'
,
this
,
function
()
{
...
...
@@ -47,10 +44,6 @@ function Debugger (options) {
self
.
event
.
trigger
(
'debuggerStatus'
,
[
false
])
})
this
.
event
.
register
(
'breakpointStep'
,
function
(
step
)
{
self
.
step_manager
.
jumpTo
(
step
)
})
this
.
debugger
.
addProvider
(
'vm'
,
this
.
executionContext
.
vm
())
this
.
debugger
.
addProvider
(
'injected'
,
this
.
executionContext
.
internalWeb3
())
this
.
debugger
.
addProvider
(
'web3'
,
this
.
executionContext
.
internalWeb3
())
...
...
@@ -60,16 +53,12 @@ function Debugger (options) {
Debugger
.
prototype
.
registerAndHighlightCodeItem
=
function
(
index
)
{
const
self
=
this
// register selected code item, highlight the corresponding source location
if
(
!
self
.
compilersArtefacts
[
'__last'
])
{
self
.
event
.
trigger
(
'newSourceLocation'
,
[
null
])
return
}
var
compilerData
=
self
.
compilersArtefacts
[
'__last'
].
getData
()
if
(
!
self
.
compiler
.
lastCompilationResult
)
return
self
.
debugger
.
traceManager
.
getCurrentCalledAddressAt
(
index
,
(
error
,
address
)
=>
{
if
(
error
)
return
console
.
log
(
error
)
self
.
debugger
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
index
,
compilerD
ata
.
contracts
,
function
(
error
,
rawLocation
)
{
if
(
!
error
)
{
var
lineColumnPos
=
self
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
,
compilerData
.
sources
,
compilerData
.
sources
)
self
.
debugger
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
index
,
self
.
compiler
.
lastCompilationResult
.
d
ata
.
contracts
,
function
(
error
,
rawLocation
)
{
if
(
!
error
&&
self
.
compiler
.
lastCompilationResult
&&
self
.
compiler
.
lastCompilationResult
.
data
)
{
var
lineColumnPos
=
self
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
,
self
.
compiler
.
lastCompilationResult
.
source
.
sources
)
self
.
event
.
trigger
(
'newSourceLocation'
,
[
lineColumnPos
,
rawLocation
])
}
else
{
self
.
event
.
trigger
(
'newSourceLocation'
,
[
null
])
...
...
@@ -78,67 +67,4 @@ Debugger.prototype.registerAndHighlightCodeItem = function (index) {
})
}
Debugger
.
prototype
.
debug
=
function
(
blockNumber
,
txNumber
,
tx
,
loadingCb
)
{
const
self
=
this
let
web3
=
this
.
executionContext
.
web3
()
if
(
this
.
debugger
.
traceManager
.
isLoading
)
{
return
}
self
.
debugger
.
solidityProxy
.
reset
({})
if
(
tx
)
{
if
(
!
tx
.
to
)
{
tx
.
to
=
traceHelper
.
contractCreationToken
(
'0'
)
}
return
self
.
debugTx
(
tx
,
loadingCb
)
}
try
{
if
(
txNumber
.
indexOf
(
'0x'
)
!==
-
1
)
{
return
web3
.
eth
.
getTransaction
(
txNumber
,
function
(
_error
,
result
)
{
let
tx
=
result
self
.
debugTx
(
tx
,
loadingCb
)
})
}
web3
.
eth
.
getTransactionFromBlock
(
blockNumber
,
txNumber
,
function
(
_error
,
result
)
{
let
tx
=
result
self
.
debugTx
(
tx
,
loadingCb
)
})
}
catch
(
e
)
{
console
.
error
(
e
.
message
)
}
}
Debugger
.
prototype
.
debugTx
=
function
(
tx
,
loadingCb
)
{
const
self
=
this
this
.
step_manager
=
new
StepManager
(
this
.
debugger
,
this
.
debugger
.
traceManager
)
this
.
debugger
.
codeManager
.
event
.
register
(
'changed'
,
this
,
(
code
,
address
,
instIndex
)
=>
{
self
.
debugger
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
this
.
step_manager
.
currentStepIndex
,
this
.
debugger
.
solidityProxy
.
contracts
,
(
error
,
sourceLocation
)
=>
{
if
(
!
error
)
{
self
.
vmDebuggerLogic
.
event
.
trigger
(
'sourceLocationChanged'
,
[
sourceLocation
])
}
})
})
this
.
vmDebuggerLogic
=
new
VmDebuggerLogic
(
this
.
debugger
,
tx
,
this
.
step_manager
,
this
.
debugger
.
traceManager
,
this
.
debugger
.
codeManager
,
this
.
debugger
.
solidityProxy
,
this
.
debugger
.
callTree
)
this
.
step_manager
.
event
.
register
(
'stepChanged'
,
this
,
function
(
stepIndex
)
{
self
.
debugger
.
codeManager
.
resolveStep
(
stepIndex
,
tx
)
self
.
step_manager
.
event
.
trigger
(
'indexChanged'
,
[
stepIndex
])
self
.
vmDebuggerLogic
.
event
.
trigger
(
'indexChanged'
,
[
stepIndex
])
self
.
registerAndHighlightCodeItem
(
stepIndex
)
})
loadingCb
()
this
.
debugger
.
debug
(
tx
)
}
Debugger
.
prototype
.
unload
=
function
()
{
this
.
debugger
.
unLoad
()
this
.
event
.
trigger
(
'debuggerUnloaded'
)
}
module
.
exports
=
Debugger
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