510 lines
22 KiB
HTML
510 lines
22 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en" class="no-tui-scroll">
|
||
|
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<title>IA64 Debugger</title>
|
||
|
<script src="../dist/tuicss.min.js"></script>
|
||
|
<script src="../dist/capstone-x86.min.js"></script>
|
||
|
<script src="../dist/capstone.min.js"></script>
|
||
|
<script src="../dist/unicorn-x86.min.js"></script>
|
||
|
<script src="../dist/unicorn.min.js"></script>
|
||
|
<script src="../dist/jquery-2.2.0.min.js"></script>
|
||
|
<script src="../dist/download.js"></script>
|
||
|
<link rel="stylesheet" href="../dist/tuicss.min.css">
|
||
|
</head>
|
||
|
|
||
|
<body style="height: 100vh;">
|
||
|
<div class="tui-screen bordered tui-bg-blue-black" style="height: 100vh;">
|
||
|
|
||
|
<!-- Sidenav -->
|
||
|
<nav class="tui-sidenav absolute">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a href="/main.html">Main program <span class="tui-shortcut">F1</span></a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="/assembler.html">Assembler <span class="tui-shortcut">F2</span></a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="/debug.html">Debugger <span class="tui-shortcut">F3</span></a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="/index.html">Reboot <span class="tui-shortcut">F10</span></a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
|
||
|
<!-- Navbar -->
|
||
|
<nav class="tui-nav absolute">
|
||
|
<span class="tui-datetime" data-format="h:m:s a"></span>
|
||
|
<ul>
|
||
|
<li class="tui-sidenav-button red-168-text">≡</li>
|
||
|
<li class="tui-dropdown">
|
||
|
<span class="red-168-text">F</span>ile
|
||
|
<div class="tui-dropdown-content">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a href="/index.html">
|
||
|
<span class="red-168-text">Q</span>uit
|
||
|
<span class="tui-shortcut">F7</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</li>
|
||
|
<li class="tui-dropdown">
|
||
|
<span class="red-168-text">E</span>dit
|
||
|
<div class="tui-dropdown-content">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">F</span>ind
|
||
|
<span class="tui-shortcut">Ctrl+F3</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">G</span>oto
|
||
|
<span class="tui-shortcut">Ctrl+G</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</li>
|
||
|
<li class="tui-dropdown">
|
||
|
<span class="red-168-text">D</span>ebug
|
||
|
<div class="tui-dropdown-content">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">T</span>race
|
||
|
<span class="tui-shortcut">F5</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">S</span>tep into
|
||
|
<span class="tui-shortcut">F6</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
step <span class="red-168-text">O</span>ver
|
||
|
<span class="tui-shortcut">F7</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
<div class="tui-black-divider"></div>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
E<span class="red-168-text">x</span>ec
|
||
|
<span class="tui-shortcut">F8</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
Exec <span class="red-168-text">U</span>ntil...
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">E</span>nd
|
||
|
<span class="tui-shortcut">F9</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</li>
|
||
|
<li class="tui-dropdown">
|
||
|
<span class="red-168-text">O</span>ptions
|
||
|
<div class="tui-dropdown-content">
|
||
|
<ul>
|
||
|
<li class="tui-dropdown block">
|
||
|
<span class="right">►</span>
|
||
|
<span class="red-168-text">S</span>yntax
|
||
|
<div tomodify="code" toadd="Syntax:" class="tui-dropdown-content">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="nasm">√</span> <span class="red-168-text">N</span>asm
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="intel"> </span> <span class="red-168-text">I</span>ntel
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="masm"> </span> <span class="red-168-text">M</span>asm
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="gas"> </span> <span class="red-168-text">G</span>as
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="att"> </span> <span class="red-168-text">A</span>T&T
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="tui-dropdown block">
|
||
|
<span class="right">►</span>
|
||
|
<span class="red-168-text">M</span>emory1
|
||
|
<div tomodify="mem1" toadd="Zone:" class="tui-dropdown-content">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="ds00">√</span> DS:0x0
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="dssi"> </span> DS:SI
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="es00"> </span> ES:0x0
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="esdi"> </span> ES:DI
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="csip"> </span> CS:IP
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="sssp"> </span> SS:SP
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="ssbp"> </span> SS:BP
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="ssff"> </span> SS:0xFFFF
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="tui-dropdown block">
|
||
|
<span class="right">►</span>
|
||
|
<span class="red-168-text">M</span>emory2
|
||
|
<div class="tui-dropdown-content">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="ds00">√</span> DS:0x0
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="dssi"> </span> DS:SI
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="es00"> </span> ES:0x0
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="esdi"> </span> ES:DI
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="csip"> </span> CS:IP
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="sssp"> </span> SS:SP
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="ssbp"> </span> SS:BP
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a onclick="javascript:check(this.parentElement.parentElement.parentElement,this.children[0])">
|
||
|
<span id="ssff"> </span> SS:0xFFFF
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</li>
|
||
|
</li>
|
||
|
<li class="tui-dropdown">
|
||
|
<span class="red-168-text">V</span>iew
|
||
|
<div class="tui-dropdown-content">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">N</span>ormal
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">G</span>oals
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">M</span>emory
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">T</span>utorial
|
||
|
</a>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">S</span>creen
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li class="tui-dropdown">
|
||
|
<span class="red-168-text">H</span>elp
|
||
|
<div class="tui-dropdown-content">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<a href="javascript:showmodal()">
|
||
|
<span class="red-168-text">I</span>nterface
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
|
||
|
<div id="modal" class="tui-window red-168 left-align" style="left: 40%; margin: 0px auto; top: 50%; z-index: 10; position: fixed; visibility:hidden">
|
||
|
<fieldset class="tui-fieldset">
|
||
|
<legend class="red-255 yellow-255-text">Alert</legend>
|
||
|
Function not implemented<br><br>
|
||
|
<div class="tui-divider"></div><br>
|
||
|
<button class="tui-button cyan-168 white-255-text tui-modal-close-button right" data-modal="modal" onclick="javascript:closemodal()">close</button>
|
||
|
</fieldset>
|
||
|
</div>
|
||
|
|
||
|
<!-- Edit panel -->
|
||
|
<div id="code" class="tui-window full-width tui-no-shadow" style="margin-top: 23px;height:60%">
|
||
|
<fieldset class="tui-fieldset" style="height:100%">
|
||
|
<legend id="filename" class="tui-filed-text" style="margin-left:30px"></legend>
|
||
|
<span class="tui-fieldset-button"><span class="green-255-text">↑</span></span>
|
||
|
<span class="tui-fieldset-button left"><span class="green-255-text">■</span></span>
|
||
|
<span class="tui-fieldset-text right" style="margin-bottom: -5px;"> Syntax:Nasm </span>
|
||
|
<textarea id="editor" class="tui-textarea full-width" style="overflow: scroll;height:100%;width:100%"></textarea></div>
|
||
|
|
||
|
<div class="tui-window tui-no-shadow" style="height:20%;width:940px">
|
||
|
<fieldset class="tui-fieldset" style="height:100%">
|
||
|
<legend class="center">Results</legend>
|
||
|
<div class="" style="overflow: scroll;height:100%;width:100%"><pre id="result" style="margin-top: -5px;"></pre></div>
|
||
|
</fieldset>
|
||
|
</div>
|
||
|
|
||
|
<div id="mem1" class="tui-window tui-no-shadow" style="height:20%;width:520px">
|
||
|
<fieldset class="tui-fieldset" style="height:100%">
|
||
|
<span class="tui-fieldset-text right" style="margin-bottom: -5px;"> CS:IP </span>
|
||
|
<legend class="center">Memory explorer 1</legend>
|
||
|
<div class="" style="overflow: scroll;height:100%;width:100%"></div>
|
||
|
</fieldset>
|
||
|
</div>
|
||
|
|
||
|
<div class="tui-window full-width tui-no-shadow" style="height:14%">
|
||
|
<fieldset class="tui-fieldset" style="height:100%">
|
||
|
<legend class="center">Status</legend>
|
||
|
<div id="status" class="full-width" style="overflow: scroll;height:100%"></div>
|
||
|
</fieldset>
|
||
|
</div>
|
||
|
|
||
|
<!-- Status bar -->
|
||
|
<div class="tui-statusbar relative">
|
||
|
<ul>
|
||
|
<li><a href="#!"><span class="red-168-text">F1</span> Help</a></li>
|
||
|
<li><a href="javascript:exportfile()"><span class="red-168-text">F2</span> Save</a></li>
|
||
|
<li><a href="javascript:importfile()"><span class="red-168-text">F3</span> Open</a></li>
|
||
|
<li><a href="javascript:make()"><span class="red-168-text">F8</span> Assemble</a></li>
|
||
|
<li><a href="javascript:make()"><span class="red-168-text">F9</span> Debug</a></li>
|
||
|
<span class="tui-statusbar-divider"></span>
|
||
|
<li><a href="/index.html"><span class="red-168-text">F10</span> Reboot</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
<script>
|
||
|
|
||
|
function closemodal()
|
||
|
{
|
||
|
$("#modal").css("visibility","hidden");
|
||
|
}
|
||
|
|
||
|
function showmodal()
|
||
|
{
|
||
|
$("#modal").css("visibility","visible");
|
||
|
}
|
||
|
|
||
|
function setFilename(name){
|
||
|
$("#filename").html(name);
|
||
|
filename=name;
|
||
|
}
|
||
|
|
||
|
function check(parent,child)
|
||
|
{
|
||
|
$(parent).find("span:not(.red-168-text)").html(" ");
|
||
|
$(parent).find("span:not(.red-168-text)").each(function() {
|
||
|
if (this.id==child.id)
|
||
|
{
|
||
|
$(this).html("√");
|
||
|
modify=$(parent).attr("tomodify");
|
||
|
if (modify!==undefined)
|
||
|
{
|
||
|
add=$(parent).attr("toadd");
|
||
|
if (add===undefined)
|
||
|
add="";
|
||
|
text=" "+add+$(child).parent().text().replace(/[^a-z0-9:]/gi,'')+" ";
|
||
|
$("#"+modify).find("span.tui-fieldset-text").html(text);
|
||
|
variable=add.toLowerCase().replace(/[^a-z0-9]/gi,'');
|
||
|
eval(variable+"='"+child.id+"';");
|
||
|
afunction=add.toLowerCase().replace(/[^a-z0-9]/gi,'');
|
||
|
eval("if (typeof "+afunction+"_callback === 'function') { "+afunction+"_callback() }");
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function hexQword(value) {
|
||
|
value = value < 0 ? (value + 0x10000000000000000) : (value);
|
||
|
var str = '0000000000000000' + value.toString(16).toUpperCase();
|
||
|
return str.slice(-16);
|
||
|
};
|
||
|
|
||
|
function hexDword(value) {
|
||
|
value = value < 0 ? (value + 0x100000000) : (value);
|
||
|
var str = '00000000' + value.toString(16).toUpperCase();
|
||
|
return str.slice(-8);
|
||
|
};
|
||
|
|
||
|
function hexWord(value) {
|
||
|
value = value < 0 ? (value + 0x10000) : (value);
|
||
|
var str = '0000' + value.toString(16).toUpperCase();
|
||
|
return str.slice(-4);
|
||
|
};
|
||
|
|
||
|
function hexByte(value) {
|
||
|
value = value < 0 ? (value + 0x100) : (value);
|
||
|
var str = '00' + value.toString(16).toUpperCase();
|
||
|
return str.slice(-2);
|
||
|
};
|
||
|
|
||
|
function makebin(allzones)
|
||
|
{
|
||
|
var output = [];
|
||
|
for (const zone of allzones)
|
||
|
output.push(...zone.asm);
|
||
|
return new Uint8Array(output);
|
||
|
}
|
||
|
|
||
|
function dump(zone) {
|
||
|
var mcLen = zone.asm.length;
|
||
|
if (type=="binary")
|
||
|
var output = '<tr>';
|
||
|
else
|
||
|
var output = '';
|
||
|
switch (type) {
|
||
|
case 'binary':
|
||
|
var address=zone.offset;
|
||
|
for (var offset = 0; offset < mcLen; offset += 16) {
|
||
|
output += "<td>"+toHex(address,zone.code)+"</td><td>";
|
||
|
var ascii='';
|
||
|
for (var i = offset; i < offset + 16 && i < mcLen; i++) {
|
||
|
if (zone.asm[i]>31)
|
||
|
ascii += String.fromCharCode(zone.asm[i]);
|
||
|
else
|
||
|
ascii += '.';
|
||
|
output += hexByte(zone.asm[i]) + " ";
|
||
|
}
|
||
|
output += "</td><td>"+ascii+"</td></tr>";
|
||
|
address+=16;
|
||
|
}
|
||
|
break;
|
||
|
case 'array':
|
||
|
output += "const uint8_t "+zone.title+"[] = {\n";
|
||
|
for (var offset = 0; offset < mcLen; offset += 8) {
|
||
|
output += " ";
|
||
|
for (var i = offset; i < offset + 8 && i < mcLen; i++) {
|
||
|
output += "0x" + hexByte(zone.asm[i]) + ", ";
|
||
|
}
|
||
|
output = output.substring(0, output.length - 1);
|
||
|
output += "\n";
|
||
|
}
|
||
|
output = output.substring(0, output.length - 2);
|
||
|
output += "\n};\n";
|
||
|
break;
|
||
|
case 'string':
|
||
|
output += "const char* "+zone.title+" =\n";
|
||
|
for (var offset = 0; offset < mcLen; offset += 16) {
|
||
|
output += " \"";
|
||
|
for (var i = offset; i < offset + 16 && i < mcLen; i++) {
|
||
|
output += "\\x" + hexByte(zone.asm[i]);
|
||
|
}
|
||
|
output += "\"\n";
|
||
|
}
|
||
|
output = output.substring(0, output.length - 1);
|
||
|
output += ";\n";
|
||
|
break;
|
||
|
}
|
||
|
return output;
|
||
|
}
|
||
|
|
||
|
function showzones(zones)
|
||
|
{
|
||
|
table='<table class="tui-table striped-purple"><thead><tr><th>Id</th><th>Title</th><th>Offset</th><th>Size</th><th>Type</th><th>Compiled</th></tr></thead>';
|
||
|
for (const zone of zones)
|
||
|
table+="<tr><td align='right'>"+zone.id+"</td><td align='left'>"+zone.title+"</td><td align='right'>"+zone.realoffset+"</td><td align='right'>"+zone.asm.length+"</td><td align='right'>"+zone.code+"</td><td align='right'>"+(zone.asm.length>0)+"</td></tr>";
|
||
|
table+="</table>"
|
||
|
$("#result2").html(table);
|
||
|
}
|
||
|
|
||
|
function showstatus(text)
|
||
|
{
|
||
|
$("#status").html($("#status").html()+text+"<br>");
|
||
|
$("#status").scrollTop($("#status")[0].scrollHeight);
|
||
|
}
|
||
|
|
||
|
function showresult(text)
|
||
|
{
|
||
|
$("#result").html(text);
|
||
|
}
|
||
|
|
||
|
function toHex(hexa,code)
|
||
|
{
|
||
|
if (code==16)
|
||
|
result=hexWord(hexa);
|
||
|
else if (code==32)
|
||
|
result=hexDword(hexa);
|
||
|
else
|
||
|
result=hexQword(hexa);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
</html>
|