Add local variables to .dbj files
This commit is contained in:
parent
85df217c50
commit
373ef6ca85
|
@ -996,6 +996,8 @@ bool Compiler::WriteDbjFile(const char* filename)
|
||||||
{
|
{
|
||||||
InterVariable* v(mInterCodeModule->mGlobalVars[i]);
|
InterVariable* v(mInterCodeModule->mGlobalVars[i]);
|
||||||
if (v->mLinkerObject && v->mIdent && v->mDeclaration)
|
if (v->mLinkerObject && v->mIdent && v->mDeclaration)
|
||||||
|
{
|
||||||
|
if (v->mLinkerObject->mSection->mType != LST_STATIC_STACK && v->mLinkerObject->mFlags & LOBJF_PLACED)
|
||||||
{
|
{
|
||||||
if (!first)
|
if (!first)
|
||||||
fprintf(file, ",\n");
|
fprintf(file, ",\n");
|
||||||
|
@ -1004,6 +1006,7 @@ bool Compiler::WriteDbjFile(const char* filename)
|
||||||
fprintf(file, "\t\t{\"name\": \"%s\", \"start\": %d, \"end\": %d, \"typeid\": %d}", v->mIdent->mString, v->mLinkerObject->mAddress, v->mLinkerObject->mAddress + v->mLinkerObject->mSize, types.IndexOrPush(v->mDeclaration->mBase));
|
fprintf(file, "\t\t{\"name\": \"%s\", \"start\": %d, \"end\": %d, \"typeid\": %d}", v->mIdent->mString, v->mLinkerObject->mAddress, v->mLinkerObject->mAddress + v->mLinkerObject->mSize, types.IndexOrPush(v->mDeclaration->mBase));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fprintf(file, "\t],\n");
|
fprintf(file, "\t],\n");
|
||||||
|
|
||||||
fprintf(file, "\t\"functions\": [\n");
|
fprintf(file, "\t\"functions\": [\n");
|
||||||
|
@ -1037,7 +1040,50 @@ bool Compiler::WriteDbjFile(const char* filename)
|
||||||
lo->mCodeLocations[j].mLocation.mLine);
|
lo->mCodeLocations[j].mLocation.mLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(file, "]}");
|
fprintf(file, "], \n\t\t\t\"variables\":[\n");
|
||||||
|
|
||||||
|
bool vfirst = true;
|
||||||
|
for (int i = 0; i < p->mParamVars.Size(); i++)
|
||||||
|
{
|
||||||
|
InterVariable* v(p->mParamVars[i]);
|
||||||
|
if (v && v->mIdent)
|
||||||
|
{
|
||||||
|
if (v->mLinkerObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!vfirst)
|
||||||
|
fprintf(file, ",\n");
|
||||||
|
vfirst = false;
|
||||||
|
|
||||||
|
fprintf(file, "\t\t\t{\"name\": \"%s\", \"start\": %d, \"end\": %d, \"typeid\": %d}", v->mIdent->mString, i + BC_REG_FPARAMS, i + BC_REG_FPARAMS + v->mSize, types.IndexOrPush(v->mDeclaration->mBase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < p->mLocalVars.Size(); i++)
|
||||||
|
{
|
||||||
|
InterVariable* v(p->mLocalVars[i]);
|
||||||
|
if (v && v->mIdent)
|
||||||
|
{
|
||||||
|
if (v->mLinkerObject)
|
||||||
|
{
|
||||||
|
if (v->mLinkerObject->mFlags & LOBJF_PLACED)
|
||||||
|
{
|
||||||
|
if (!vfirst)
|
||||||
|
fprintf(file, ",\n");
|
||||||
|
vfirst = false;
|
||||||
|
|
||||||
|
fprintf(file, "\t\t{\"name\": \"%s\", \"start\": %d, \"end\": %d, \"typeid\": %d}", v->mIdent->mString, v->mLinkerObject->mAddress, v->mLinkerObject->mAddress + v->mLinkerObject->mSize, types.IndexOrPush(v->mDeclaration->mBase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(file, "]}\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(file, "\t],\n");
|
fprintf(file, "\t],\n");
|
||||||
|
|
|
@ -279,6 +279,7 @@ void InterCodeGenerator::InitParameter(InterCodeProcedure* proc, Declaration* de
|
||||||
{
|
{
|
||||||
proc->mParamVars[index] = new InterVariable();
|
proc->mParamVars[index] = new InterVariable();
|
||||||
proc->mParamVars[index]->mIdent = dec->mIdent;
|
proc->mParamVars[index]->mIdent = dec->mIdent;
|
||||||
|
proc->mParamVars[index]->mDeclaration = dec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,6 +289,7 @@ void InterCodeGenerator::InitLocalVariable(InterCodeProcedure* proc, Declaration
|
||||||
{
|
{
|
||||||
proc->mLocalVars[index] = new InterVariable();
|
proc->mLocalVars[index] = new InterVariable();
|
||||||
proc->mLocalVars[index]->mIdent = dec->mIdent;
|
proc->mLocalVars[index]->mIdent = dec->mIdent;
|
||||||
|
proc->mLocalVars[index]->mDeclaration = dec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static const Ident* StructIdent(const Ident* base, const Ident* item)
|
static const Ident* StructIdent(const Ident* base, const Ident* item)
|
||||||
|
|
Loading…
Reference in New Issue