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
9674951d
Unverified
Commit
9674951d
authored
May 31, 2020
by
yann300
Committed by
GitHub
May 31, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2866 from ethereum/debugerHighlight
refactored debuggerUI
parents
8dc15cee
d7f97a3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
40 deletions
+51
-40
debugger-tab.js
src/app/tabs/debugger-tab.js
+8
-2
debuggerUI.js
src/app/tabs/debugger/debuggerUI.js
+43
-38
No files found.
src/app/tabs/debugger-tab.js
View file @
9674951d
...
@@ -56,12 +56,13 @@ class DebuggerTab extends ViewPlugin {
...
@@ -56,12 +56,13 @@ class DebuggerTab extends ViewPlugin {
})
})
this
.
debuggerUI
=
new
DebuggerUI
(
this
.
debuggerUI
=
new
DebuggerUI
(
this
,
this
.
el
.
querySelector
(
'#debugger'
),
this
.
el
.
querySelector
(
'#debugger'
),
this
.
blockchain
,
(
address
,
receipt
)
=>
{
(
address
,
receipt
)
=>
{
const
target
=
(
address
&&
remixLib
.
helpers
.
trace
.
isContractCreation
(
address
))
?
receipt
.
contractAddress
:
address
const
target
=
(
address
&&
remixLib
.
helpers
.
trace
.
isContractCreation
(
address
))
?
receipt
.
contractAddress
:
address
return
this
.
call
(
'fetchAndCompile'
,
'resolve'
,
target
||
receipt
.
contractAddress
||
receipt
.
to
,
'.debug'
,
this
.
blockchain
.
web3
())
return
this
.
call
(
'fetchAndCompile'
,
'resolve'
,
target
||
receipt
.
contractAddress
||
receipt
.
to
,
'.debug'
,
this
.
blockchain
.
web3
())
})
}
)
this
.
call
(
'manager'
,
'activatePlugin'
,
'source-verification'
)
this
.
call
(
'manager'
,
'activatePlugin'
,
'source-verification'
)
// this.call('manager', 'activatePlugin', 'udapp')
// this.call('manager', 'activatePlugin', 'udapp')
...
@@ -69,6 +70,11 @@ class DebuggerTab extends ViewPlugin {
...
@@ -69,6 +70,11 @@ class DebuggerTab extends ViewPlugin {
return
this
.
el
return
this
.
el
}
}
deactivate
()
{
this
.
debuggerUI
.
deleteHighlights
()
super
.
deactivate
()
}
debug
(
hash
)
{
debug
(
hash
)
{
if
(
this
.
debuggerUI
)
this
.
debuggerUI
.
debug
(
hash
)
if
(
this
.
debuggerUI
)
this
.
debuggerUI
.
debug
(
hash
)
}
}
...
...
src/app/tabs/debugger/debuggerUI.js
View file @
9674951d
...
@@ -30,9 +30,8 @@ var css = csjs`
...
@@ -30,9 +30,8 @@ var css = csjs`
class
DebuggerUI
{
class
DebuggerUI
{
constructor
(
container
,
blockchain
,
fetchContractAndCompile
)
{
constructor
(
debuggerModule
,
component
,
fetchContractAndCompile
)
{
this
.
registry
=
globalRegistry
this
.
debuggerModule
=
debuggerModule
this
.
blockchain
=
blockchain
this
.
fetchContractAndCompile
=
fetchContractAndCompile
this
.
fetchContractAndCompile
=
fetchContractAndCompile
this
.
event
=
new
EventManager
()
this
.
event
=
new
EventManager
()
...
@@ -48,62 +47,62 @@ class DebuggerUI {
...
@@ -48,62 +47,62 @@ class DebuggerUI {
this
.
view
this
.
view
co
ntainer
.
appendChild
(
this
.
render
())
co
mponent
.
appendChild
(
this
.
render
())
this
.
setEditor
()
this
.
setEditor
()
}
}
setEditor
()
{
setEditor
()
{
const
self
=
this
this
.
editor
=
globalRegistry
.
get
(
'editor'
).
api
this
.
editor
=
this
.
registry
.
get
(
'editor'
).
api
self
.
editor
.
event
.
register
(
'breakpointCleared'
,
(
fileName
,
row
)
=>
{
this
.
editor
.
event
.
register
(
'breakpointCleared'
,
(
fileName
,
row
)
=>
{
if
(
self
.
debugger
)
self
.
debugger
.
breakPointManager
.
remove
({
fileName
:
fileName
,
row
:
row
})
if
(
this
.
debugger
)
this
.
debugger
.
breakPointManager
.
remove
({
fileName
:
fileName
,
row
:
row
})
})
})
self
.
editor
.
event
.
register
(
'breakpointAdded'
,
(
fileName
,
row
)
=>
{
this
.
editor
.
event
.
register
(
'breakpointAdded'
,
(
fileName
,
row
)
=>
{
if
(
self
.
debugger
)
self
.
debugger
.
breakPointManager
.
add
({
fileName
:
fileName
,
row
:
row
})
if
(
this
.
debugger
)
this
.
debugger
.
breakPointManager
.
add
({
fileName
:
fileName
,
row
:
row
})
})
})
self
.
editor
.
event
.
register
(
'contentChanged'
,
function
()
{
this
.
editor
.
event
.
register
(
'contentChanged'
,
()
=>
{
if
(
self
.
debugger
)
self
.
debugger
.
unload
()
if
(
this
.
debugger
)
this
.
debugger
.
unload
()
})
})
}
}
listenToEvents
()
{
listenToEvents
()
{
const
self
=
this
if
(
!
this
.
debugger
)
return
if
(
!
self
.
debugger
)
return
this
.
debugger
.
event
.
register
(
'debuggerStatus'
,
function
(
isActive
)
{
this
.
debugger
.
event
.
register
(
'debuggerStatus'
,
async
(
isActive
)
=>
{
self
.
sourceHighlighter
.
currentSourceLocation
(
null
)
await
this
.
debuggerModule
.
call
(
'editor'
,
'discardHighlight'
)
self
.
isActive
=
isActive
this
.
isActive
=
isActive
})
})
this
.
debugger
.
event
.
register
(
'newSourceLocation'
,
async
function
(
lineColumnPos
,
rawLocation
)
{
this
.
debugger
.
event
.
register
(
'newSourceLocation'
,
async
(
lineColumnPos
,
rawLocation
)
=>
{
const
contracts
=
await
self
.
fetchContractAndCompile
(
const
contracts
=
await
this
.
fetchContractAndCompile
(
self
.
currentReceipt
.
contractAddress
||
self
.
currentReceipt
.
to
,
this
.
currentReceipt
.
contractAddress
||
this
.
currentReceipt
.
to
,
self
.
currentReceipt
)
this
.
currentReceipt
)
if
(
contracts
)
{
if
(
contracts
)
{
const
path
=
contracts
.
getSourceName
(
rawLocation
.
file
)
const
path
=
contracts
.
getSourceName
(
rawLocation
.
file
)
if
(
path
)
self
.
sourceHighlighter
.
currentSourceLocationFromfileName
(
lineColumnPos
,
path
)
if
(
path
)
{
await
this
.
debuggerModule
.
call
(
'editor'
,
'discardHighlight'
)
await
this
.
debuggerModule
.
call
(
'editor'
,
'highlight'
,
lineColumnPos
,
path
)
}
}
}
})
})
this
.
debugger
.
event
.
register
(
'debuggerUnloaded'
,
self
.
unLoad
.
bind
(
this
))
this
.
debugger
.
event
.
register
(
'debuggerUnloaded'
,
()
=>
this
.
unLoad
(
))
}
}
startTxBrowser
()
{
startTxBrowser
()
{
const
self
=
this
let
txBrowser
=
new
TxBrowser
()
let
txBrowser
=
new
TxBrowser
()
this
.
txBrowser
=
txBrowser
this
.
txBrowser
=
txBrowser
txBrowser
.
event
.
register
(
'requestDebug'
,
function
(
blockNumber
,
txNumber
,
tx
)
{
txBrowser
.
event
.
register
(
'requestDebug'
,
(
blockNumber
,
txNumber
,
tx
)
=>
{
if
(
self
.
debugger
)
self
.
debugger
.
unload
()
if
(
this
.
debugger
)
this
.
debugger
.
unload
()
self
.
startDebugging
(
blockNumber
,
txNumber
,
tx
)
this
.
startDebugging
(
blockNumber
,
txNumber
,
tx
)
})
})
txBrowser
.
event
.
register
(
'unloadRequested'
,
this
,
function
(
blockNumber
,
txIndex
,
tx
)
{
txBrowser
.
event
.
register
(
'unloadRequested'
,
this
,
(
blockNumber
,
txIndex
,
tx
)
=>
{
if
(
self
.
debugger
)
self
.
debugger
.
unload
()
if
(
this
.
debugger
)
this
.
debugger
.
unload
()
})
})
}
}
...
@@ -113,13 +112,13 @@ class DebuggerUI {
...
@@ -113,13 +112,13 @@ class DebuggerUI {
getDebugWeb3
()
{
getDebugWeb3
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
blockchain
.
detectNetwork
((
error
,
network
)
=>
{
this
.
debuggerModule
.
blockchain
.
detectNetwork
((
error
,
network
)
=>
{
let
web3
let
web3
if
(
error
||
!
network
)
{
if
(
error
||
!
network
)
{
web3
=
init
.
web3DebugNode
(
this
.
blockchain
.
web3
())
web3
=
init
.
web3DebugNode
(
this
.
debuggerModule
.
blockchain
.
web3
())
}
else
{
}
else
{
const
webDebugNode
=
init
.
web3DebugNode
(
network
.
name
)
const
webDebugNode
=
init
.
web3DebugNode
(
network
.
name
)
web3
=
!
webDebugNode
?
this
.
blockchain
.
web3
()
:
webDebugNode
web3
=
!
webDebugNode
?
this
.
debuggerModule
.
blockchain
.
web3
()
:
webDebugNode
}
}
init
.
extendWeb3
(
web3
)
init
.
extendWeb3
(
web3
)
resolve
(
web3
)
resolve
(
web3
)
...
@@ -134,7 +133,7 @@ class DebuggerUI {
...
@@ -134,7 +133,7 @@ class DebuggerUI {
this
.
currentReceipt
=
await
web3
.
eth
.
getTransactionReceipt
(
txNumber
)
this
.
currentReceipt
=
await
web3
.
eth
.
getTransactionReceipt
(
txNumber
)
this
.
debugger
=
new
Debugger
({
this
.
debugger
=
new
Debugger
({
web3
,
web3
,
offsetToLineColumnConverter
:
this
.
r
egistry
.
get
(
'offsettolinecolumnconverter'
).
api
,
offsetToLineColumnConverter
:
globalR
egistry
.
get
(
'offsettolinecolumnconverter'
).
api
,
compilationResult
:
async
(
address
)
=>
{
compilationResult
:
async
(
address
)
=>
{
try
{
try
{
return
await
this
.
fetchContractAndCompile
(
address
,
this
.
currentReceipt
)
return
await
this
.
fetchContractAndCompile
(
address
,
this
.
currentReceipt
)
...
@@ -164,7 +163,7 @@ class DebuggerUI {
...
@@ -164,7 +163,7 @@ class DebuggerUI {
this
.
currentReceipt
=
await
web3
.
eth
.
getTransactionReceipt
(
hash
)
this
.
currentReceipt
=
await
web3
.
eth
.
getTransactionReceipt
(
hash
)
const
debug
=
new
Debugger
({
const
debug
=
new
Debugger
({
web3
,
web3
,
offsetToLineColumnConverter
:
this
.
r
egistry
.
get
(
'offsettolinecolumnconverter'
).
api
,
offsetToLineColumnConverter
:
globalR
egistry
.
get
(
'offsettolinecolumnconverter'
).
api
,
compilationResult
:
async
(
address
)
=>
{
compilationResult
:
async
(
address
)
=>
{
try
{
try
{
return
await
this
.
fetchContractAndCompile
(
address
,
this
.
currentReceipt
)
return
await
this
.
fetchContractAndCompile
(
address
,
this
.
currentReceipt
)
...
@@ -190,22 +189,24 @@ class DebuggerUI {
...
@@ -190,22 +189,24 @@ class DebuggerUI {
this
.
debuggerHeadPanelsView
=
yo
`<div class="
${
css
.
innerShift
}
"></div>`
this
.
debuggerHeadPanelsView
=
yo
`<div class="
${
css
.
innerShift
}
"></div>`
this
.
stepManagerView
=
yo
`<div class="
${
css
.
innerShift
}
"></div>`
this
.
stepManagerView
=
yo
`<div class="
${
css
.
innerShift
}
"></div>`
var
view
=
yo
`<div>
var
view
=
yo
`
<div>
<div class="
${
css
.
innerShift
}
">
<div class="
${
css
.
innerShift
}
">
${
this
.
txBrowser
.
render
()}
${
this
.
txBrowser
.
render
()}
${
this
.
debuggerHeadPanelsView
}
${
this
.
debuggerHeadPanelsView
}
${
this
.
stepManagerView
}
${
this
.
stepManagerView
}
</div>
</div>
<div class="
${
css
.
statusMessage
}
"
>
${
this
.
statusMessage
}
</div>
<div class="
${
css
.
statusMessage
}
">
${
this
.
statusMessage
}
</div>
${
this
.
debuggerPanelsView
}
${
this
.
debuggerPanelsView
}
</div>`
</div>
`
if
(
!
this
.
view
)
{
if
(
!
this
.
view
)
{
this
.
view
=
view
this
.
view
=
view
}
}
return
view
return
view
}
}
unLoad
()
{
async
unLoad
()
{
yo
.
update
(
this
.
debuggerHeadPanelsView
,
yo
`<div></div>`
)
yo
.
update
(
this
.
debuggerHeadPanelsView
,
yo
`<div></div>`
)
yo
.
update
(
this
.
debuggerPanelsView
,
yo
`<div></div>`
)
yo
.
update
(
this
.
debuggerPanelsView
,
yo
`<div></div>`
)
yo
.
update
(
this
.
stepManagerView
,
yo
`<div></div>`
)
yo
.
update
(
this
.
stepManagerView
,
yo
`<div></div>`
)
...
@@ -218,6 +219,10 @@ class DebuggerUI {
...
@@ -218,6 +219,10 @@ class DebuggerUI {
this
.
event
.
trigger
(
'traceUnloaded'
)
this
.
event
.
trigger
(
'traceUnloaded'
)
}
}
async
deleteHighlights
()
{
await
this
.
debuggerModule
.
call
(
'editor'
,
'discardHighlight'
)
}
renderDebugger
()
{
renderDebugger
()
{
yo
.
update
(
this
.
debuggerHeadPanelsView
,
this
.
vmDebugger
.
renderHead
())
yo
.
update
(
this
.
debuggerHeadPanelsView
,
this
.
vmDebugger
.
renderHead
())
yo
.
update
(
this
.
debuggerPanelsView
,
this
.
vmDebugger
.
render
())
yo
.
update
(
this
.
debuggerPanelsView
,
this
.
vmDebugger
.
render
())
...
...
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