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
3284337f
Commit
3284337f
authored
Oct 11, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add resolveToReducedTrace; clean up; improve output
parent
b40e09e3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
64 additions
and
43 deletions
+64
-43
rdb.js
remix-debug/rdb.js
+4
-4
Ethdebugger.js
remix-debug/src/Ethdebugger.js
+0
-1
index.js
remix-debug/src/cmdline/index.js
+22
-29
debugger.js
remix-debug/src/debugger/debugger.js
+0
-1
stepManager.js
remix-debug/src/debugger/stepManager.js
+35
-5
internalCallTree.js
remix-debug/src/solidity-decoder/internalCallTree.js
+2
-2
solidityProxy.js
remix-debug/src/solidity-decoder/solidityProxy.js
+1
-1
No files found.
remix-debug/rdb.js
View file @
3284337f
...
@@ -29,16 +29,16 @@ const r = repl.start({
...
@@ -29,16 +29,16 @@ const r = repl.start({
eval
:
(
cmd
,
context
,
filename
,
cb
)
=>
{
eval
:
(
cmd
,
context
,
filename
,
cb
)
=>
{
let
command
=
cmd
.
trim
()
let
command
=
cmd
.
trim
()
if
(
command
===
'next'
||
command
===
'n'
)
{
if
(
command
===
'next'
||
command
===
'n'
)
{
cmd_line
.
debugger
.
step_manager
.
stepOverForward
()
cmd_line
.
debugger
.
step_manager
.
stepOverForward
(
true
)
}
}
if
(
command
===
'previous'
||
command
===
'p'
||
command
===
'prev'
)
{
if
(
command
===
'previous'
||
command
===
'p'
||
command
===
'prev'
)
{
cmd_line
.
debugger
.
step_manager
.
stepOverBack
()
cmd_line
.
debugger
.
step_manager
.
stepOverBack
(
true
)
}
}
if
(
command
===
'step'
||
command
===
's'
)
{
if
(
command
===
'step'
||
command
===
's'
)
{
cmd_line
.
debugger
.
step_manager
.
stepIntoForward
()
cmd_line
.
debugger
.
step_manager
.
stepIntoForward
(
true
)
}
}
if
(
command
===
'stepback'
||
command
===
'sb'
)
{
if
(
command
===
'stepback'
||
command
===
'sb'
)
{
cmd_line
.
debugger
.
step_manager
.
stepIntoBack
()
cmd_line
.
debugger
.
step_manager
.
stepIntoBack
(
true
)
}
}
if
(
command
===
'exit'
||
command
===
'quit'
)
{
if
(
command
===
'exit'
||
command
===
'quit'
)
{
process
.
exit
(
0
)
process
.
exit
(
0
)
...
...
remix-debug/src/Ethdebugger.js
View file @
3284337f
...
@@ -183,7 +183,6 @@ Ethdebugger.prototype.debug = function (tx) {
...
@@ -183,7 +183,6 @@ Ethdebugger.prototype.debug = function (tx) {
tx
.
to
=
traceHelper
.
contractCreationToken
(
'0'
)
tx
.
to
=
traceHelper
.
contractCreationToken
(
'0'
)
}
}
this
.
setCompilationResult
(
this
.
opts
.
compilationResult
())
this
.
setCompilationResult
(
this
.
opts
.
compilationResult
())
console
.
log
(
'loading trace...'
)
this
.
tx
=
tx
this
.
tx
=
tx
var
self
=
this
var
self
=
this
this
.
traceManager
.
resolveTrace
(
tx
,
function
(
error
,
result
)
{
this
.
traceManager
.
resolveTrace
(
tx
,
function
(
error
,
result
)
{
...
...
remix-debug/src/cmdline/index.js
View file @
3284337f
...
@@ -42,48 +42,41 @@ class CmdLine {
...
@@ -42,48 +42,41 @@ class CmdLine {
this
.
debugger
.
debug
(
null
,
txNumber
,
null
,
()
=>
{
this
.
debugger
.
debug
(
null
,
txNumber
,
null
,
()
=>
{
self
.
debugger
.
event
.
register
(
'newSourceLocation'
,
function
(
lineColumnPos
,
rawLocation
)
{
self
.
debugger
.
event
.
register
(
'newSourceLocation'
,
function
(
lineColumnPos
,
rawLocation
)
{
console
.
dir
(
"newSourceLocation"
)
if
(
!
lineColumnPos
||
!
lineColumnPos
.
start
)
return
;
if
(
!
lineColumnPos
||
!
lineColumnPos
.
start
)
return
;
let
line
let
content
=
self
.
compilation
.
lastCompilationResult
.
source
.
sources
[
'browser/ballot.sol'
].
content
.
split
(
"
\
n"
)
line
=
self
.
compilation
.
lastCompilationResult
.
source
.
sources
[
'browser/ballot.sol'
].
content
.
split
(
"
\
n"
)[
lineColumnPos
.
start
.
line
-
1
]
console
.
dir
(
" "
+
(
lineColumnPos
.
start
.
line
-
1
)
+
" "
+
line
)
line
=
self
.
compilation
.
lastCompilationResult
.
source
.
sources
[
'browser/ballot.sol'
].
content
.
split
(
"
\
n"
)[
lineColumnPos
.
start
.
line
]
console
.
dir
(
"=> "
+
lineColumnPos
.
start
.
line
+
" "
+
line
)
line
=
self
.
compilation
.
lastCompilationResult
.
source
.
sources
[
'browser/ballot.sol'
].
content
.
split
(
"
\
n"
)[
lineColumnPos
.
start
.
line
+
1
]
console
.
dir
(
" "
+
(
lineColumnPos
.
start
.
line
+
1
)
+
" "
+
line
)
line
=
self
.
compilation
.
lastCompilationResult
.
source
.
sources
[
'browser/ballot.sol'
].
content
.
split
(
"
\
n"
)[
lineColumnPos
.
start
.
line
+
2
]
console
.
dir
(
" "
+
(
lineColumnPos
.
start
.
line
+
2
)
+
" "
+
line
)
});
self
.
debugger
.
step_manager
.
event
.
register
(
'stepChanged'
,
(
stepIndex
)
=>
{
// console.dir("---------")
// console.dir("stepChanged: " + stepIndex)
// console.dir("---------")
})
self
.
debugger
.
step_manager
.
event
.
register
(
'traceLengthChanged'
,
(
traceLength
)
=>
{
let
line
// console.dir("---------")
line
=
content
[
lineColumnPos
.
start
.
line
-
2
]
// console.dir("traceLengthChanged: " + traceLength)
if
(
line
!==
undefined
)
{
// console.dir("---------")
console
.
dir
(
" "
+
(
lineColumnPos
.
start
.
line
-
1
)
+
": "
+
line
)
}
line
=
content
[
lineColumnPos
.
start
.
line
-
1
]
if
(
line
!==
undefined
)
{
console
.
dir
(
" "
+
lineColumnPos
.
start
.
line
+
": "
+
line
)
}
let
currentLineNumber
=
lineColumnPos
.
start
.
line
let
currentLine
=
content
[
currentLineNumber
]
console
.
dir
(
"=> "
+
(
currentLineNumber
+
1
)
+
": "
+
currentLine
)
let
startLine
=
lineColumnPos
.
start
.
line
for
(
var
i
=
1
;
i
<
4
;
i
++
)
{
let
line
=
content
[
startLine
+
i
]
console
.
dir
(
" "
+
(
startLine
+
i
+
1
)
+
": "
+
line
)
}
});
});
self
.
debugger
.
vmDebuggerLogic
.
event
.
register
(
'solidityState'
,
(
data
)
=>
{
self
.
debugger
.
vmDebuggerLogic
.
event
.
register
(
'solidityState'
,
(
data
)
=>
{
self
.
solidityState
=
data
self
.
solidityState
=
data
});
});
// TODO: this doesnt work too well, it should request the data instead...
self
.
debugger
.
vmDebuggerLogic
.
event
.
register
(
'solidityLocals'
,
(
data
)
=>
{
self
.
debugger
.
vmDebuggerLogic
.
event
.
register
(
'solidityLocals'
,
(
data
)
=>
{
if
(
JSON
.
stringify
(
data
)
===
'{}'
)
return
self
.
solidityLocals
=
data
self
.
solidityLocals
=
data
});
});
self
.
debugger
.
vmDebuggerLogic
.
event
.
register
(
'traceManagerMemoryUpdate'
,
(
data
)
=>
{
// console.dir("---------")
// console.dir("traceManagerMemoryUpdate")
// console.dir(data)
// console.dir("---------")
});
})
})
}
}
...
...
remix-debug/src/debugger/debugger.js
View file @
3284337f
...
@@ -115,7 +115,6 @@ Debugger.prototype.debugTx = function (tx, loadingCb) {
...
@@ -115,7 +115,6 @@ Debugger.prototype.debugTx = function (tx, loadingCb) {
this
.
vmDebuggerLogic
.
start
()
this
.
vmDebuggerLogic
.
start
()
this
.
step_manager
.
event
.
register
(
'stepChanged'
,
this
,
function
(
stepIndex
)
{
this
.
step_manager
.
event
.
register
(
'stepChanged'
,
this
,
function
(
stepIndex
)
{
console
.
dir
(
"stepChanged, going to trigger the other components.. "
+
stepIndex
);
self
.
debugger
.
codeManager
.
resolveStep
(
stepIndex
,
tx
)
self
.
debugger
.
codeManager
.
resolveStep
(
stepIndex
,
tx
)
self
.
step_manager
.
event
.
trigger
(
'indexChanged'
,
[
stepIndex
])
self
.
step_manager
.
event
.
trigger
(
'indexChanged'
,
[
stepIndex
])
self
.
vmDebuggerLogic
.
event
.
trigger
(
'indexChanged'
,
[
stepIndex
])
self
.
vmDebuggerLogic
.
event
.
trigger
(
'indexChanged'
,
[
stepIndex
])
...
...
remix-debug/src/debugger/stepManager.js
View file @
3284337f
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
EventManager
=
remixLib
.
EventManager
var
EventManager
=
remixLib
.
EventManager
var
util
=
remixLib
.
util
class
DebuggerStepManager
{
class
DebuggerStepManager
{
...
@@ -81,43 +82,58 @@ class DebuggerStepManager {
...
@@ -81,43 +82,58 @@ class DebuggerStepManager {
})
})
}
}
stepIntoBack
()
{
stepIntoBack
(
solidityMode
)
{
if
(
!
this
.
traceManager
.
isLoaded
())
return
if
(
!
this
.
traceManager
.
isLoaded
())
return
var
step
=
this
.
currentStepIndex
-
1
var
step
=
this
.
currentStepIndex
-
1
this
.
currentStepIndex
=
step
this
.
currentStepIndex
=
step
if
(
solidityMode
)
{
step
=
this
.
resolveToReducedTrace
(
step
,
-
1
)
}
if
(
!
this
.
traceManager
.
inRange
(
step
))
{
if
(
!
this
.
traceManager
.
inRange
(
step
))
{
return
return
}
}
this
.
event
.
trigger
(
'stepChanged'
,
[
step
])
this
.
event
.
trigger
(
'stepChanged'
,
[
step
])
}
}
stepIntoForward
()
{
stepIntoForward
(
solidityMode
)
{
if
(
!
this
.
traceManager
.
isLoaded
())
return
if
(
!
this
.
traceManager
.
isLoaded
())
return
var
step
=
this
.
currentStepIndex
+
1
var
step
=
this
.
currentStepIndex
+
1
this
.
currentStepIndex
=
step
this
.
currentStepIndex
=
step
if
(
solidityMode
)
{
step
=
this
.
resolveToReducedTrace
(
step
,
1
)
}
if
(
!
this
.
traceManager
.
inRange
(
step
))
{
if
(
!
this
.
traceManager
.
inRange
(
step
))
{
return
return
}
}
this
.
event
.
trigger
(
'stepChanged'
,
[
step
])
this
.
event
.
trigger
(
'stepChanged'
,
[
step
])
}
}
stepOverBack
()
{
stepOverBack
(
solidityMode
)
{
if
(
!
this
.
traceManager
.
isLoaded
())
return
if
(
!
this
.
traceManager
.
isLoaded
())
return
var
step
=
this
.
traceManager
.
findStepOverBack
(
this
.
currentStepIndex
)
var
step
=
this
.
traceManager
.
findStepOverBack
(
this
.
currentStepIndex
)
if
(
solidityMode
)
{
step
=
this
.
resolveToReducedTrace
(
step
,
-
1
)
}
this
.
currentStepIndex
=
step
this
.
currentStepIndex
=
step
this
.
event
.
trigger
(
'stepChanged'
,
[
step
])
this
.
event
.
trigger
(
'stepChanged'
,
[
step
])
}
}
stepOverForward
()
{
stepOverForward
(
solidityMode
)
{
if
(
!
this
.
traceManager
.
isLoaded
())
return
if
(
!
this
.
traceManager
.
isLoaded
())
return
var
step
=
this
.
traceManager
.
findStepOverForward
(
this
.
currentStepIndex
)
var
step
=
this
.
traceManager
.
findStepOverForward
(
this
.
currentStepIndex
)
if
(
solidityMode
)
{
step
=
this
.
resolveToReducedTrace
(
step
,
1
)
}
this
.
currentStepIndex
=
step
this
.
currentStepIndex
=
step
this
.
event
.
trigger
(
'stepChanged'
,
[
step
])
this
.
event
.
trigger
(
'stepChanged'
,
[
step
])
}
}
jumpOut
()
{
jumpOut
(
solidityMode
)
{
if
(
!
this
.
traceManager
.
isLoaded
())
return
if
(
!
this
.
traceManager
.
isLoaded
())
return
var
step
=
this
.
traceManager
.
findStepOut
(
this
.
currentStepIndex
)
var
step
=
this
.
traceManager
.
findStepOut
(
this
.
currentStepIndex
)
if
(
solidityMode
)
{
step
=
this
.
resolveToReducedTrace
(
step
,
0
)
}
this
.
currentStepIndex
=
step
this
.
currentStepIndex
=
step
this
.
event
.
trigger
(
'stepChanged'
,
[
step
])
this
.
event
.
trigger
(
'stepChanged'
,
[
step
])
}
}
...
@@ -140,6 +156,20 @@ class DebuggerStepManager {
...
@@ -140,6 +156,20 @@ class DebuggerStepManager {
this
.
debugger
.
breakpointManager
.
jumpPreviousBreakpoint
(
this
.
currentStepIndex
,
true
)
this
.
debugger
.
breakpointManager
.
jumpPreviousBreakpoint
(
this
.
currentStepIndex
,
true
)
}
}
resolveToReducedTrace
(
value
,
incr
)
{
if
(
this
.
debugger
.
callTree
.
reducedTrace
.
length
)
{
var
nextSource
=
util
.
findClosestIndex
(
value
,
this
.
debugger
.
callTree
.
reducedTrace
)
nextSource
=
nextSource
+
incr
if
(
nextSource
<=
0
)
{
nextSource
=
0
}
else
if
(
nextSource
>
this
.
debugger
.
callTree
.
reducedTrace
.
length
)
{
nextSource
=
this
.
debugger
.
callTree
.
reducedTrace
.
length
-
1
}
return
this
.
debugger
.
callTree
.
reducedTrace
[
nextSource
]
}
return
value
}
}
}
module
.
exports
=
DebuggerStepManager
module
.
exports
=
DebuggerStepManager
remix-debug/src/solidity-decoder/internalCallTree.js
View file @
3284337f
...
@@ -230,7 +230,7 @@ function resolveVariableDeclaration (tree, step, sourceLocation) {
...
@@ -230,7 +230,7 @@ function resolveVariableDeclaration (tree, step, sourceLocation) {
if
(
ast
)
{
if
(
ast
)
{
tree
.
variableDeclarationByFile
[
sourceLocation
.
file
]
=
extractVariableDeclarations
(
ast
,
tree
.
astWalker
)
tree
.
variableDeclarationByFile
[
sourceLocation
.
file
]
=
extractVariableDeclarations
(
ast
,
tree
.
astWalker
)
}
else
{
}
else
{
console
.
log
(
'Ast not found for step '
+
step
+
'. file '
+
sourceLocation
.
file
)
//
console.log('Ast not found for step ' + step + '. file ' + sourceLocation.file)
return
null
return
null
}
}
}
}
...
@@ -243,7 +243,7 @@ function resolveFunctionDefinition (tree, step, sourceLocation) {
...
@@ -243,7 +243,7 @@ function resolveFunctionDefinition (tree, step, sourceLocation) {
if
(
ast
)
{
if
(
ast
)
{
tree
.
functionDefinitionByFile
[
sourceLocation
.
file
]
=
extractFunctionDefinitions
(
ast
,
tree
.
astWalker
)
tree
.
functionDefinitionByFile
[
sourceLocation
.
file
]
=
extractFunctionDefinitions
(
ast
,
tree
.
astWalker
)
}
else
{
}
else
{
console
.
log
(
'Ast not found for step '
+
step
+
'. file '
+
sourceLocation
.
file
)
//
console.log('Ast not found for step ' + step + '. file ' + sourceLocation.file)
return
null
return
null
}
}
}
}
...
...
remix-debug/src/solidity-decoder/solidityProxy.js
View file @
3284337f
...
@@ -117,7 +117,7 @@ class SolidityProxy {
...
@@ -117,7 +117,7 @@ class SolidityProxy {
if
(
this
.
sources
[
file
])
{
if
(
this
.
sources
[
file
])
{
return
this
.
sources
[
file
].
legacyAST
return
this
.
sources
[
file
].
legacyAST
}
else
{
}
else
{
console
.
log
(
'AST not found for file id '
+
sourceLocation
.
file
)
//
console.log('AST not found for file id ' + sourceLocation.file)
return
null
return
null
}
}
}
}
...
...
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