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
2984cc21
Commit
2984cc21
authored
Dec 15, 2020
by
aniket-engg
Committed by
Aniket
Dec 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
source imports updated
parent
4c0a7417
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
20 deletions
+14
-20
offsetToLineColumnConverter.ts
libs/remix-debug/src/source/offsetToLineColumnConverter.ts
+3
-4
sourceLocationTracker.ts
libs/remix-debug/src/source/sourceLocationTracker.ts
+9
-13
sourceMappingDecoder.ts
libs/remix-debug/src/source/sourceMappingDecoder.ts
+2
-3
No files found.
libs/remix-debug/src/source/offsetToLineColumnConverter.ts
View file @
2984cc21
'use strict'
'use strict'
const
SourceMappingDecoder
=
require
(
'./sourceMappingDecoder'
)
import
{
getLinebreakPositions
,
convertOffsetToLineColumn
}
from
'./sourceMappingDecoder'
export
class
OffsetToColumnConverter
{
export
class
OffsetToColumnConverter
{
...
@@ -8,7 +8,6 @@ export class OffsetToColumnConverter {
...
@@ -8,7 +8,6 @@ export class OffsetToColumnConverter {
constructor
(
compilerEvent
)
{
constructor
(
compilerEvent
)
{
this
.
lineBreakPositionsByContent
=
{}
this
.
lineBreakPositionsByContent
=
{}
this
.
sourceMappingDecoder
=
new
SourceMappingDecoder
()
if
(
compilerEvent
)
{
if
(
compilerEvent
)
{
compilerEvent
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
compilerEvent
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
this
.
clear
()
this
.
clear
()
...
@@ -23,12 +22,12 @@ export class OffsetToColumnConverter {
...
@@ -23,12 +22,12 @@ export class OffsetToColumnConverter {
// source id was string before. in newer versions it has been changed to an integer so we need to check the type here
// source id was string before. in newer versions it has been changed to an integer so we need to check the type here
if
(
typeof
source
.
id
===
'string'
)
source
.
id
=
parseInt
(
source
.
id
,
10
)
if
(
typeof
source
.
id
===
'string'
)
source
.
id
=
parseInt
(
source
.
id
,
10
)
if
(
source
.
id
===
file
)
{
if
(
source
.
id
===
file
)
{
this
.
lineBreakPositionsByContent
[
file
]
=
this
.
sourceMappingDecoder
.
getLinebreakPositions
(
sources
[
filename
].
content
)
this
.
lineBreakPositionsByContent
[
file
]
=
getLinebreakPositions
(
sources
[
filename
].
content
)
break
break
}
}
}
}
}
}
return
this
.
sourceMappingDecoder
.
convertOffsetToLineColumn
(
rawLocation
,
this
.
lineBreakPositionsByContent
[
file
])
return
convertOffsetToLineColumn
(
rawLocation
,
this
.
lineBreakPositionsByContent
[
file
])
}
}
clear
()
{
clear
()
{
...
...
libs/remix-debug/src/source/sourceLocationTracker.ts
View file @
2984cc21
'use strict'
'use strict'
const
EventManager
=
require
(
'../eventManager'
)
import
{
EventManager
}
from
'../eventManager'
const
helper
=
require
(
'../trace/traceHelper'
)
import
{
isContractCreation
}
from
'../trace/traceHelper'
const
SourceMappingDecoder
=
require
(
'./sourceMappingDecoder'
)
import
{
atIndex
}
from
'./sourceMappingDecoder'
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
import
{
util
}
from
'@remix-project/remix-lib'
const
{
map
}
=
require
(
'jquery'
)
const
util
=
remixLib
.
util
/**
/**
* Process the source code location for the current executing bytecode
* Process the source code location for the current executing bytecode
...
@@ -14,7 +12,6 @@ export class SourceLocationTracker {
...
@@ -14,7 +12,6 @@ export class SourceLocationTracker {
opts
opts
codeManager
codeManager
event
event
sourceMappingDecoder
sourceMapByAddress
sourceMapByAddress
constructor
(
_codeManager
,
{
debugWithGeneratedSources
})
{
constructor
(
_codeManager
,
{
debugWithGeneratedSources
})
{
...
@@ -23,7 +20,6 @@ export class SourceLocationTracker {
...
@@ -23,7 +20,6 @@ export class SourceLocationTracker {
}
}
this
.
codeManager
=
_codeManager
this
.
codeManager
=
_codeManager
this
.
event
=
new
EventManager
()
this
.
event
=
new
EventManager
()
this
.
sourceMappingDecoder
=
new
SourceMappingDecoder
()
this
.
sourceMapByAddress
=
{}
this
.
sourceMapByAddress
=
{}
}
}
...
@@ -36,7 +32,7 @@ export class SourceLocationTracker {
...
@@ -36,7 +32,7 @@ export class SourceLocationTracker {
*/
*/
async
getSourceLocationFromInstructionIndex
(
address
,
index
,
contracts
)
{
async
getSourceLocationFromInstructionIndex
(
address
,
index
,
contracts
)
{
const
sourceMap
=
await
this
.
extractSourceMap
(
this
,
this
.
codeManager
,
address
,
contracts
)
const
sourceMap
=
await
this
.
extractSourceMap
(
this
,
this
.
codeManager
,
address
,
contracts
)
return
this
.
sourceMappingDecoder
.
atIndex
(
index
,
sourceMap
[
'map'
])
return
atIndex
(
index
,
sourceMap
[
'map'
])
}
}
/**
/**
...
@@ -49,7 +45,7 @@ export class SourceLocationTracker {
...
@@ -49,7 +45,7 @@ export class SourceLocationTracker {
async
getSourceLocationFromVMTraceIndex
(
address
,
vmtraceStepIndex
,
contracts
)
{
async
getSourceLocationFromVMTraceIndex
(
address
,
vmtraceStepIndex
,
contracts
)
{
const
sourceMap
=
await
this
.
extractSourceMap
(
this
,
this
.
codeManager
,
address
,
contracts
)
const
sourceMap
=
await
this
.
extractSourceMap
(
this
,
this
.
codeManager
,
address
,
contracts
)
const
index
=
this
.
codeManager
.
getInstructionIndex
(
address
,
vmtraceStepIndex
)
const
index
=
this
.
codeManager
.
getInstructionIndex
(
address
,
vmtraceStepIndex
)
return
this
.
sourceMappingDecoder
.
atIndex
(
index
,
sourceMap
[
'map'
])
return
atIndex
(
index
,
sourceMap
[
'map'
])
}
}
/**
/**
...
@@ -72,7 +68,7 @@ export class SourceLocationTracker {
...
@@ -72,7 +68,7 @@ export class SourceLocationTracker {
* @param {Object} contractDetails - AST of compiled contracts
* @param {Object} contractDetails - AST of compiled contracts
*/
*/
async
getValidSourceLocationFromVMTraceIndex
(
address
,
vmtraceStepIndex
,
contracts
)
{
async
getValidSourceLocationFromVMTraceIndex
(
address
,
vmtraceStepIndex
,
contracts
)
{
let
map
=
{
file
:
-
1
}
let
map
:
Record
<
string
,
number
>
=
{
file
:
-
1
}
while
(
vmtraceStepIndex
>=
0
&&
map
.
file
===
-
1
)
{
while
(
vmtraceStepIndex
>=
0
&&
map
.
file
===
-
1
)
{
map
=
await
this
.
getSourceLocationFromVMTraceIndex
(
address
,
vmtraceStepIndex
,
contracts
)
map
=
await
this
.
getSourceLocationFromVMTraceIndex
(
address
,
vmtraceStepIndex
,
contracts
)
vmtraceStepIndex
=
vmtraceStepIndex
-
1
vmtraceStepIndex
=
vmtraceStepIndex
-
1
...
@@ -85,7 +81,7 @@ export class SourceLocationTracker {
...
@@ -85,7 +81,7 @@ export class SourceLocationTracker {
}
}
private
getSourceMap
(
address
,
code
,
contracts
)
{
private
getSourceMap
(
address
,
code
,
contracts
)
{
const
isCreation
=
helper
.
isContractCreation
(
address
)
const
isCreation
=
isContractCreation
(
address
)
let
bytes
let
bytes
for
(
let
file
in
contracts
)
{
for
(
let
file
in
contracts
)
{
for
(
let
contract
in
contracts
[
file
])
{
for
(
let
contract
in
contracts
[
file
])
{
...
@@ -111,7 +107,7 @@ export class SourceLocationTracker {
...
@@ -111,7 +107,7 @@ export class SourceLocationTracker {
codeManager
.
getCode
(
address
).
then
((
result
)
=>
{
codeManager
.
getCode
(
address
).
then
((
result
)
=>
{
const
sourceMap
=
this
.
getSourceMap
(
address
,
result
.
bytecode
,
contracts
)
const
sourceMap
=
this
.
getSourceMap
(
address
,
result
.
bytecode
,
contracts
)
if
(
sourceMap
)
{
if
(
sourceMap
)
{
if
(
!
helper
.
isContractCreation
(
address
))
self
.
sourceMapByAddress
[
address
]
=
sourceMap
if
(
!
isContractCreation
(
address
))
self
.
sourceMapByAddress
[
address
]
=
sourceMap
return
resolve
(
sourceMap
)
return
resolve
(
sourceMap
)
}
}
reject
(
'no sourcemap associated with the code '
+
address
)
reject
(
'no sourcemap associated with the code '
+
address
)
...
...
libs/remix-debug/src/source/sourceMappingDecoder.ts
View file @
2984cc21
'use strict'
'use strict'
const
{
AstWalker
}
=
require
(
'@remix-project/remix-astwalker'
)
import
{
AstWalker
}
from
'@remix-project/remix-astwalker'
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
import
{
util
}
from
'@remix-project/remix-lib'
const
util
=
remixLib
.
util
/**
/**
* Decompress the source mapping given by solc-bin.js
* Decompress the source mapping given by solc-bin.js
...
...
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