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
3f4965e0
Commit
3f4965e0
authored
Dec 14, 2020
by
aniket-engg
Committed by
Aniket
Dec 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
breakpointManager, eventManager, traceHelper import export updated
parent
eec30903
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
63 deletions
+58
-63
index.ts
libs/remix-debug/src/cmdline/index.ts
+1
-5
breakpointManager.ts
libs/remix-debug/src/code/breakpointManager.ts
+3
-3
eventManager.ts
libs/remix-debug/src/eventManager.ts
+1
-1
traceHelper.ts
libs/remix-debug/src/trace/traceHelper.ts
+53
-54
No files found.
libs/remix-debug/src/cmdline/index.ts
View file @
3f4965e0
import
Web3
from
'web3'
const
Debugger
=
require
(
'../debugger/debugger.js'
)
import
{
Debugger
}
from
'../debugger/debugger.js'
import
{
EventEmitter
}
from
'events'
export
class
CmdLine
{
...
...
@@ -47,13 +47,9 @@ export class CmdLine {
getSource
()
{
const
lineColumnPos
=
this
.
lineColumnPos
if
(
!
lineColumnPos
||
!
lineColumnPos
.
start
)
return
[]
const
content
=
this
.
compilation
.
compilationResult
.
source
.
sources
[
this
.
filename
].
content
.
split
(
'
\
n'
)
const
source
=
[]
let
line
line
=
content
[
lineColumnPos
.
start
.
line
-
2
]
if
(
line
!==
undefined
)
{
...
...
libs/remix-debug/src/code/breakpointManager.ts
View file @
3f4965e0
'use strict'
const
EventManager
=
require
(
'../eventManager'
)
const
helper
=
require
(
'../trace/traceHelper'
)
import
{
EventManager
}
from
'../eventManager'
import
{
isJumpDestInstruction
}
from
'../trace/traceHelper'
/**
* allow to manage breakpoint
...
...
@@ -72,7 +72,7 @@ export class BreakpointManager {
// isJumpDestInstruction -> returning from a internal function call
// depthChange -> returning from an external call
// sourceLocation.start <= previousSourceLocation.start && ... -> previous src is contained in the current one
if
((
helper
.
isJumpDestInstruction
(
trace
[
currentStep
])
&&
previousSourceLocation
.
jump
===
'o'
)
||
if
((
isJumpDestInstruction
(
trace
[
currentStep
])
&&
previousSourceLocation
.
jump
===
'o'
)
||
this
.
depthChange
(
currentStep
,
trace
)
||
(
sourceLocation
.
start
<=
previousSourceLocation
.
start
&&
sourceLocation
.
start
+
sourceLocation
.
length
>=
previousSourceLocation
.
start
+
previousSourceLocation
.
length
))
{
...
...
libs/remix-debug/src/eventManager.ts
View file @
3f4965e0
'use strict'
export
class
e
ventManager
{
export
class
E
ventManager
{
registered
anonymous
...
...
libs/remix-debug/src/trace/traceHelper.ts
View file @
3f4965e0
'use strict'
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
const
ui
=
remixLib
.
helpers
.
ui
import
{
helpers
}
from
'@remix-project/remix-lib'
const
ui
=
helpers
.
ui
export
=
{
// vmTraceIndex has to point to a CALL, CODECALL, ...
resolveCalledAddress
:
function
(
vmTraceIndex
,
trace
)
{
const
step
=
trace
[
vmTraceIndex
]
if
(
this
.
isCreateInstruction
(
step
))
{
return
this
.
contractCreationToken
(
vmTraceIndex
)
}
else
if
(
this
.
isCallInstruction
(
step
))
{
const
stack
=
step
.
stack
// callcode, delegatecall, ...
return
ui
.
normalizeHexAddress
(
stack
[
stack
.
length
-
2
])
}
return
undefined
},
export
function
resolveCalledAddress
(
vmTraceIndex
,
trace
)
{
const
step
=
trace
[
vmTraceIndex
]
if
(
isCreateInstruction
(
step
))
{
return
contractCreationToken
(
vmTraceIndex
)
}
else
if
(
isCallInstruction
(
step
))
{
const
stack
=
step
.
stack
// callcode, delegatecall, ...
return
ui
.
normalizeHexAddress
(
stack
[
stack
.
length
-
2
])
}
return
undefined
}
isCallInstruction
:
fun
ction
(
step
)
{
return
step
.
op
===
'CALL'
||
step
.
op
===
'CALLCODE'
||
step
.
op
===
'CREATE'
||
step
.
op
===
'DELEGATECALL'
},
export
function
isCallInstru
ction
(
step
)
{
return
step
.
op
===
'CALL'
||
step
.
op
===
'CALLCODE'
||
step
.
op
===
'CREATE'
||
step
.
op
===
'DELEGATECALL'
}
isCreateInstruction
:
fun
ction
(
step
)
{
return
step
.
op
===
'CREATE'
},
export
function
isCreateInstru
ction
(
step
)
{
return
step
.
op
===
'CREATE'
}
isReturnInstruction
:
fun
ction
(
step
)
{
return
step
.
op
===
'RETURN'
},
export
function
isReturnInstru
ction
(
step
)
{
return
step
.
op
===
'RETURN'
}
isJumpDestInstruction
:
fun
ction
(
step
)
{
return
step
.
op
===
'JUMPDEST'
},
export
function
isJumpDestInstru
ction
(
step
)
{
return
step
.
op
===
'JUMPDEST'
}
isStopInstruction
:
fun
ction
(
step
)
{
return
step
.
op
===
'STOP'
},
export
function
isStopInstru
ction
(
step
)
{
return
step
.
op
===
'STOP'
}
isRevertInstruction
:
fun
ction
(
step
)
{
return
step
.
op
===
'REVERT'
},
export
function
isRevertInstru
ction
(
step
)
{
return
step
.
op
===
'REVERT'
}
isSSTOREInstruction
:
fun
ction
(
step
)
{
return
step
.
op
===
'SSTORE'
},
export
function
isSSTOREInstru
ction
(
step
)
{
return
step
.
op
===
'SSTORE'
}
isSHA3Instruction
:
fun
ction
(
step
)
{
return
step
.
op
===
'SHA3'
},
export
function
isSHA3Instru
ction
(
step
)
{
return
step
.
op
===
'SHA3'
}
newContextStorage
:
function
(
step
)
{
return
step
.
op
===
'CREATE'
||
step
.
op
===
'CALL'
},
export
function
newContextStorage
(
step
)
{
return
step
.
op
===
'CREATE'
||
step
.
op
===
'CALL'
}
isCallToPrecompiledContract
:
function
(
index
,
trace
)
{
// if stack empty => this is not a precompiled contract
const
step
=
trace
[
index
]
if
(
this
.
isCallInstruction
(
step
))
{
return
index
+
1
<
trace
.
length
&&
trace
[
index
+
1
].
stack
.
length
!==
0
}
return
false
},
export
function
isCallToPrecompiledContract
(
index
,
trace
)
{
// if stack empty => this is not a precompiled contract
const
step
=
trace
[
index
]
if
(
this
.
isCallInstruction
(
step
))
{
return
index
+
1
<
trace
.
length
&&
trace
[
index
+
1
].
stack
.
length
!==
0
}
return
false
}
contractCreationToken
:
functio
n
(
index
)
{
return
'(Contract Creation - Step '
+
index
+
')'
},
export
function
contractCreationToke
n
(
index
)
{
return
'(Contract Creation - Step '
+
index
+
')'
}
isContractCreation
:
function
(
address
)
{
return
address
.
indexOf
(
'(Contract Creation - Step'
)
!==
-
1
}
export
function
isContractCreation
(
address
)
{
return
address
.
indexOf
(
'(Contract Creation - Step'
)
!==
-
1
}
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