* move stab number reset to dbgstabs

git-svn-id: trunk@1442 -
This commit is contained in:
peter 2005-10-17 15:02:15 +00:00
parent d5af8ed9a0
commit 6e60c8a92b
3 changed files with 48 additions and 15 deletions

View File

@ -36,6 +36,7 @@ interface
private private
writing_def_stabs : boolean; writing_def_stabs : boolean;
global_stab_number : word; global_stab_number : word;
defnumberlist : tlist;
{ tsym writing } { tsym writing }
function sym_var_value(const s:string;arg:pointer):string; function sym_var_value(const s:string;arg:pointer):string;
function sym_stabstr_evaluate(sym:tsym;const s:string;const vars:array of string):Pchar; function sym_stabstr_evaluate(sym:tsym;const s:string;const vars:array of string):Pchar;
@ -263,6 +264,9 @@ implementation
if is_class(def) then if is_class(def) then
inc(global_stab_number); inc(global_stab_number);
def.stab_number:=global_stab_number; def.stab_number:=global_stab_number;
if global_stab_number>=defnumberlist.count then
defnumberlist.count:=global_stab_number+250;
defnumberlist[global_stab_number]:=def;
end; end;
result:=tostr(def.stab_number); result:=tostr(def.stab_number);
end; end;
@ -329,7 +333,7 @@ implementation
tostr(tfieldvarsym(p).fieldoffset*8),tostr(varsize*8)]); tostr(tfieldvarsym(p).fieldoffset*8),tostr(varsize*8)]);
if state^.stabsize+strlen(newrec)>=state^.staballoc-256 then if state^.stabsize+strlen(newrec)>=state^.staballoc-256 then
begin begin
inc(state^.staballoc,memsizeinc); inc(state^.staballoc,strlen(newrec)+64);
reallocmem(state^.stabstring,state^.staballoc); reallocmem(state^.stabstring,state^.staballoc);
end; end;
strcopy(state^.stabstring+state^.stabsize,newrec); strcopy(state^.stabstring+state^.stabsize,newrec);
@ -420,7 +424,7 @@ implementation
inc(state^.stabsize,strlen(newrec)); inc(state^.stabsize,strlen(newrec));
if state^.stabsize>=state^.staballoc-256 then if state^.stabsize>=state^.staballoc-256 then
begin begin
inc(state^.staballoc,memsizeinc); inc(state^.staballoc,strlen(newrec)+64);
reallocmem(state^.stabstring,state^.staballoc); reallocmem(state^.stabstring,state^.staballoc);
end; end;
strcopy(state^.stabstring+olds,newrec); strcopy(state^.stabstring+olds,newrec);
@ -825,7 +829,8 @@ implementation
insertdef(list,u8inttype.def); insertdef(list,u8inttype.def);
insertdef(list,cchartype.def); insertdef(list,cchartype.def);
end; end;
classrefdef, classrefdef :
insertdef(list,pvmttype.def);
pointerdef : pointerdef :
insertdef(list,tpointerdef(def).pointertype.def); insertdef(list,tpointerdef(def).pointertype.def);
setdef : setdef :
@ -1234,7 +1239,12 @@ implementation
begin begin
case sym.consttyp of case sym.consttyp of
conststring: conststring:
st:='s'''+backspace_quote(octal_quote(strpas(pchar(sym.value.valueptr)),[#0..#9,#11,#12,#14..#31,'''']),['"','\',#10,#13])+''''; begin
if sym.value.len<200 then
st:='s'''+backspace_quote(octal_quote(strpas(pchar(sym.value.valueptr)),[#0..#9,#11,#12,#14..#31,'''']),['"','\',#10,#13])+''''
else
st:='<constant string too long>';
end;
constord: constord:
st:='i'+tostr(sym.value.valueord); st:='i'+tostr(sym.value.valueord);
constpointer: constpointer:
@ -1384,11 +1394,13 @@ implementation
stabstypelist : taasmoutput; stabstypelist : taasmoutput;
storefilepos : tfileposinfo; storefilepos : tfileposinfo;
st : tsymtable; st : tsymtable;
i : longint;
begin begin
storefilepos:=aktfilepos; storefilepos:=aktfilepos;
aktfilepos:=current_module.mainfilepos; aktfilepos:=current_module.mainfilepos;
global_stab_number:=0; global_stab_number:=0;
defnumberlist:=tlist.create;
stabsvarlist:=taasmoutput.create; stabsvarlist:=taasmoutput.create;
stabstypelist:=taasmoutput.create; stabstypelist:=taasmoutput.create;
@ -1424,6 +1436,19 @@ implementation
asmlist[al_stabs].concatlist(stabstypelist); asmlist[al_stabs].concatlist(stabstypelist);
asmlist[al_stabs].concatlist(stabsvarlist); asmlist[al_stabs].concatlist(stabsvarlist);
{ reset stab numbers }
for i:=0 to defnumberlist.count-1 do
begin
if assigned(defnumberlist[i]) then
begin
tdef(defnumberlist[i]).stab_number:=0;
tdef(defnumberlist[i]).stab_state:=stab_state_unused;
end;
end;
defnumberlist.free;
defnumberlist:=nil;
stabsvarlist.free; stabsvarlist.free;
stabstypelist.free; stabstypelist.free;
aktfilepos:=storefilepos; aktfilepos:=storefilepos;

View File

@ -65,7 +65,7 @@ interface
{$endif} {$endif}
constructor create; constructor create;
constructor ppuloaddef(ppufile:tcompilerppufile); constructor ppuloaddef(ppufile:tcompilerppufile);
procedure reset; procedure reset;virtual;
function getcopy : tstoreddef;virtual; function getcopy : tstoreddef;virtual;
procedure ppuwritedef(ppufile:tcompilerppufile); procedure ppuwritedef(ppufile:tcompilerppufile);
procedure ppuwrite(ppufile:tcompilerppufile);virtual;abstract; procedure ppuwrite(ppufile:tcompilerppufile);virtual;abstract;
@ -170,6 +170,7 @@ interface
procedure generate_field_rtti(sym : tnamedindexitem;arg:pointer); procedure generate_field_rtti(sym : tnamedindexitem;arg:pointer);
public public
symtable : tsymtable; symtable : tsymtable;
procedure reset;override;
function getsymtable(t:tgetsymtable):tsymtable;override; function getsymtable(t:tgetsymtable):tsymtable;override;
end; end;
@ -513,6 +514,7 @@ interface
procedure buildderefimpl;override; procedure buildderefimpl;override;
procedure deref;override; procedure deref;override;
procedure derefimpl;override; procedure derefimpl;override;
procedure reset;override;
function getsymtable(t:tgetsymtable):tsymtable;override; function getsymtable(t:tgetsymtable):tsymtable;override;
function gettypename : string;override; function gettypename : string;override;
function mangledname : string; function mangledname : string;
@ -892,8 +894,6 @@ implementation
{$endif} {$endif}
if registerdef then if registerdef then
symtablestack.registerdef(self); symtablestack.registerdef(self);
stab_state:=stab_state_unused;
stab_number:=0;
fillchar(localrttilab,sizeof(localrttilab),0); fillchar(localrttilab,sizeof(localrttilab),0);
end; end;
@ -904,8 +904,6 @@ implementation
{$ifdef EXTDEBUG} {$ifdef EXTDEBUG}
fillchar(fileinfo,sizeof(fileinfo),0); fillchar(fileinfo,sizeof(fileinfo),0);
{$endif} {$endif}
stab_state:=stab_state_unused;
stab_number:=0;
fillchar(localrttilab,sizeof(localrttilab),0); fillchar(localrttilab,sizeof(localrttilab),0);
{ load } { load }
indexnr:=ppufile.getword; indexnr:=ppufile.getword;
@ -920,18 +918,12 @@ implementation
procedure Tstoreddef.reset; procedure Tstoreddef.reset;
begin begin
stab_state:=stab_state_unused;
if assigned(rttitablesym) then if assigned(rttitablesym) then
trttisym(rttitablesym).lab := nil; trttisym(rttitablesym).lab := nil;
if assigned(inittablesym) then if assigned(inittablesym) then
trttisym(inittablesym).lab := nil; trttisym(inittablesym).lab := nil;
localrttilab[initrtti]:=nil; localrttilab[initrtti]:=nil;
localrttilab[fullrtti]:=nil; localrttilab[fullrtti]:=nil;
if deftype=procdef then
begin
tprocdef(self).procstarttai:=nil;
tprocdef(self).procendtai:=nil;
end;
end; end;
@ -2644,6 +2636,12 @@ implementation
end; end;
procedure tabstractrecorddef.reset;
begin
tstoredsymtable(symtable).reset_all_defs;
end;
procedure tabstractrecorddef.count_field_rtti(sym : tnamedindexitem;arg:pointer); procedure tabstractrecorddef.count_field_rtti(sym : tnamedindexitem;arg:pointer);
begin begin
if (FRTTIType=fullrtti) or if (FRTTIType=fullrtti) or
@ -3354,6 +3352,14 @@ implementation
end; end;
procedure tprocdef.reset;
begin
inherited reset;
procstarttai:=nil;
procendtai:=nil;
end;
procedure tprocdef.insert_localst; procedure tprocdef.insert_localst;
begin begin
localst:=tlocalsymtable.create(parast.symtablelevel); localst:=tlocalsymtable.create(parast.symtablelevel);

View File

@ -244,6 +244,8 @@ implementation
owner := nil; owner := nil;
typesym := nil; typesym := nil;
defoptions:=[]; defoptions:=[];
stab_state:=stab_state_unused;
stab_number:=0;
end; end;