1
0

ブレークポイントを付けられるようにした

This commit is contained in:
otya128
2016-09-02 22:47:21 +09:00
parent 820009bfb5
commit 0fd1c75b3d
2 changed files with 32 additions and 3 deletions

View File

@@ -6,25 +6,43 @@ import otya.smilebasic.type;
import otya.smilebasic.error;
import otya.smilebasic.systemvariable;
import std.stdio;
struct DebugData
{
SourceLocation location;
bool isBreakPoint;
}
class DebugInfo
{
sizediff_t old;
std.container.Array!SourceLocation location;
std.container.Array!DebugData location;
std.container.Array!int line;
this()
{
}
void addLocation(SourceLocation loc, Code[] code)
{
while (line.length < loc.line)
{
line ~= location.length;
}
for(int i = 0; i < code.length - old; i++)
{
location ~= loc;
location ~= DebugData (loc, false);
}
old = location.length;
}
SourceLocation getLocationByAddress(int addr)
{
if(location.length <= addr) return SourceLocation(0, 0, 0);
return location[addr];
return location[addr].location;
}
void setBreakPoint(int line)
{
location[this.line[line - 1]].isBreakPoint = true;
}
bool isBreakPoint(int line)
{
return location[this.line[line - 1]].isBreakPoint;
}
}
class Scope