added basic functionalities to the debugger mode

This commit is contained in:
cozis
2021-11-02 09:17:03 +00:00
parent 7e04b0fc6d
commit 022610bb71
7 changed files with 267 additions and 22 deletions
+22
View File
@@ -141,6 +141,28 @@ Source *Executable_GetSource(Executable *exe)
return exe->src;
}
int Executable_GetInstrOffset(Executable *exe, int index)
{
if(index < 0 || index >= exe->bodyl)
return -1;
if(exe->src)
return exe->body[index].offset;
else
return -1;
}
int Executable_GetInstrLength(Executable *exe, int index)
{
if(index < 0 || index >= exe->bodyl)
return -1;
if(exe->src)
return exe->body[index].length;
else
return -1;
}
_Bool Executable_Fetch(Executable *exe, int index, Opcode *opcode, Operand *ops, int *opc)
{
assert(index >= 0);
+2
View File
@@ -51,6 +51,8 @@ void Executable_Dump(Executable *exe);
_Bool Executable_Fetch(Executable *exe, int index, Opcode *opcode, Operand *ops, int *opc);
_Bool Executable_SetSource(Executable *exe, Source *src);
Source *Executable_GetSource(Executable *exe);
int Executable_GetInstrOffset(Executable *exe, int index);
int Executable_GetInstrLength(Executable *exe, int index);
ExeBuilder *ExeBuilder_New(BPAlloc *alloc);
_Bool ExeBuilder_Append(ExeBuilder *exeb, Error *error, Opcode opcode, Operand *opv, int opc, int off, int len);