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
0a9aa84a
Commit
0a9aa84a
authored
Jul 22, 2020
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sourceLocationFromVMTraceIndex a promise
parent
8bb7e18b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
25 deletions
+12
-25
Ethdebugger.js
libs/remix-debug/src/Ethdebugger.js
+8
-18
debugger.js
libs/remix-debug/test/debugger.js
+4
-7
No files found.
libs/remix-debug/src/Ethdebugger.js
View file @
0a9aa84a
'use strict'
const
StorageViewer
=
require
(
'./storage/storageViewer'
)
const
StorageResolver
=
require
(
'./storage/storageResolver'
)
const
SolidityDecoder
=
require
(
'./solidity-decoder'
)
const
SolidityProxy
=
SolidityDecoder
.
SolidityProxy
const
stateDecoder
=
SolidityDecoder
.
stateDecoder
const
localDecoder
=
SolidityDecoder
.
localDecoder
const
InternalCallTree
=
SolidityDecoder
.
InternalCallTree
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
const
TraceManager
=
remixLib
.
trace
.
TraceManager
const
CodeManager
=
remixLib
.
code
.
CodeManager
const
traceHelper
=
remixLib
.
helpers
.
trace
const
EventManager
=
remixLib
.
EventManager
const
{
SolidityProxy
,
stateDecoder
,
localDecoder
,
InternalCallTree
}
=
require
(
'./solidity-decoder'
)
const
StorageViewer
=
require
(
'./storage/storageViewer'
)
const
StorageResolver
=
require
(
'./storage/storageResolver'
)
/**
* Ethdebugger is a wrapper around a few classes that helps debugging a transaction
*
...
...
@@ -58,17 +54,11 @@ Ethdebugger.prototype.resolveStep = function (index) {
}
Ethdebugger
.
prototype
.
setCompilationResult
=
function
(
compilationResult
)
{
if
(
compilationResult
&&
compilationResult
.
data
)
{
this
.
solidityProxy
.
reset
(
compilationResult
.
data
)
}
else
{
this
.
solidityProxy
.
reset
({})
}
this
.
solidityProxy
.
reset
((
compilationResult
&&
compilationResult
.
data
)
||
{})
}
Ethdebugger
.
prototype
.
sourceLocationFromVMTraceIndex
=
function
(
address
,
stepIndex
,
callback
)
{
this
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
stepIndex
,
this
.
solidityProxy
.
contracts
).
then
((
rawLocation
)
=>
{
callback
(
null
,
rawLocation
)
}).
catch
(
callback
)
Ethdebugger
.
prototype
.
sourceLocationFromVMTraceIndex
=
async
function
(
address
,
stepIndex
)
{
return
this
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
stepIndex
,
this
.
solidityProxy
.
contracts
)
}
Ethdebugger
.
prototype
.
sourceLocationFromInstructionIndex
=
function
(
address
,
instIndex
,
callback
)
{
...
...
libs/remix-debug/test/debugger.js
View file @
0a9aa84a
...
...
@@ -253,19 +253,16 @@ function testDebugging (debugManager) {
})
})
tape
(
'traceManager.decodeLocalsAt'
,
(
t
)
=>
{
tape
(
'traceManager.decodeLocalsAt'
,
async
(
t
)
=>
{
t
.
plan
(
1
)
const
tested
=
JSON
.
parse
(
'{"proposalNames":{"value":[{"value":"0x48656C6C6F20576F726C64210000000000000000000000000000000000000000","type":"bytes32"}],"length":"0x1","type":"bytes32[]"},"p":{"value":"45","type":"uint256"},"addressLocal":{"value":"0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB","type":"address"},"i":{"value":"2","type":"uint256"},"proposalsLocals":{"value":[{"value":{"name":{"value":"0x48656C6C6F20576F726C64210000000000000000000000000000000000000000","type":"bytes32"},"voteCount":{"value":"0","type":"uint256"}},"type":"struct Ballot.Proposal"}],"length":"0x1","type":"struct Ballot.Proposal[]"}}'
)
try
{
const
address
=
debugManager
.
traceManager
.
getCurrentCalledAddressAt
(
330
)
debugManager
.
sourceLocationFromVMTraceIndex
(
address
,
330
,
(
error
,
location
)
=>
{
const
location
=
await
debugManager
.
sourceLocationFromVMTraceIndex
(
address
,
330
)
debugManager
.
decodeLocalsAt
(
330
,
location
,
(
error
,
decodedlocals
)
=>
{
if
(
error
)
return
t
.
end
(
error
)
debugManager
.
decodeLocalsAt
(
330
,
location
,
(
error
,
decodedlocals
)
=>
{
if
(
error
)
return
t
.
end
(
error
)
t
.
equal
(
JSON
.
stringify
(
decodedlocals
),
JSON
.
stringify
(
tested
))
})
t
.
equal
(
JSON
.
stringify
(
decodedlocals
),
JSON
.
stringify
(
tested
))
})
// })
}
catch
(
error
)
{
return
t
.
end
(
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