You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
64 lines
1.4 KiB
10 years ago
|
//humanReadableExecutionCode => contain human readable code.
|
||
|
//debugStates => contain all debug states.
|
||
|
//bytesCodeMapping => mapping between humanReadableExecutionCode and bytesCode.
|
||
|
//statesList => ListView
|
||
|
|
||
|
var currentSelectedState = null;
|
||
|
function init()
|
||
|
{
|
||
|
currentSelectedState = 0;
|
||
|
select(currentSelectedState);
|
||
|
}
|
||
|
|
||
|
function moveSelection(incr)
|
||
|
{
|
||
|
if (currentSelectedState + incr >= 0)
|
||
|
{
|
||
|
if (currentSelectedState + incr < debugStates.length)
|
||
|
{
|
||
|
select(currentSelectedState + incr);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
endOfDebug();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function select(stateIndex)
|
||
|
{
|
||
|
var state = debugStates[stateIndex];
|
||
|
var codeStr = bytesCodeMapping.getValue(state.curPC);
|
||
|
highlightSelection(codeStr);
|
||
|
currentSelectedState = codeStr;
|
||
|
completeCtxInformation(state);
|
||
|
levelList.model = state.levels;
|
||
|
levelList.update();
|
||
|
}
|
||
|
|
||
|
function highlightSelection(index)
|
||
|
{
|
||
|
console.log(index);
|
||
|
statesList.currentIndex = index;
|
||
|
}
|
||
|
|
||
|
function completeCtxInformation(state)
|
||
|
{
|
||
|
debugStackTxt.text = state.debugStack;
|
||
|
debugStorageTxt.text = state.debugStorage;
|
||
|
debugMemoryTxt.text = state.debugMemory;
|
||
|
debugCallDataTxt.text = state.debugCallData;
|
||
|
headerInfoLabel.text = state.headerInfo
|
||
|
}
|
||
|
|
||
|
function endOfDebug()
|
||
|
{
|
||
|
var state = debugStates[debugStates.length - 1];
|
||
|
debugStorageTxt.text = "";
|
||
|
debugCallDataTxt.text = "";
|
||
|
debugStackTxt.text = "";
|
||
|
debugMemoryTxt.text = state.endOfDebug
|
||
|
var gascost = state.gas - state.gasCost;
|
||
|
headerInfoLabel.text = "EXIT | GAS: " + gascost;
|
||
|
}
|