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
dd209448
Commit
dd209448
authored
Oct 09, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move execution context out of original debugger
parent
5bc7d72e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
47 deletions
+97
-47
Ethdebugger.js
remix-debug/src/Ethdebugger.js
+43
-42
debugger.js
remix-debug/src/debugger/debugger.js
+54
-5
No files found.
remix-debug/src/Ethdebugger.js
View file @
dd209448
...
...
@@ -13,11 +13,8 @@ var remixLib = require('remix-lib')
var
TraceManager
=
remixLib
.
trace
.
TraceManager
var
CodeManager
=
remixLib
.
code
.
CodeManager
var
traceHelper
=
remixLib
.
helpers
.
trace
var
init
=
remixLib
.
init
var
executionContext
=
remixLib
.
execution
.
executionContext
// var executionContext = remixLib.execution.executionContext
var
EventManager
=
remixLib
.
EventManager
var
Web3Providers
=
remixLib
.
vm
.
Web3Providers
var
DummyProvider
=
remixLib
.
vm
.
DummyProvider
/**
* Ethdebugger is a wrapper around a few classes that helps debugging a transaction
...
...
@@ -36,16 +33,16 @@ function Ethdebugger (opts) {
this
.
opts
=
opts
||
{}
if
(
!
this
.
opts
.
compilationResult
)
this
.
opts
.
compilationResult
=
()
=>
{
return
null
}
this
.
executionContext
=
opts
.
executionContext
||
executionContext
this
.
web3
=
opts
.
web3
||
this
.
executionContext
.
web3
//
this.executionContext = opts.executionContext || executionContext
this
.
web3
=
opts
.
web3
this
.
event
=
new
EventManager
()
this
.
tx
this
.
web3Providers
=
new
Web3Providers
()
this
.
addProvider
(
'DUMMYWEB3'
,
new
DummyProvider
())
this
.
switchProvider
(
'DUMMYWEB3'
)
//
this.web3Providers = new Web3Providers()
//
this.addProvider('DUMMYWEB3', new DummyProvider())
//
this.switchProvider('DUMMYWEB3')
this
.
traceManager
=
new
TraceManager
({
web3
:
this
.
web3
})
this
.
codeManager
=
new
CodeManager
(
this
.
traceManager
)
...
...
@@ -164,39 +161,43 @@ Ethdebugger.prototype.storageViewAt = function (step, address) {
},
this
.
storageResolver
,
this
.
traceManager
)
}
/* set env */
Ethdebugger
.
prototype
.
web3
=
function
()
{
return
this
.
web3
}
Ethdebugger
.
prototype
.
addProvider
=
function
(
type
,
obj
)
{
this
.
web3Providers
.
addProvider
(
type
,
obj
)
this
.
event
.
trigger
(
'providerAdded'
,
[
type
])
}
Ethdebugger
.
prototype
.
switchProvider
=
function
(
type
)
{
var
self
=
this
this
.
web3Providers
.
get
(
type
,
function
(
error
,
obj
)
{
if
(
error
)
{
console
.
log
(
'provider '
+
type
+
' not defined'
)
}
else
{
self
.
web3
=
obj
self
.
setManagers
()
// self.traceManager.web3 = self.web3
self
.
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
if
(
error
||
!
network
)
{
self
.
web3Debug
=
obj
self
.
web3
=
obj
}
else
{
var
webDebugNode
=
init
.
web3DebugNode
(
network
.
name
)
self
.
web3Debug
=
!
webDebugNode
?
obj
:
webDebugNode
self
.
web3
=
!
webDebugNode
?
obj
:
webDebugNode
}
self
.
setManagers
()
})
self
.
event
.
trigger
(
'providerChanged'
,
[
type
])
}
})
}
// Ethdebugger.prototype.web3 = function () {
// return this.web3
// }
Ethdebugger
.
prototype
.
updateWeb3
=
function
(
web3
)
{
this
.
web3
=
web3
}
// Ethdebugger.prototype.addProvider = function (type, obj) {
// this.web3Providers.addProvider(type, obj)
// this.event.trigger('providerAdded', [type])
// }
//
// Ethdebugger.prototype.switchProvider = function (type) {
// var self = this
// this.web3Providers.get(type, function (error, obj) {
// if (error) {
// console.log('provider ' + type + ' not defined')
// } else {
// self.web3 = obj
// self.setManagers()
// // self.traceManager.web3 = self.web3
// self.executionContext.detectNetwork((error, network) => {
// if (error || !network) {
// self.web3Debug = obj
// self.web3 = obj
// } else {
// var webDebugNode = init.web3DebugNode(network.name)
// self.web3Debug = !webDebugNode ? obj : webDebugNode
// self.web3 = !webDebugNode ? obj : webDebugNode
// }
// self.setManagers()
// })
// self.event.trigger('providerChanged', [type])
// }
// })
// }
Ethdebugger
.
prototype
.
debug
=
function
(
tx
)
{
this
.
setCompilationResult
(
this
.
opts
.
compilationResult
())
...
...
remix-debug/src/debugger/debugger.js
View file @
dd209448
...
...
@@ -7,6 +7,10 @@ var traceHelper = remixLib.helpers.trace
var
StepManager
=
require
(
'./stepManager'
)
var
VmDebuggerLogic
=
require
(
'./VmDebugger'
)
var
Web3Providers
=
remixLib
.
vm
.
Web3Providers
var
DummyProvider
=
remixLib
.
vm
.
DummyProvider
var
init
=
remixLib
.
init
function
Debugger
(
options
)
{
var
self
=
this
this
.
event
=
new
EventManager
()
...
...
@@ -16,7 +20,8 @@ function Debugger (options) {
this
.
compiler
=
options
.
compiler
this
.
debugger
=
new
Ethdebugger
({
executionContext
:
this
.
executionContext
,
// executionContext: this.executionContext,
web3
:
this
.
executionContext
.
web3
,
compilationResult
:
()
=>
{
var
compilationResult
=
this
.
compiler
.
lastCompilationResult
if
(
compilationResult
)
{
...
...
@@ -26,6 +31,10 @@ function Debugger (options) {
}
})
this
.
web3Providers
=
new
Web3Providers
()
this
.
addProvider
(
'DUMMYWEB3'
,
new
DummyProvider
())
this
.
switchProvider
(
'DUMMYWEB3'
)
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
)
=>
{
...
...
@@ -51,12 +60,52 @@ function Debugger (options) {
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
())
this
.
debugger
.
switchProvider
(
this
.
executionContext
.
getProvider
())
this
.
addProvider
(
'vm'
,
this
.
executionContext
.
vm
())
this
.
addProvider
(
'injected'
,
this
.
executionContext
.
internalWeb3
())
this
.
addProvider
(
'web3'
,
this
.
executionContext
.
internalWeb3
())
this
.
switchProvider
(
this
.
executionContext
.
getProvider
())
}
Debugger
.
prototype
.
addProvider
=
function
(
type
,
obj
)
{
this
.
web3Providers
.
addProvider
(
type
,
obj
)
this
.
event
.
trigger
(
'providerAdded'
,
[
type
])
}
Debugger
.
prototype
.
switchProvider
=
function
(
type
)
{
var
self
=
this
this
.
web3Providers
.
get
(
type
,
function
(
error
,
obj
)
{
if
(
error
)
{
console
.
log
(
'provider '
+
type
+
' not defined'
)
}
else
{
//self.web3 = obj
self
.
debugger
.
updateWeb3
(
obj
)
self
.
debugger
.
setManagers
()
// self.traceManager.web3 = self.web3
self
.
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
if
(
error
||
!
network
)
{
// self.web3Debug = obj
// self.web3 = obj
self
.
debugger
.
updateWeb3
(
obj
)
}
else
{
var
webDebugNode
=
init
.
web3DebugNode
(
network
.
name
)
// self.web3Debug = !webDebugNode ? obj : webDebugNode
// self.web3 = !webDebugNode ? obj : webDebugNode
self
.
debugger
.
updateWeb3
(
!
webDebugNode
?
obj
:
webDebugNode
)
}
self
.
debugger
.
setManagers
()
})
self
.
event
.
trigger
(
'providerChanged'
,
[
type
])
}
})
}
Debugger
.
prototype
.
registerAndHighlightCodeItem
=
function
(
index
)
{
const
self
=
this
// register selected code item, highlight the corresponding source location
...
...
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