Merge pull request #14 from ksherlock/var_debugger

debugger symbol tables for formal ("var") parameters
This commit is contained in:
MikeW50 2018-03-27 09:02:35 -06:00 committed by GitHub
commit a4cd0f2ea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -835,6 +835,7 @@ var
var var
disp: integer; {disp to symbol of same type} disp: integer; {disp to symbol of same type}
idtype: stp;
procedure WriteAddress (sym: ctp); procedure WriteAddress (sym: ctp);
@ -1087,31 +1088,40 @@ var
if sym^.llink <> nil then if sym^.llink <> nil then
GenSymbol(sym^.llink, false); GenSymbol(sym^.llink, false);
if sym^.klass in [varsm,field] then if sym^.klass in [varsm,field] then begin
if sym^.idtype <> nil then idtype := sym^.idtype;
if sym^.idtype^.form in if idtype <> nil then
if idtype^.form in
[scalar,subrange,pointerStruct,arrays,records,objects] then begin [scalar,subrange,pointerStruct,arrays,records,objects] then begin
symLength := symLength+12; {update length of symbol table} symLength := symLength+12; {update length of symbol table}
WriteName(sym); {write the name field} WriteName(sym); {write the name field}
WriteAddress(sym); {write the address field} WriteAddress(sym); {write the address field}
case sym^.idtype^.form of
scalar: WriteScalarType(sym^.idtype, 0, 0); if (sym^.klass = varsm) and (sym^.vkind = formal) then begin
subrange: WriteScalarType(sym^.idtype^.rangetype, 0, 0); { add an extra pointer to var parameters. }
new(idtype);
idtype^.form := pointerStruct;
idtype^.eltype := sym^.idtype;
end;
case idtype^.form of
scalar: WriteScalarType(idtype, 0, 0);
subrange: WriteScalarType(idtype^.rangetype, 0, 0);
pointerStruct: begin pointerStruct: begin
WritePointerType(sym^.idtype, 0); WritePointerType(idtype, 0);
ExpandPointerType(sym^.idtype); ExpandPointerType(idtype);
end; end;
arrays: WriteArrays(sym^.idtype); arrays: WriteArrays(idtype);
records, records,
objects: begin objects: begin
disp := GetTypeDisp(sym^.idtype); disp := GetTypeDisp(idtype);
if disp = noDisp then begin if disp = noDisp then begin
if sym^.idtype^.form = records then if idtype^.form = records then
CnOut(12) CnOut(12)
else else
CnOut(14); CnOut(14);
CnOut2(0); CnOut2(0);
ExpandRecordType(sym^.idtype); ExpandRecordType(idtype);
end {if} end {if}
else begin else begin
CnOut(13); CnOut(13);
@ -1119,7 +1129,9 @@ var
end; {else} end; {else}
end; end;
end; {case} end; {case}
if idtype <> sym^.idtype then dispose(idtype);
end; {if} end; {if}
end; {if}
if sym^.rlink <> nil then if sym^.rlink <> nil then
GenSymbol(sym^.rlink, maybeLast); GenSymbol(sym^.rlink, maybeLast);