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
68b4b822
Commit
68b4b822
authored
Jul 22, 2020
by
Iuri Matias
Committed by
aniket-engg
Aug 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor getReturnValue value
parent
13fe9cb6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
43 deletions
+36
-43
VmDebugger.js
libs/remix-debug/src/debugger/VmDebugger.js
+6
-5
codeManager.js
libs/remix-lib/src/code/codeManager.js
+9
-14
traceManager.js
libs/remix-lib/src/trace/traceManager.js
+7
-8
traceManager.js
libs/remix-lib/test/traceManager.js
+14
-16
No files found.
libs/remix-debug/src/debugger/VmDebugger.js
View file @
68b4b822
...
@@ -145,13 +145,14 @@ class VmDebuggerLogic {
...
@@ -145,13 +145,14 @@ class VmDebuggerLogic {
this
.
event
.
trigger
(
'traceRemainingGasUpdate'
,
[
error
])
this
.
event
.
trigger
(
'traceRemainingGasUpdate'
,
[
error
])
}
}
this
.
_traceManager
.
getReturnValue
(
index
,
(
error
,
returnValue
)
=>
{
try
{
if
(
error
)
{
const
returnValue
=
this
.
_traceManager
.
getReturnValue
(
index
)
this
.
event
.
trigger
(
'traceReturnValueUpdate'
,
[[
error
]])
if
(
this
.
stepManager
.
currentStepIndex
===
index
)
{
}
else
if
(
this
.
stepManager
.
currentStepIndex
===
index
)
{
this
.
event
.
trigger
(
'traceReturnValueUpdate'
,
[[
returnValue
]])
this
.
event
.
trigger
(
'traceReturnValueUpdate'
,
[[
returnValue
]])
}
}
})
}
catch
(
error
)
{
this
.
event
.
trigger
(
'traceReturnValueUpdate'
,
[[
error
]])
}
})
})
}
}
...
...
libs/remix-lib/src/code/codeManager.js
View file @
68b4b822
...
@@ -79,16 +79,11 @@ CodeManager.prototype.getCode = function (address, cb) {
...
@@ -79,16 +79,11 @@ CodeManager.prototype.getCode = function (address, cb) {
CodeManager
.
prototype
.
getFunctionFromStep
=
function
(
stepIndex
,
sourceMap
,
ast
)
{
CodeManager
.
prototype
.
getFunctionFromStep
=
function
(
stepIndex
,
sourceMap
,
ast
)
{
try
{
try
{
const
address
=
this
.
traceManager
.
getCurrentCalledAddressAt
(
stepIndex
)
const
address
=
this
.
traceManager
.
getCurrentCalledAddressAt
(
stepIndex
)
this
.
traceManager
.
getCurrentPC
(
stepIndex
,
(
error
,
pc
)
=>
{
const
pc
=
this
.
traceManager
.
getCurrentPC
(
stepIndex
)
if
(
error
)
{
return
this
.
getFunctionFromPC
(
address
,
pc
,
sourceMap
,
ast
)
console
.
log
(
error
)
return
{
error
:
'Cannot retrieve current PC for '
+
stepIndex
}
}
return
this
.
getFunctionFromPC
(
address
,
pc
,
sourceMap
,
ast
)
})
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
return
{
error
:
'Cannot retrieve current address for '
+
stepIndex
}
return
{
error
:
'Cannot retrieve current address
or PC
for '
+
stepIndex
}
}
}
}
}
...
@@ -100,14 +95,14 @@ CodeManager.prototype.getFunctionFromStep = function (stepIndex, sourceMap, ast)
...
@@ -100,14 +95,14 @@ CodeManager.prototype.getFunctionFromStep = function (stepIndex, sourceMap, ast)
* @param {Function} callback - instruction index
* @param {Function} callback - instruction index
*/
*/
CodeManager
.
prototype
.
getInstructionIndex
=
function
(
address
,
step
,
callback
)
{
CodeManager
.
prototype
.
getInstructionIndex
=
function
(
address
,
step
,
callback
)
{
this
.
traceManager
.
getCurrentPC
(
step
,
(
error
,
pc
)
=>
{
try
{
if
(
error
)
{
const
pc
=
this
.
traceManager
.
getCurrentPC
(
step
)
console
.
log
(
error
)
return
callback
(
'Cannot retrieve current PC for '
+
step
,
null
)
}
const
itemIndex
=
this
.
codeResolver
.
getInstructionIndex
(
address
,
pc
)
const
itemIndex
=
this
.
codeResolver
.
getInstructionIndex
(
address
,
pc
)
callback
(
null
,
itemIndex
)
callback
(
null
,
itemIndex
)
})
}
catch
(
error
)
{
console
.
log
(
error
)
return
callback
(
'Cannot retrieve current PC for '
+
step
,
null
)
}
}
}
/**
/**
...
...
libs/remix-lib/src/trace/traceManager.js
View file @
68b4b822
...
@@ -179,26 +179,25 @@ TraceManager.prototype.getMemoryAt = function (stepIndex) {
...
@@ -179,26 +179,25 @@ TraceManager.prototype.getMemoryAt = function (stepIndex) {
return
this
.
trace
[
lastChanges
].
memory
return
this
.
trace
[
lastChanges
].
memory
}
}
TraceManager
.
prototype
.
getCurrentPC
=
function
(
stepIndex
,
callback
)
{
TraceManager
.
prototype
.
getCurrentPC
=
function
(
stepIndex
)
{
try
{
try
{
this
.
checkRequestedStep
(
stepIndex
)
this
.
checkRequestedStep
(
stepIndex
)
}
catch
(
check
)
{
}
catch
(
check
)
{
return
callback
(
check
,
null
)
throw
new
Error
(
check
)
}
}
callback
(
null
,
this
.
trace
[
stepIndex
].
pc
)
return
this
.
trace
[
stepIndex
].
pc
}
}
TraceManager
.
prototype
.
getReturnValue
=
function
(
stepIndex
,
callback
)
{
TraceManager
.
prototype
.
getReturnValue
=
function
(
stepIndex
)
{
try
{
try
{
this
.
checkRequestedStep
(
stepIndex
)
this
.
checkRequestedStep
(
stepIndex
)
}
catch
(
check
)
{
}
catch
(
check
)
{
return
callback
(
check
,
null
)
throw
new
Error
(
check
)
}
}
if
(
!
this
.
traceCache
.
returnValues
[
stepIndex
])
{
if
(
!
this
.
traceCache
.
returnValues
[
stepIndex
])
{
callback
(
'current step is not a return step'
)
throw
new
Error
(
'current step is not a return step'
)
}
else
{
callback
(
null
,
this
.
traceCache
.
returnValues
[
stepIndex
])
}
}
return
this
.
traceCache
.
returnValues
[
stepIndex
]
}
}
TraceManager
.
prototype
.
getCurrentStep
=
function
(
stepIndex
,
callback
)
{
TraceManager
.
prototype
.
getCurrentStep
=
function
(
stepIndex
,
callback
)
{
...
...
libs/remix-lib/test/traceManager.js
View file @
68b4b822
...
@@ -198,15 +198,14 @@ tape('TraceManager', function (t) {
...
@@ -198,15 +198,14 @@ tape('TraceManager', function (t) {
})
})
t
.
test
(
'TraceManager.getCurrentPC'
,
function
(
st
)
{
t
.
test
(
'TraceManager.getCurrentPC'
,
function
(
st
)
{
traceManager
.
getCurrentPC
(
13
,
function
(
error
,
result
)
{
try
{
const
result
=
traceManager
.
getCurrentPC
(
13
)
console
.
log
(
result
)
console
.
log
(
result
)
if
(
error
)
{
st
.
ok
(
result
===
'65'
)
st
.
fail
(
error
)
st
.
end
()
}
else
{
}
catch
(
error
)
{
st
.
ok
(
result
===
'65'
)
st
.
fail
(
error
)
st
.
end
()
}
}
})
})
})
t
.
test
(
'TraceManager.getCurrentStep'
,
function
(
st
)
{
t
.
test
(
'TraceManager.getCurrentStep'
,
function
(
st
)
{
...
@@ -283,13 +282,12 @@ tape('TraceManager', function (t) {
...
@@ -283,13 +282,12 @@ tape('TraceManager', function (t) {
})
})
t
.
test
(
'TraceManager.getReturnValue'
,
function
(
st
)
{
t
.
test
(
'TraceManager.getReturnValue'
,
function
(
st
)
{
traceManager
.
getReturnValue
(
108
,
function
(
error
,
result
)
{
try
{
if
(
error
)
{
const
result
=
traceManager
.
getReturnValue
(
108
)
st
.
fail
(
error
)
st
.
ok
(
result
[
0
]
===
'0x60606040526008565b0000000000000000000000000000000000000000000000'
)
}
else
{
st
.
end
()
st
.
ok
(
result
[
0
]
===
'0x60606040526008565b0000000000000000000000000000000000000000000000'
)
}
catch
(
error
)
{
st
.
end
()
st
.
fail
(
error
)
}
}
})
})
})
})
})
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