Commit cf262246 authored by ioedeveloper's avatar ioedeveloper

Call vmDebuggerLogic d start after event registration

parent 750f0652
...@@ -28,10 +28,9 @@ export const DebuggerUI = ({ debuggerModule, fetchContractAndCompile, debugHash, ...@@ -28,10 +28,9 @@ export const DebuggerUI = ({ debuggerModule, fetchContractAndCompile, debugHash,
}, },
blockNumber: null, blockNumber: null,
txNumber: '', txNumber: '',
visibility: { ready: {
vmDebugger: false, vmDebugger: false,
stepManager: false, vmDebuggerHead: false
txBrowser: false
}, },
debugging: false debugging: false
}) })
...@@ -130,20 +129,20 @@ export const DebuggerUI = ({ debuggerModule, fetchContractAndCompile, debugHash, ...@@ -130,20 +129,20 @@ export const DebuggerUI = ({ debuggerModule, fetchContractAndCompile, debugHash,
// yo.update(this.debuggerHeadPanelsView, yo`<div></div>`) // yo.update(this.debuggerHeadPanelsView, yo`<div></div>`)
// yo.update(this.debuggerPanelsView, yo`<div></div>`) // yo.update(this.debuggerPanelsView, yo`<div></div>`)
// yo.update(this.stepManagerView, yo`<div></div>`) // yo.update(this.stepManagerView, yo`<div></div>`)
setState(prevState => { // setState(prevState => {
const { visibility } = prevState // const { visibility } = prevState
return { // return {
...prevState, // ...prevState,
debugger: null, // debugger: null,
debugging: false, // debugging: false,
visibility: { // visibility: {
...visibility, // ...visibility,
vmDebugger: false, // vmDebugger: false,
stepManager: false // stepManager: false
} // }
} // }
}) // })
event.trigger('traceUnloaded', []) event.trigger('traceUnloaded', [])
} }
...@@ -222,6 +221,34 @@ const deleteHighlights = async () => { ...@@ -222,6 +221,34 @@ const deleteHighlights = async () => {
await debuggerModule.call('editor', 'discardHighlight') await debuggerModule.call('editor', 'discardHighlight')
} }
const vmDebuggerReady = () => {
setState(prevState => {
return {
...prevState,
ready: {
...prevState.ready,
vmDebugger: true
}
}
})
}
const vmDebuggerHeadReady = () => {
setState(prevState => {
return {
...prevState,
ready: {
...prevState.ready,
vmDebuggerHead: true
}
}
})
}
if (state.ready.vmDebugger && state.ready.vmDebuggerHead) {
state.debugger.vmDebuggerLogic.start()
}
// this.debuggerPanelsView = yo`<div class="px-2"></div>` // this.debuggerPanelsView = yo`<div class="px-2"></div>`
// this.debuggerHeadPanelsView = yo`<div class="px-2"></div>` // this.debuggerHeadPanelsView = yo`<div class="px-2"></div>`
// this.stepManagerView = yo`<div class="px-2"></div>` // this.stepManagerView = yo`<div class="px-2"></div>`
...@@ -231,10 +258,10 @@ const deleteHighlights = async () => { ...@@ -231,10 +258,10 @@ const deleteHighlights = async () => {
<div className="px-2"> <div className="px-2">
<TxBrowser requestDebug={ requestDebug } unloadRequested={ unloadRequested } transactionNumber={ state.txNumber } debugging={ state.debugging } /> <TxBrowser requestDebug={ requestDebug } unloadRequested={ unloadRequested } transactionNumber={ state.txNumber } debugging={ state.debugging } />
<StepManager stepManager={ state.debugger ? state.debugger.step_manager : null } /> <StepManager stepManager={ state.debugger ? state.debugger.step_manager : null } />
<VmDebuggerHead vmDebuggerLogic={ state.debugger ? state.debugger.vmDebuggerLogic : null } /> <VmDebuggerHead vmDebuggerLogic={ state.debugger ? state.debugger.vmDebuggerLogic : null } ready={vmDebuggerHeadReady} />
</div> </div>
{/* <div className="statusMessage">{state.statusMessage}</div> <div className="statusMessage">{ state.statusMessage }</div>
<VmDebugger vmDebuggerLogic={state.debugger.vmDebuggerLogic} /> */} <VmDebugger vmDebuggerLogic={ state.debugger ? state.debugger.vmDebuggerLogic : null } ready={vmDebuggerReady} />
</div> </div>
) )
} }
......
...@@ -18,13 +18,11 @@ export const AssemblyItems = ({ codeView, index }) => { ...@@ -18,13 +18,11 @@ export const AssemblyItems = ({ codeView, index }) => {
let currentItem = refs.current[selectedItem] ? refs.current[selectedItem] : null let currentItem = refs.current[selectedItem] ? refs.current[selectedItem] : null
if (currentItem) { if (currentItem) {
if (selectedItem) {
currentItem.removeAttribute('selected') currentItem.removeAttribute('selected')
currentItem.removeAttribute('style') currentItem.removeAttribute('style')
if (currentItem.firstChild) { if (currentItem.firstChild) {
currentItem.firstChild.removeAttribute('style') currentItem.firstChild.removeAttribute('style')
} }
}
const codeView = asmItemsRef.current const codeView = asmItemsRef.current
currentItem = codeView.children[index] currentItem = codeView.children[index]
......
...@@ -2,6 +2,7 @@ import React from 'react' ...@@ -2,6 +2,7 @@ import React from 'react'
import DropdownPanel from './dropdown-panel' import DropdownPanel from './dropdown-panel'
export const StackPanel = ({ calldata }) => { export const StackPanel = ({ calldata }) => {
console.log('calldata: ', calldata)
return ( return (
<div id="stackpanel"> <div id="stackpanel">
<DropdownPanel dropdownName='Stack' opts={{ json: true }} calldata={calldata} /> <DropdownPanel dropdownName='Stack' opts={{ json: true }} calldata={calldata} />
......
...@@ -5,7 +5,7 @@ import StepDetail from './step-detail' ...@@ -5,7 +5,7 @@ import StepDetail from './step-detail'
import SolidityState from './solidity-state' import SolidityState from './solidity-state'
import SolidityLocals from './solidity-locals' import SolidityLocals from './solidity-locals'
export const VmDebuggerHead = ({ vmDebuggerLogic }) => { export const VmDebuggerHead = ({ vmDebuggerLogic, ready }) => {
const [panelVisibility, setPanelVisibility] = useState({ const [panelVisibility, setPanelVisibility] = useState({
functionPanel: true, functionPanel: true,
stepDetail: true, stepDetail: true,
...@@ -99,7 +99,7 @@ export const VmDebuggerHead = ({ vmDebuggerLogic }) => { ...@@ -99,7 +99,7 @@ export const VmDebuggerHead = ({ vmDebuggerLogic }) => {
fullStoragesChangesPanel: true fullStoragesChangesPanel: true
}) })
}) })
vmDebuggerLogic.start() ready()
} }
}, [vmDebuggerLogic]) }, [vmDebuggerLogic])
...@@ -118,4 +118,4 @@ export const VmDebuggerHead = ({ vmDebuggerLogic }) => { ...@@ -118,4 +118,4 @@ export const VmDebuggerHead = ({ vmDebuggerLogic }) => {
) )
} }
export default VmDebuggerHead; export default VmDebuggerHead
...@@ -5,7 +5,7 @@ import CallstackPanel from './callstack-panel' ...@@ -5,7 +5,7 @@ import CallstackPanel from './callstack-panel'
import StackPanel from './stack-panel' import StackPanel from './stack-panel'
import StoragePanel from './storage-panel' import StoragePanel from './storage-panel'
export const VmDebugger = ({ vmDebuggerLogic }) => { export const VmDebugger = ({ vmDebuggerLogic, ready }) => {
const [panelVisibility, setPanelVisibility] = useState({ const [panelVisibility, setPanelVisibility] = useState({
asmCode: true, asmCode: true,
stackPanel: true, stackPanel: true,
...@@ -24,6 +24,7 @@ export const VmDebugger = ({ vmDebuggerLogic }) => { ...@@ -24,6 +24,7 @@ export const VmDebugger = ({ vmDebuggerLogic }) => {
}) })
useEffect(() => { useEffect(() => {
if (vmDebuggerLogic) {
vmDebuggerLogic.event.register('traceManagerCallDataUpdate', (calldata) => { vmDebuggerLogic.event.register('traceManagerCallDataUpdate', (calldata) => {
setCalldataPanel(calldata) setCalldataPanel(calldata)
}) })
...@@ -55,20 +56,21 @@ export const VmDebugger = ({ vmDebuggerLogic }) => { ...@@ -55,20 +56,21 @@ export const VmDebugger = ({ vmDebuggerLogic }) => {
// solidityPanel: false // solidityPanel: false
// }) // })
// }) // })
vmDebuggerLogic.start() ready()
}, []) }
}, [vmDebuggerLogic])
return ( return (
<div id="vmdebugger" className="px-2"> <div id="vmdebugger" className="px-2">
<div> <div>
<StackPanel calldata={stackPanel} /> <StackPanel calldata={stackPanel || {}} />
<MemoryPanel calldata={memoryPanel} /> {/* <MemoryPanel calldata={memoryPanel} /> */}
<StoragePanel storage={storagePanel.calldata} header={storagePanel.header} /> {/* <StoragePanel storage={storagePanel.calldata} header={storagePanel.header} /> */}
<CallstackPanel calldata={callStackPanel} /> {/* <CallstackPanel calldata={callStackPanel} /> */}
<CalldataPanel calldata={calldataPanel} /> {/* <CalldataPanel calldata={calldataPanel} /> */}
</div> </div>
</div> </div>
) )
} }
export default VmDebugger; export default VmDebugger
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment