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
d72551df
Commit
d72551df
authored
Apr 22, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
turn property compilationResult into an async callback
parent
8c6da69a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
27 deletions
+23
-27
Ethdebugger.js
remix-debug/src/Ethdebugger.js
+5
-7
index.js
remix-debug/src/cmdline/index.js
+4
-4
debugger.js
remix-debug/src/debugger/debugger.js
+14
-16
No files found.
remix-debug/src/Ethdebugger.js
View file @
d72551df
...
@@ -29,9 +29,7 @@ const EventManager = remixLib.EventManager
...
@@ -29,9 +29,7 @@ const EventManager = remixLib.EventManager
* @param {Map} opts - { function compilationResult } //
* @param {Map} opts - { function compilationResult } //
*/
*/
function
Ethdebugger
(
opts
)
{
function
Ethdebugger
(
opts
)
{
this
.
opts
=
opts
||
{}
this
.
compilationResult
=
opts
.
compilationResult
||
function
(
contractAddress
)
{
return
null
}
if
(
!
this
.
opts
.
compilationResult
)
this
.
opts
.
compilationResult
=
()
=>
{
return
null
}
this
.
web3
=
opts
.
web3
this
.
web3
=
opts
.
web3
this
.
event
=
new
EventManager
()
this
.
event
=
new
EventManager
()
...
@@ -60,8 +58,8 @@ Ethdebugger.prototype.resolveStep = function (index) {
...
@@ -60,8 +58,8 @@ Ethdebugger.prototype.resolveStep = function (index) {
}
}
Ethdebugger
.
prototype
.
setCompilationResult
=
function
(
compilationResult
)
{
Ethdebugger
.
prototype
.
setCompilationResult
=
function
(
compilationResult
)
{
if
(
compilationResult
&&
compilationResult
.
sources
&&
compilationResult
.
contracts
)
{
if
(
compilationResult
&&
compilationResult
.
data
)
{
this
.
solidityProxy
.
reset
(
compilationResult
)
this
.
solidityProxy
.
reset
(
compilationResult
.
data
)
}
else
{
}
else
{
this
.
solidityProxy
.
reset
({})
this
.
solidityProxy
.
reset
({})
}
}
...
@@ -173,10 +171,10 @@ Ethdebugger.prototype.debug = function (tx) {
...
@@ -173,10 +171,10 @@ Ethdebugger.prototype.debug = function (tx) {
if
(
!
tx
.
to
)
{
if
(
!
tx
.
to
)
{
tx
.
to
=
traceHelper
.
contractCreationToken
(
'0'
)
tx
.
to
=
traceHelper
.
contractCreationToken
(
'0'
)
}
}
this
.
setCompilationResult
(
this
.
opts
.
compilationResult
())
this
.
tx
=
tx
this
.
tx
=
tx
this
.
traceManager
.
resolveTrace
(
tx
,
(
error
,
result
)
=>
{
this
.
traceManager
.
resolveTrace
(
tx
,
async
(
error
,
result
)
=>
{
if
(
result
)
{
if
(
result
)
{
this
.
setCompilationResult
(
await
this
.
compilationResult
(
tx
.
to
))
this
.
event
.
trigger
(
'newTraceLoaded'
,
[
this
.
traceManager
.
trace
])
this
.
event
.
trigger
(
'newTraceLoaded'
,
[
this
.
traceManager
.
trace
])
if
(
this
.
breakpointManager
&&
this
.
breakpointManager
.
hasBreakpoint
())
{
if
(
this
.
breakpointManager
&&
this
.
breakpointManager
.
hasBreakpoint
())
{
this
.
breakpointManager
.
jumpNextBreakpoint
(
false
)
this
.
breakpointManager
.
jumpNextBreakpoint
(
false
)
...
...
remix-debug/src/cmdline/index.js
View file @
d72551df
...
@@ -28,7 +28,7 @@ class CmdLine {
...
@@ -28,7 +28,7 @@ class CmdLine {
loadCompilationResult
(
compilationResult
)
{
loadCompilationResult
(
compilationResult
)
{
this
.
compilation
=
{}
this
.
compilation
=
{}
this
.
compilation
.
lastC
ompilationResult
=
compilationResult
this
.
compilation
.
c
ompilationResult
=
compilationResult
}
}
initDebugger
(
cb
)
{
initDebugger
(
cb
)
{
...
@@ -36,7 +36,7 @@ class CmdLine {
...
@@ -36,7 +36,7 @@ class CmdLine {
this
.
debugger
=
new
Debugger
({
this
.
debugger
=
new
Debugger
({
web3
:
this
.
contextManager
.
getWeb3
(),
web3
:
this
.
contextManager
.
getWeb3
(),
compil
er
:
this
.
compilation
compil
ationResult
:
()
=>
{
return
this
.
compilation
.
compilationResult
}
})
})
this
.
contextManager
.
event
.
register
(
'providerChanged'
,
()
=>
{
this
.
contextManager
.
event
.
register
(
'providerChanged'
,
()
=>
{
...
@@ -54,7 +54,7 @@ class CmdLine {
...
@@ -54,7 +54,7 @@ class CmdLine {
if
(
!
lineColumnPos
||
!
lineColumnPos
.
start
)
return
[]
if
(
!
lineColumnPos
||
!
lineColumnPos
.
start
)
return
[]
const
content
=
this
.
compilation
.
lastC
ompilationResult
.
source
.
sources
[
this
.
filename
].
content
.
split
(
'
\
n'
)
const
content
=
this
.
compilation
.
c
ompilationResult
.
source
.
sources
[
this
.
filename
].
content
.
split
(
'
\
n'
)
const
source
=
[]
const
source
=
[]
...
@@ -85,7 +85,7 @@ class CmdLine {
...
@@ -85,7 +85,7 @@ class CmdLine {
const
lineColumnPos
=
this
.
lineColumnPos
const
lineColumnPos
=
this
.
lineColumnPos
if
(
!
lineColumnPos
)
return
''
if
(
!
lineColumnPos
)
return
''
const
currentLineNumber
=
lineColumnPos
.
start
.
line
const
currentLineNumber
=
lineColumnPos
.
start
.
line
const
content
=
this
.
compilation
.
lastC
ompilationResult
.
source
.
sources
[
this
.
filename
].
content
.
split
(
'
\
n'
)
const
content
=
this
.
compilation
.
c
ompilationResult
.
source
.
sources
[
this
.
filename
].
content
.
split
(
'
\
n'
)
return
content
[
currentLineNumber
]
return
content
[
currentLineNumber
]
}
}
...
...
remix-debug/src/debugger/debugger.js
View file @
d72551df
...
@@ -12,21 +12,19 @@ function Debugger (options) {
...
@@ -12,21 +12,19 @@ function Debugger (options) {
this
.
event
=
new
EventManager
()
this
.
event
=
new
EventManager
()
this
.
offsetToLineColumnConverter
=
options
.
offsetToLineColumnConverter
||
(
new
OffsetToColumnConverter
())
this
.
offsetToLineColumnConverter
=
options
.
offsetToLineColumnConverter
||
(
new
OffsetToColumnConverter
())
this
.
compiler
=
options
.
compiler
/*
Returns a compilation result for a given address or the last one available if none are found
*/
this
.
compilationResult
=
options
.
compilationResult
||
function
(
contractAddress
)
{
return
null
}
this
.
debugger
=
new
Ethdebugger
({
this
.
debugger
=
new
Ethdebugger
({
web3
:
options
.
web3
,
web3
:
options
.
web3
,
compilationResult
:
()
=>
{
compilationResult
:
this
.
compilationResult
var
compilationResult
=
this
.
compiler
.
lastCompilationResult
if
(
compilationResult
)
{
return
compilationResult
.
data
}
return
null
}
})
})
this
.
breakPointManager
=
new
remixLib
.
code
.
BreakpointManager
(
this
.
debugger
,
(
sourceLocation
)
=>
{
this
.
breakPointManager
=
new
remixLib
.
code
.
BreakpointManager
(
this
.
debugger
,
async
(
sourceLocation
)
=>
{
return
this
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
sourceLocation
,
sourceLocation
.
file
,
this
.
compiler
.
lastCompilationResult
.
source
.
sources
,
this
.
compiler
.
lastCompilationResult
.
data
.
sources
)
const
compilationResult
=
await
this
.
compilationResult
()
return
this
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
sourceLocation
,
sourceLocation
.
file
,
compilationResult
.
source
.
sources
,
compilationResult
.
data
.
sources
)
},
(
step
)
=>
{
},
(
step
)
=>
{
this
.
event
.
trigger
(
'breakpointStep'
,
[
step
])
this
.
event
.
trigger
(
'breakpointStep'
,
[
step
])
})
})
...
@@ -48,12 +46,12 @@ function Debugger (options) {
...
@@ -48,12 +46,12 @@ function Debugger (options) {
Debugger
.
prototype
.
registerAndHighlightCodeItem
=
function
(
index
)
{
Debugger
.
prototype
.
registerAndHighlightCodeItem
=
function
(
index
)
{
// register selected code item, highlight the corresponding source location
// register selected code item, highlight the corresponding source location
if
(
!
this
.
compiler
.
lastCompilationResult
)
return
this
.
debugger
.
traceManager
.
getCurrentCalledAddressAt
(
index
,
async
(
error
,
address
)
=>
{
this
.
debugger
.
traceManager
.
getCurrentCalledAddressAt
(
index
,
(
error
,
address
)
=>
{
if
(
error
)
return
console
.
log
(
error
)
if
(
error
)
return
console
.
log
(
error
)
this
.
debugger
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
index
,
this
.
compiler
.
lastCompilationResult
.
data
.
contracts
,
(
error
,
rawLocation
)
=>
{
const
compilationResultForAddress
=
await
this
.
compilationResult
(
address
)
if
(
!
error
&&
this
.
compiler
.
lastCompilationResult
&&
this
.
compiler
.
lastCompilationResult
.
data
)
{
this
.
debugger
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
index
,
compilationResultForAddress
.
data
.
contracts
,
(
error
,
rawLocation
)
=>
{
var
lineColumnPos
=
this
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
,
this
.
compiler
.
lastCompilationResult
.
source
.
sources
,
this
.
compiler
.
lastCompilationResult
.
data
.
sources
)
if
(
!
error
&&
compilationResultForAddress
&&
compilationResultForAddress
.
data
)
{
var
lineColumnPos
=
this
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
,
compilationResultForAddress
.
source
.
sources
,
compilationResultForAddress
.
data
.
sources
)
this
.
event
.
trigger
(
'newSourceLocation'
,
[
lineColumnPos
,
rawLocation
])
this
.
event
.
trigger
(
'newSourceLocation'
,
[
lineColumnPos
,
rawLocation
])
}
else
{
}
else
{
this
.
event
.
trigger
(
'newSourceLocation'
,
[
null
])
this
.
event
.
trigger
(
'newSourceLocation'
,
[
null
])
...
@@ -112,7 +110,7 @@ Debugger.prototype.debugTx = function (tx, loadingCb) {
...
@@ -112,7 +110,7 @@ Debugger.prototype.debugTx = function (tx, loadingCb) {
this
.
vmDebuggerLogic
.
event
.
trigger
(
'sourceLocationChanged'
,
[
sourceLocation
])
this
.
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
.
vmDebuggerLogic
=
new
VmDebuggerLogic
(
this
.
debugger
,
tx
,
this
.
step_manager
,
this
.
debugger
.
traceManager
,
this
.
debugger
.
codeManager
,
this
.
debugger
.
solidityProxy
,
this
.
debugger
.
callTree
)
this
.
vmDebuggerLogic
.
start
()
this
.
vmDebuggerLogic
.
start
()
...
...
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