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
db528339
Commit
db528339
authored
Jul 14, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
highlight the last 5 items instead of only one
parent
fbf73b42
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
23 deletions
+32
-23
codeManager.ts
libs/remix-debug/src/code/codeManager.ts
+6
-2
VmDebugger.ts
libs/remix-debug/src/debugger/VmDebugger.ts
+2
-2
assembly-items.tsx
...mix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
+20
-15
assembly-items.ts
libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts
+4
-4
No files found.
libs/remix-debug/src/code/codeManager.ts
View file @
db528339
...
@@ -147,13 +147,17 @@ export class CodeManager {
...
@@ -147,13 +147,17 @@ export class CodeManager {
private
async
retrieveIndexAndTrigger
(
codeMananger
,
address
,
step
,
code
)
{
private
async
retrieveIndexAndTrigger
(
codeMananger
,
address
,
step
,
code
)
{
let
result
let
result
let
next
const
next
=
[]
const
returnInstructionIndexes
=
[]
const
returnInstructionIndexes
=
[]
const
outOfGasInstructionIndexes
=
[]
const
outOfGasInstructionIndexes
=
[]
try
{
try
{
result
=
codeMananger
.
getInstructionIndex
(
address
,
step
)
result
=
codeMananger
.
getInstructionIndex
(
address
,
step
)
next
=
codeMananger
.
getInstructionIndex
(
address
,
step
+
1
)
for
(
let
i
=
1
;
i
<
6
;
i
++
)
{
if
(
this
.
traceManager
.
inRange
(
step
+
i
))
{
next
.
push
(
codeMananger
.
getInstructionIndex
(
address
,
step
+
i
))
}
}
let
values
=
this
.
traceManager
.
getAllStopIndexes
()
let
values
=
this
.
traceManager
.
getAllStopIndexes
()
if
(
values
)
{
if
(
values
)
{
...
...
libs/remix-debug/src/debugger/VmDebugger.ts
View file @
db528339
...
@@ -59,8 +59,8 @@ export class VmDebuggerLogic {
...
@@ -59,8 +59,8 @@ export class VmDebuggerLogic {
}
}
listenToCodeManagerEvents
()
{
listenToCodeManagerEvents
()
{
this
.
_codeManager
.
event
.
register
(
'changed'
,
(
code
,
address
,
index
,
nextIndex
,
returnInstructionIndexes
,
outOfGasInstructionIndexes
)
=>
{
this
.
_codeManager
.
event
.
register
(
'changed'
,
(
code
,
address
,
index
,
nextIndex
es
,
returnInstructionIndexes
,
outOfGasInstructionIndexes
)
=>
{
this
.
event
.
trigger
(
'codeManagerChanged'
,
[
code
,
address
,
index
,
nextIndex
,
returnInstructionIndexes
,
outOfGasInstructionIndexes
])
this
.
event
.
trigger
(
'codeManagerChanged'
,
[
code
,
address
,
index
,
nextIndex
es
,
returnInstructionIndexes
,
outOfGasInstructionIndexes
])
})
})
}
}
...
...
libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
View file @
db528339
...
@@ -6,15 +6,15 @@ export const AssemblyItems = ({ registerEvent }) => {
...
@@ -6,15 +6,15 @@ export const AssemblyItems = ({ registerEvent }) => {
const
[
assemblyItems
,
dispatch
]
=
useReducer
(
reducer
,
initialState
)
const
[
assemblyItems
,
dispatch
]
=
useReducer
(
reducer
,
initialState
)
const
[
absoluteSelectedIndex
,
setAbsoluteSelectedIndex
]
=
useState
(
0
)
const
[
absoluteSelectedIndex
,
setAbsoluteSelectedIndex
]
=
useState
(
0
)
const
[
selectedItem
,
setSelectedItem
]
=
useState
(
0
)
const
[
selectedItem
,
setSelectedItem
]
=
useState
(
0
)
const
[
nextSelectedItem
,
setNextSelectedItem
]
=
useState
(
1
)
const
[
nextSelectedItem
s
,
setNextSelectedItems
]
=
useState
([
1
]
)
const
[
returnInstructionIndexes
,
setReturnInstructionIndexes
]
=
useState
([])
const
[
returnInstructionIndexes
,
setReturnInstructionIndexes
]
=
useState
([])
const
[
outOfGasInstructionIndexes
,
setOutOfGasInstructionIndexes
]
=
useState
([])
const
[
outOfGasInstructionIndexes
,
setOutOfGasInstructionIndexes
]
=
useState
([])
const
refs
=
useRef
({})
const
refs
=
useRef
({})
const
asmItemsRef
=
useRef
(
null
)
const
asmItemsRef
=
useRef
(
null
)
useEffect
(()
=>
{
useEffect
(()
=>
{
registerEvent
&&
registerEvent
(
'codeManagerChanged'
,
(
code
,
address
,
index
,
nextIndex
,
returnInstructionIndexes
,
outOfGasInstructionIndexes
)
=>
{
registerEvent
&&
registerEvent
(
'codeManagerChanged'
,
(
code
,
address
,
index
,
nextIndex
es
,
returnInstructionIndexes
,
outOfGasInstructionIndexes
)
=>
{
dispatch
({
type
:
'FETCH_OPCODES_SUCCESS'
,
payload
:
{
code
,
address
,
index
,
nextIndex
,
returnInstructionIndexes
,
outOfGasInstructionIndexes
}
})
dispatch
({
type
:
'FETCH_OPCODES_SUCCESS'
,
payload
:
{
code
,
address
,
index
,
nextIndex
es
,
returnInstructionIndexes
,
outOfGasInstructionIndexes
}
})
})
})
},
[])
},
[])
...
@@ -22,7 +22,7 @@ export const AssemblyItems = ({ registerEvent }) => {
...
@@ -22,7 +22,7 @@ export const AssemblyItems = ({ registerEvent }) => {
if
(
absoluteSelectedIndex
!==
assemblyItems
.
index
)
{
if
(
absoluteSelectedIndex
!==
assemblyItems
.
index
)
{
clearItems
()
clearItems
()
indexChanged
(
assemblyItems
.
index
)
indexChanged
(
assemblyItems
.
index
)
nextIndex
Changed
(
assemblyItems
.
nextIndex
)
nextIndex
esChanged
(
assemblyItems
.
nextIndexes
)
returnIndexes
(
assemblyItems
.
returnInstructionIndexes
)
returnIndexes
(
assemblyItems
.
returnInstructionIndexes
)
outOfGasIndexes
(
assemblyItems
.
outOfGasInstructionIndexes
)
outOfGasIndexes
(
assemblyItems
.
outOfGasInstructionIndexes
)
}
}
...
@@ -40,7 +40,11 @@ export const AssemblyItems = ({ registerEvent }) => {
...
@@ -40,7 +40,11 @@ export const AssemblyItems = ({ registerEvent }) => {
const
clearItems
=
()
=>
{
const
clearItems
=
()
=>
{
clearItem
(
refs
.
current
[
selectedItem
]
?
refs
.
current
[
selectedItem
]
:
null
)
clearItem
(
refs
.
current
[
selectedItem
]
?
refs
.
current
[
selectedItem
]
:
null
)
clearItem
(
refs
.
current
[
nextSelectedItem
]
?
refs
.
current
[
nextSelectedItem
]
:
null
)
if
(
nextSelectedItems
)
{
nextSelectedItems
.
map
((
index
)
=>
{
clearItem
(
refs
.
current
[
index
]
?
refs
.
current
[
index
]
:
null
)
})
}
returnInstructionIndexes
.
map
((
index
)
=>
{
returnInstructionIndexes
.
map
((
index
)
=>
{
if
(
index
<
0
)
return
if
(
index
<
0
)
return
...
@@ -70,18 +74,19 @@ export const AssemblyItems = ({ registerEvent }) => {
...
@@ -70,18 +74,19 @@ export const AssemblyItems = ({ registerEvent }) => {
setAbsoluteSelectedIndex
(
assemblyItems
.
opCodes
.
index
)
setAbsoluteSelectedIndex
(
assemblyItems
.
opCodes
.
index
)
}
}
const
nextIndexChanged
=
(
index
:
number
)
=>
{
const
nextIndexesChanged
=
(
indexes
:
Array
<
number
>
)
=>
{
if
(
index
<
0
)
return
indexes
.
map
((
index
)
=>
{
if
(
index
<
0
)
return
const
codeView
=
asmItemsRef
.
current
const
codeView
=
asmItemsRef
.
current
const
currentItem
=
codeView
.
children
[
index
]
const
currentItem
=
codeView
.
children
[
index
]
if
(
currentItem
)
{
if
(
currentItem
)
{
currentItem
.
style
.
setProperty
(
'border-color'
,
'var(--second
ary)'
)
currentItem
.
style
.
setProperty
(
'color'
,
'var(--prim
ary)'
)
currentItem
.
style
.
setProperty
(
'border-style'
,
'dot
ted'
)
currentItem
.
setAttribute
(
'selected'
,
'selec
ted'
)
currentItem
.
setAttribute
(
'selected'
,
'selected'
)
}
}
}
)
setNextSelectedItem
(
index
)
setNextSelectedItem
s
(
indexes
)
}
}
const
returnIndexes
=
(
indexes
)
=>
{
const
returnIndexes
=
(
indexes
)
=>
{
...
...
libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts
View file @
db528339
...
@@ -13,7 +13,7 @@ export const initialState = {
...
@@ -13,7 +13,7 @@ export const initialState = {
},
},
display
:
[],
display
:
[],
index
:
0
,
index
:
0
,
nextIndex
:
-
1
,
nextIndex
es
:
[
-
1
]
,
returnInstructionIndexes
:
[],
returnInstructionIndexes
:
[],
outOfGasInstructionIndexes
:
[],
outOfGasInstructionIndexes
:
[],
top
:
0
,
top
:
0
,
...
@@ -30,7 +30,7 @@ const reducedOpcode = (opCodes, payload) => {
...
@@ -30,7 +30,7 @@ const reducedOpcode = (opCodes, payload) => {
const
top
=
bottom
+
length
const
top
=
bottom
+
length
return
{
return
{
index
:
opCodes
.
index
-
bottom
,
index
:
opCodes
.
index
-
bottom
,
nextIndex
:
opCodes
.
nextIndex
-
bottom
,
nextIndex
es
:
opCodes
.
nextIndexes
.
map
(
index
=>
index
-
bottom
)
,
display
:
opCodes
.
code
.
slice
(
bottom
,
top
),
display
:
opCodes
.
code
.
slice
(
bottom
,
top
),
returnInstructionIndexes
:
payload
.
returnInstructionIndexes
.
map
((
index
)
=>
index
.
instructionIndex
-
bottom
),
returnInstructionIndexes
:
payload
.
returnInstructionIndexes
.
map
((
index
)
=>
index
.
instructionIndex
-
bottom
),
outOfGasInstructionIndexes
:
payload
.
outOfGasInstructionIndexes
.
map
((
index
)
=>
index
.
instructionIndex
-
bottom
)
outOfGasInstructionIndexes
:
payload
.
outOfGasInstructionIndexes
.
map
((
index
)
=>
index
.
instructionIndex
-
bottom
)
...
@@ -49,7 +49,7 @@ export const reducer = (state = initialState, action: Action) => {
...
@@ -49,7 +49,7 @@ export const reducer = (state = initialState, action: Action) => {
}
}
case
'FETCH_OPCODES_SUCCESS'
:
{
case
'FETCH_OPCODES_SUCCESS'
:
{
const
opCodes
=
action
.
payload
.
address
===
state
.
opCodes
.
address
?
{
const
opCodes
=
action
.
payload
.
address
===
state
.
opCodes
.
address
?
{
...
state
.
opCodes
,
index
:
action
.
payload
.
index
,
nextIndex
:
action
.
payload
.
nextIndex
...
state
.
opCodes
,
index
:
action
.
payload
.
index
,
nextIndex
es
:
action
.
payload
.
nextIndexes
}
:
deepEqual
(
action
.
payload
.
code
,
state
.
opCodes
.
code
)
?
state
.
opCodes
:
action
.
payload
}
:
deepEqual
(
action
.
payload
.
code
,
state
.
opCodes
.
code
)
?
state
.
opCodes
:
action
.
payload
const
reduced
=
reducedOpcode
(
opCodes
,
action
.
payload
)
const
reduced
=
reducedOpcode
(
opCodes
,
action
.
payload
)
...
@@ -57,7 +57,7 @@ export const reducer = (state = initialState, action: Action) => {
...
@@ -57,7 +57,7 @@ export const reducer = (state = initialState, action: Action) => {
opCodes
,
opCodes
,
display
:
reduced
.
display
,
display
:
reduced
.
display
,
index
:
reduced
.
index
,
index
:
reduced
.
index
,
nextIndex
:
reduced
.
nextIndex
,
nextIndex
es
:
reduced
.
nextIndexes
,
isRequesting
:
false
,
isRequesting
:
false
,
isSuccessful
:
true
,
isSuccessful
:
true
,
hasError
:
null
,
hasError
:
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