|
|
@ -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, ready }) => { |
|
|
|
export const VmDebuggerHead = ({ vmDebuggerHead: { registerEvent } }) => { |
|
|
|
const [asm, setAsm] = useState({ |
|
|
|
const [asm, setAsm] = useState({ |
|
|
|
code: null, |
|
|
|
code: null, |
|
|
|
address: null, |
|
|
|
address: null, |
|
|
@ -30,101 +30,97 @@ export const VmDebuggerHead = ({ vmDebuggerLogic, ready }) => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
console.log('vmDebuggerLogicHead: ', vmDebuggerLogic) |
|
|
|
registerEvent && registerEvent('codeManagerChanged', (code, address, index) => { |
|
|
|
if (vmDebuggerLogic) { |
|
|
|
setAsm(() => { |
|
|
|
vmDebuggerLogic.event.register('codeManagerChanged', (code, address, index) => { |
|
|
|
return { code, address, index } |
|
|
|
setAsm(() => { |
|
|
|
|
|
|
|
return { code, address, index } |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('traceUnloaded', () => { |
|
|
|
}) |
|
|
|
setAsm(() => { |
|
|
|
registerEvent && registerEvent('traceUnloaded', () => { |
|
|
|
return { code: [], address: '', index: -1 } |
|
|
|
setAsm(() => { |
|
|
|
}) |
|
|
|
return { code: [], address: '', index: -1 } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('functionsStackUpdate', (stack) => { |
|
|
|
}) |
|
|
|
if (stack === null || stack.length === 0) return |
|
|
|
registerEvent && registerEvent('functionsStackUpdate', (stack) => { |
|
|
|
const functions = [] |
|
|
|
if (stack === null || stack.length === 0) return |
|
|
|
|
|
|
|
const functions = [] |
|
|
|
for (const func of stack) { |
|
|
|
|
|
|
|
functions.push(func.functionDefinition.name + '(' + func.inputs.join(', ') + ')') |
|
|
|
for (const func of stack) { |
|
|
|
} |
|
|
|
functions.push(func.functionDefinition.name + '(' + func.inputs.join(', ') + ')') |
|
|
|
setFunctionPanel(() => functions) |
|
|
|
} |
|
|
|
|
|
|
|
setFunctionPanel(() => functions) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
registerEvent && registerEvent('traceUnloaded', () => { |
|
|
|
|
|
|
|
setStepDetail(() => { |
|
|
|
|
|
|
|
return { 'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-' } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('traceUnloaded', () => { |
|
|
|
}) |
|
|
|
setStepDetail(() => { |
|
|
|
registerEvent && registerEvent('newTraceLoaded', () => { |
|
|
|
return { 'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-' } |
|
|
|
setStepDetail(() => { |
|
|
|
}) |
|
|
|
return { 'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-' } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('newTraceLoaded', () => { |
|
|
|
}) |
|
|
|
setStepDetail(() => { |
|
|
|
registerEvent && registerEvent('traceCurrentStepUpdate', (error, step) => { |
|
|
|
return { 'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-' } |
|
|
|
setStepDetail(prevState => { |
|
|
|
}) |
|
|
|
return { ...prevState, 'execution step': (error ? '-' : step) } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('traceCurrentStepUpdate', (error, step) => { |
|
|
|
}) |
|
|
|
setStepDetail(prevState => { |
|
|
|
registerEvent && registerEvent('traceMemExpandUpdate', (error, addmem) => { |
|
|
|
return { ...prevState, 'execution step': (error ? '-' : step) } |
|
|
|
setStepDetail(prevState => { |
|
|
|
}) |
|
|
|
return { ...prevState, 'add memory': (error ? '-' : addmem) } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('traceMemExpandUpdate', (error, addmem) => { |
|
|
|
}) |
|
|
|
setStepDetail(prevState => { |
|
|
|
registerEvent && registerEvent('traceStepCostUpdate', (error, gas) => { |
|
|
|
return { ...prevState, 'add memory': (error ? '-' : addmem) } |
|
|
|
setStepDetail(prevState => { |
|
|
|
}) |
|
|
|
return { ...prevState, 'gas': (error ? '-' : gas) } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('traceStepCostUpdate', (error, gas) => { |
|
|
|
}) |
|
|
|
setStepDetail(prevState => { |
|
|
|
registerEvent && registerEvent('traceCurrentCalledAddressAtUpdate', (error, address) => { |
|
|
|
return { ...prevState, 'gas': (error ? '-' : gas) } |
|
|
|
setStepDetail(prevState => { |
|
|
|
}) |
|
|
|
return { ...prevState, 'loaded address': (error ? '-' : address) } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('traceCurrentCalledAddressAtUpdate', (error, address) => { |
|
|
|
}) |
|
|
|
setStepDetail(prevState => { |
|
|
|
registerEvent && registerEvent('traceRemainingGasUpdate', (error, remainingGas) => { |
|
|
|
return { ...prevState, 'loaded address': (error ? '-' : address) } |
|
|
|
setStepDetail(prevState => { |
|
|
|
}) |
|
|
|
return { ...prevState, 'remaining gas': (error ? '-' : remainingGas) } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('traceRemainingGasUpdate', (error, remainingGas) => { |
|
|
|
}) |
|
|
|
setStepDetail(prevState => { |
|
|
|
registerEvent && registerEvent('indexUpdate', (index) => { |
|
|
|
return { ...prevState, 'remaining gas': (error ? '-' : remainingGas) } |
|
|
|
setStepDetail(prevState => { |
|
|
|
}) |
|
|
|
return { ...prevState, 'vm trace step': index } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('indexUpdate', (index) => { |
|
|
|
}) |
|
|
|
setStepDetail(prevState => { |
|
|
|
registerEvent && registerEvent('solidityState', (calldata) => { |
|
|
|
return { ...prevState, 'vm trace step': index } |
|
|
|
setSolidityState(() => { |
|
|
|
}) |
|
|
|
return { ...solidityState, calldata } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('solidityState', (calldata) => { |
|
|
|
}) |
|
|
|
setSolidityState(() => { |
|
|
|
registerEvent && registerEvent('solidityStateMessage', (message) => { |
|
|
|
return { ...solidityState, calldata } |
|
|
|
setSolidityState(() => { |
|
|
|
}) |
|
|
|
return { ...solidityState, message } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('solidityStateMessage', (message) => { |
|
|
|
}) |
|
|
|
setSolidityState(() => { |
|
|
|
registerEvent && registerEvent('solidityLocals', (calldata) => { |
|
|
|
return { ...solidityState, message } |
|
|
|
setSolidityLocals(() => { |
|
|
|
}) |
|
|
|
return { ...solidityLocals, calldata } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('solidityLocals', (calldata) => { |
|
|
|
}) |
|
|
|
setSolidityLocals(() => { |
|
|
|
registerEvent && registerEvent('solidityLocalsMessage', (message) => { |
|
|
|
return { ...solidityLocals, calldata } |
|
|
|
setSolidityLocals(() => { |
|
|
|
}) |
|
|
|
return { ...solidityLocals, message } |
|
|
|
}) |
|
|
|
}) |
|
|
|
vmDebuggerLogic.event.register('solidityLocalsMessage', (message) => { |
|
|
|
}) |
|
|
|
setSolidityLocals(() => { |
|
|
|
}, [registerEvent]) |
|
|
|
return { ...solidityLocals, message } |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
ready() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, [vmDebuggerLogic]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div id="vmheadView" className="mt-1 px-0"> |
|
|
|
<div id="vmheadView" className="mt-1 px-0"> |
|
|
|
<div className="d-flex flex-column"> |
|
|
|
<div className="d-flex flex-column"> |
|
|
|
<div className="w-100"> |
|
|
|
<div className="w-100"> |
|
|
|
<FunctionPanel calldata={functionPanel} /> |
|
|
|
<FunctionPanel data={functionPanel} /> |
|
|
|
<SolidityLocals calldata={solidityLocals.calldata} message={solidityLocals.message} /> |
|
|
|
{/* <SolidityLocals calldata={solidityLocals.calldata} message={solidityLocals.message} /> |
|
|
|
<SolidityState calldata={solidityState.calldata} message={solidityState.message} /> |
|
|
|
<SolidityState calldata={solidityState.calldata} message={solidityState.message} /> */} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="w-100"><CodeListView asm={asm} /></div> |
|
|
|
{/* <div className="w-100"><CodeListView asm={asm} /></div> |
|
|
|
<div className="w-100"><StepDetail stepDetail={stepDetail} /></div> |
|
|
|
<div className="w-100"><StepDetail stepDetail={stepDetail} /></div> */} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
) |
|
|
|