* Last steps before removal of aasmtai dependency in symsym can be

accomplished.
This commit is contained in:
daniel 2004-01-31 18:40:15 +00:00
parent 1422985ca0
commit 862e121a0a
5 changed files with 152 additions and 163 deletions

View File

@ -1816,6 +1816,8 @@ implementation
storefilepos : tfileposinfo; storefilepos : tfileposinfo;
curconstsegment : taasmoutput; curconstsegment : taasmoutput;
l : longint; l : longint;
stabstr:Pchar;
begin begin
storefilepos:=aktfilepos; storefilepos:=aktfilepos;
aktfilepos:=sym.fileinfo; aktfilepos:=sym.fileinfo;
@ -1830,7 +1832,15 @@ implementation
curconstSegment.concat(Tai_align.create(const_align(l))); curconstSegment.concat(Tai_align.create(const_align(l)));
{$ifdef GDB} {$ifdef GDB}
if cs_debuginfo in aktmoduleswitches then if cs_debuginfo in aktmoduleswitches then
sym.concatstabto(curconstsegment); begin
if not sym.isstabwritten then
begin
stabstr:=sym.stabstring;
if stabstr<>nil then
curconstsegment.concat(Tai_stabs.create(stabstr));
sym.isstabwritten:=true;
end;
end;
{$endif GDB} {$endif GDB}
if (sym.owner.symtabletype=globalsymtable) or if (sym.owner.symtabletype=globalsymtable) or
(cs_create_smart in aktmoduleswitches) or (cs_create_smart in aktmoduleswitches) or
@ -1848,6 +1858,7 @@ implementation
var var
l,varalign : longint; l,varalign : longint;
storefilepos : tfileposinfo; storefilepos : tfileposinfo;
stabstr:Pchar;
begin begin
storefilepos:=aktfilepos; storefilepos:=aktfilepos;
aktfilepos:=sym.fileinfo; aktfilepos:=sym.fileinfo;
@ -1865,7 +1876,15 @@ implementation
bssSegment.concat(Tai_align.create(varalign)); bssSegment.concat(Tai_align.create(varalign));
{$ifdef GDB} {$ifdef GDB}
if cs_debuginfo in aktmoduleswitches then if cs_debuginfo in aktmoduleswitches then
sym.concatstabto(bsssegment); begin
if not sym.isstabwritten then
begin
stabstr:=sym.stabstring;
if stabstr<>nil then
bsssegment.concat(Tai_stabs.create(stabstr));
sym.isstabwritten:=true;
end;
end;
{$endif GDB} {$endif GDB}
if (sym.owner.symtabletype=globalsymtable) or if (sym.owner.symtabletype=globalsymtable) or
(cs_create_smart in aktmoduleswitches) or (cs_create_smart in aktmoduleswitches) or
@ -2098,7 +2117,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.185 2004-01-31 17:45:17 peter Revision 1.186 2004-01-31 18:40:15 daniel
* Last steps before removal of aasmtai dependency in symsym can be
accomplished.
Revision 1.185 2004/01/31 17:45:17 peter
* Change several $ifdef i386 to x86 * Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR * Change several OS_32 to OS_INT/OS_ADDR

View File

@ -59,7 +59,7 @@ implementation
{ pass 1 } { pass 1 }
nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,nobj, nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,nobj,
{ codegen } { codegen }
ncgutil, ncgutil,gdb,
{ parser } { parser }
scanner, scanner,
pbase,pexpr,ptype,ptconst,pdecsub,pdecvar,pdecobj, pbase,pexpr,ptype,ptconst,pdecsub,pdecvar,pdecobj,
@ -283,6 +283,10 @@ implementation
again : boolean; again : boolean;
srsym : tsym; srsym : tsym;
srsymtable : tsymtable; srsymtable : tsymtable;
{$ifdef gdb}
stab_str:Pchar;
{$endif}
begin begin
{ Check only typesyms or record/object fields } { Check only typesyms or record/object fields }
case tsym(p).typ of case tsym(p).typ of
@ -339,8 +343,15 @@ implementation
if (cs_debuginfo in aktmoduleswitches) and assigned(debuglist) and if (cs_debuginfo in aktmoduleswitches) and assigned(debuglist) and
(tsym(p).owner.symtabletype in [globalsymtable,staticsymtable]) then (tsym(p).owner.symtabletype in [globalsymtable,staticsymtable]) then
begin begin
ttypesym(p).isusedinstab := true; ttypesym(p).isusedinstab:=true;
ttypesym(p).concatstabto(debuglist); { ttypesym(p).concatstabto(debuglist);}
if not Ttypesym(p).isstabwritten then
begin
stab_str:=Ttypesym(p).stabstring;
if assigned(stab_str) then
debuglist.concat(Tai_stabs.create(stab_str));
Ttypesym(p).isstabwritten:=true;
end;
end; end;
{$endif GDB} {$endif GDB}
{ we need a class type for classrefdef } { we need a class type for classrefdef }
@ -662,7 +673,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.75 2003-12-15 21:25:48 peter Revision 1.76 2004-01-31 18:40:15 daniel
* Last steps before removal of aasmtai dependency in symsym can be
accomplished.
Revision 1.75 2003/12/15 21:25:48 peter
* reg allocations for imaginary register are now inserted just * reg allocations for imaginary register are now inserted just
before reg allocation before reg allocation
* tregister changed to enum to allow compile time check * tregister changed to enum to allow compile time check

View File

@ -43,26 +43,19 @@ interface
type type
{************************************************ {************************************************
TSym TSym
************************************************} ***********************************************}
{ this object is the base for all symbol objects } { this object is the base for all symbol objects }
tstoredsym = class(tsym) tstoredsym = class(tsym)
protected protected
_mangledname : pstring; _mangledname : pstring;
public public
{$ifdef GDB}
isstabwritten : boolean;
{$endif GDB}
constructor create(const n : string); constructor create(const n : string);
constructor loadsym(ppufile:tcompilerppufile); constructor loadsym(ppufile:tcompilerppufile);
destructor destroy;override; destructor destroy;override;
procedure buildderef;override;
procedure deref;override;
{$ifdef GDB} {$ifdef GDB}
function get_var_value(const s:string):string; function get_var_value(const s:string):string;
function stabstr_evaluate(const s:string;vars:array of string):Pchar; function stabstr_evaluate(const s:string;vars:array of string):Pchar;
function stabstring : pchar;virtual;
procedure concatstabto(asmlist : taasmoutput);
{$endif GDB} {$endif GDB}
function mangledname : string; function mangledname : string;
procedure generate_mangledname;virtual;abstract; procedure generate_mangledname;virtual;abstract;
@ -78,17 +71,15 @@ interface
constructor ppuload(ppufile:tcompilerppufile); constructor ppuload(ppufile:tcompilerppufile);
procedure generate_mangledname;override; procedure generate_mangledname;override;
procedure ppuwrite(ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override;
function stabstring : pchar;override;
end; end;
tunitsym = class(tstoredsym) tunitsym = class(Tsym)
unitsymtable : tsymtable; unitsymtable : tsymtable;
constructor create(const n : string;ref : tsymtable); constructor create(const n : string;ref : tsymtable);
constructor ppuload(ppufile:tcompilerppufile); constructor ppuload(ppufile:tcompilerppufile);
destructor destroy;override; destructor destroy;override;
procedure ppuwrite(ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override;
{$ifdef GDB}
function stabstring:Pchar;override;
{$endif GDB}
end; end;
terrorsym = class(Tsym) terrorsym = class(Tsym)
@ -144,7 +135,7 @@ interface
{$endif GDB} {$endif GDB}
end; end;
ttypesym = class(tstoredsym) ttypesym = class(Tsym)
restype : ttype; restype : ttype;
{$ifdef GDB} {$ifdef GDB}
isusedinstab : boolean; isusedinstab : boolean;
@ -198,7 +189,7 @@ interface
property vartype: ttype read _vartype write setvartype; property vartype: ttype read _vartype write setvartype;
end; end;
tpropertysym = class(tstoredsym) tpropertysym = class(Tsym)
propoptions : tpropertyoptions; propoptions : tpropertyoptions;
propoverriden : tpropertysym; propoverriden : tpropertysym;
propoverridenderef : tderef; propoverridenderef : tderef;
@ -218,12 +209,9 @@ interface
procedure buildderef;override; procedure buildderef;override;
procedure deref;override; procedure deref;override;
procedure dooverride(overriden:tpropertysym); procedure dooverride(overriden:tpropertysym);
{$ifdef GDB}
function stabstring : pchar;override;
{$endif GDB}
end; end;
tabsolutesym = class(tvarsym) tabsolutesym = class(Tvarsym)
abstyp : absolutetyp; abstyp : absolutetyp;
{$ifdef i386} {$ifdef i386}
absseg : boolean; absseg : boolean;
@ -238,9 +226,9 @@ interface
procedure deref;override; procedure deref;override;
function mangledname : string; function mangledname : string;
procedure ppuwrite(ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override;
{$ifdef GDB} {$ifdef gdb}
function stabstring : pchar;override; function stabstring:Pchar;override;
{$endif GDB} {$endif}
end; end;
ttypedconstsym = class(tstoredsym) ttypedconstsym = class(tstoredsym)
@ -280,7 +268,7 @@ interface
constructor create_string(const n : string;t : tconsttyp;str:pchar;l:longint); constructor create_string(const n : string;t : tconsttyp;str:pchar;l:longint);
constructor ppuload(ppufile:tcompilerppufile); constructor ppuload(ppufile:tcompilerppufile);
destructor destroy;override; destructor destroy;override;
function mangledname : string; { function mangledname : string;}
procedure buildderef;override; procedure buildderef;override;
procedure deref;override; procedure deref;override;
procedure ppuwrite(ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override;
@ -289,7 +277,7 @@ interface
{$endif GDB} {$endif GDB}
end; end;
tenumsym = class(tstoredsym) tenumsym = class(Tsym)
value : longint; value : longint;
definition : tenumdef; definition : tenumdef;
definitionderef : tderef; definitionderef : tderef;
@ -300,20 +288,14 @@ interface
procedure buildderef;override; procedure buildderef;override;
procedure deref;override; procedure deref;override;
procedure order; procedure order;
{$ifdef GDB}
function stabstring:Pchar;
{$endif GDB}
end; end;
tsyssym = class(tstoredsym) tsyssym = class(Tsym)
number : longint; number : longint;
constructor create(const n : string;l : longint); constructor create(const n : string;l : longint);
constructor ppuload(ppufile:tcompilerppufile); constructor ppuload(ppufile:tcompilerppufile);
destructor destroy;override; destructor destroy;override;
procedure ppuwrite(ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override;
{$ifdef GDB}
function stabstring:Pchar;
{$endif GDB}
end; end;
{ compiler generated symbol to point to rtti and init/finalize tables } { compiler generated symbol to point to rtti and init/finalize tables }
@ -412,14 +394,14 @@ implementation
{$endif GDB} {$endif GDB}
end; end;
procedure tstoredsym.buildderef; { procedure tstoredsym.buildderef;
begin begin
end; end;
procedure tstoredsym.deref; procedure tstoredsym.deref;
begin begin
end; end;}
destructor tstoredsym.destroy; destructor tstoredsym.destroy;
@ -452,28 +434,10 @@ implementation
function Tstoredsym.get_var_value(const s:string):string; function Tstoredsym.get_var_value(const s:string):string;
begin begin
if s='name' then if s='mangledname' then
get_var_value:=name
else if s='ownername' then
get_var_value:=owner.name^
else if s='mangledname' then
get_var_value:=mangledname get_var_value:=mangledname
else if s='line' then
get_var_value:=tostr(fileinfo.line)
else if s='N_LSYM' then
get_var_value:=tostr(N_LSYM)
else if s='N_LCSYM' then
get_var_value:=tostr(N_LCSYM)
else if s='N_RSYM' then
get_var_value:=tostr(N_RSYM)
else if s='N_TSYM' then
get_var_value:=tostr(N_TSYM)
else if s='N_STSYM' then
get_var_value:=tostr(N_STSYM)
else if s='N_FUNCTION' then
get_var_value:=tostr(N_FUNCTION)
else else
internalerror(200401152); get_var_value:=inherited get_var_value(s);
end; end;
function Tstoredsym.stabstr_evaluate(const s:string;vars:array of string):Pchar; function Tstoredsym.stabstr_evaluate(const s:string;vars:array of string):Pchar;
@ -481,28 +445,10 @@ implementation
begin begin
stabstr_evaluate:=string_evaluate(s,@get_var_value,vars); stabstr_evaluate:=string_evaluate(s,@get_var_value,vars);
end; end;
function tstoredsym.stabstring : pchar;
begin
stabstring:=stabstr_evaluate('"${name}",${N_LSYM},0,${line},0',[]);
end;
procedure tstoredsym.concatstabto(asmlist : taasmoutput);
var
stab_str : pchar;
begin
if not isstabwritten then
begin
stab_str := stabstring;
if assigned(stab_str) then
asmlist.concat(Tai_stabs.create(stab_str));
isstabwritten:=true;
end;
end;
{$endif GDB} {$endif GDB}
function tstoredsym.mangledname : string; function tstoredsym.mangledname : string;
begin begin
if not assigned(_mangledname) then if not assigned(_mangledname) then
begin begin
@ -511,9 +457,9 @@ implementation
internalerror(200204171); internalerror(200204171);
end; end;
{$ifdef compress} {$ifdef compress}
mangledname:=minilzw_decode(_mangledname^) mangledname:=minilzw_decode(_mangledname^);
{$else} {$else}
mangledname:=_mangledname^ mangledname:=_mangledname^;
{$endif} {$endif}
end; end;
@ -575,6 +521,11 @@ implementation
end; end;
end; end;
function Tlabelsym.stabstring : pchar;
begin
stabstring:=stabstr_evaluate('"${name}",${N_LSYM},0,${line},0',[]);
end;
{**************************************************************************** {****************************************************************************
TUNITSYM TUNITSYM
@ -612,14 +563,6 @@ implementation
ppufile.writeentry(ibunitsym); ppufile.writeentry(ibunitsym);
end; end;
{$ifdef GDB}
function Tunitsym.stabstring:Pchar;
begin
stabstring:=nil;
end;
{$endif GDB}
{**************************************************************************** {****************************************************************************
TPROCSYM TPROCSYM
****************************************************************************} ****************************************************************************}
@ -1369,15 +1312,6 @@ implementation
end; end;
{$ifdef GDB}
function tpropertysym.stabstring : pchar;
begin
{ !!!! don't know how to handle }
stabstring:=nil;
end;
{$endif GDB}
{**************************************************************************** {****************************************************************************
TABSOLUTESYM TABSOLUTESYM
****************************************************************************} ****************************************************************************}
@ -2084,12 +2018,6 @@ implementation
end; end;
function tconstsym.mangledname : string;
begin
mangledname:=name;
end;
procedure tconstsym.buildderef; procedure tconstsym.buildderef;
begin begin
if consttyp in [constord,constpointer,constset] then if consttyp in [constord,constpointer,constset] then
@ -2265,15 +2193,6 @@ implementation
end; end;
{$ifdef GDB}
function Tenumsym.stabstring:Pchar;
begin
{enum elements have no stab !}
end;
{$EndIf GDB}
{**************************************************************************** {****************************************************************************
TTYPESYM TTYPESYM
****************************************************************************} ****************************************************************************}
@ -2417,14 +2336,6 @@ implementation
ppufile.writeentry(ibsyssym); ppufile.writeentry(ibsyssym);
end; end;
{$ifdef GDB}
function Tsyssym.stabstring:Pchar;
begin
stabstring:=nil
end;
{$endif GDB}
{**************************************************************************** {****************************************************************************
TRTTISYM TRTTISYM
@ -2555,7 +2466,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.148 2004-01-31 17:45:17 peter Revision 1.149 2004-01-31 18:40:15 daniel
* Last steps before removal of aasmtai dependency in symsym can be
accomplished.
Revision 1.148 2004/01/31 17:45:17 peter
* Change several $ifdef i386 to x86 * Change several $ifdef i386 to x86
* Change several OS_32 to OS_INT/OS_ADDR * Change several OS_32 to OS_INT/OS_ADDR

View File

@ -819,23 +819,44 @@ implementation
{$ifdef GDB} {$ifdef GDB}
procedure TStoredSymtable.concatstab(p : TNamedIndexItem;arg:pointer); procedure TStoredSymtable.concatstab(p : TNamedIndexItem;arg:pointer);
var stabstr:Pchar;
ao:Taasmoutput;
begin begin
if tsym(p).typ <> procsym then if Tsym(p).typ<>procsym then
tstoredsym(p).concatstabto(TAAsmOutput(arg)); begin
ao:=Taasmoutput(arg);
if not Tsym(p).isstabwritten then
begin
stabstr:=Tsym(p).stabstring;
if stabstr<>nil then
ao.concat(Tai_stabs.create(stabstr));
Tsym(p).isstabwritten:=true;
end;
end;
end; end;
procedure TStoredSymtable.resetstab(p : TNamedIndexItem;arg:pointer); procedure TStoredSymtable.resetstab(p : TNamedIndexItem;arg:pointer);
begin begin
if tsym(p).typ <> procsym then if tsym(p).typ <> procsym then
tstoredsym(p).isstabwritten:=false; Tstoredsym(p).isstabwritten:=false;
end; end;
procedure TStoredSymtable.concattypestab(p : TNamedIndexItem;arg:pointer); procedure TStoredSymtable.concattypestab(p : TNamedIndexItem;arg:pointer);
var stabstr:Pchar;
ao:Taasmoutput;
begin begin
if tsym(p).typ = typesym then if Tsym(p).typ=typesym then
begin begin
tstoredsym(p).isstabwritten:=false; ao:=Taasmoutput(arg);
tstoredsym(p).concatstabto(TAAsmOutput(arg)); Tsym(p).isstabwritten:=false;
stabstr:=Tsym(p).stabstring;
if stabstr<>nil then
ao.concat(Tai_stabs.create(stabstr));
Tsym(p).isstabwritten:=true;
end; end;
end; end;
@ -2338,7 +2359,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.131 2004-01-30 14:33:06 florian Revision 1.132 2004-01-31 18:40:15 daniel
* Last steps before removal of aasmtai dependency in symsym can be
accomplished.
Revision 1.131 2004/01/30 14:33:06 florian
* fixed more alignment issues * fixed more alignment issues
Revision 1.130 2004/01/30 13:42:03 florian Revision 1.130 2004/01/30 13:42:03 florian

View File

@ -95,9 +95,6 @@ interface
{ this object is the base for all symbol objects } { this object is the base for all symbol objects }
tsym = class(tsymentry) tsym = class(tsymentry)
protected protected
{$ifdef GDB}
{ isstabwritten : boolean;}
{$endif GDB}
public public
_realname : pstring; _realname : pstring;
fileinfo : tfileposinfo; fileinfo : tfileposinfo;
@ -108,10 +105,10 @@ interface
lastwritten : tref; lastwritten : tref;
refcount : longint; refcount : longint;
{$ifdef GDB} {$ifdef GDB}
{ function get_var_value(const s:string):string; isstabwritten : boolean;
function get_var_value(const s:string):string;
function stabstr_evaluate(const s:string;vars:array of string):Pchar; function stabstr_evaluate(const s:string;vars:array of string):Pchar;
function stabstring : pchar;virtual; function stabstring : pchar;virtual;
procedure concatstabto(asmlist : taasmoutput);virtual;}
{$endif GDB} {$endif GDB}
constructor create(const n : string); constructor create(const n : string);
constructor loadsym(ppufile:tcompilerppufile); constructor loadsym(ppufile:tcompilerppufile);
@ -119,10 +116,10 @@ interface
procedure ppuwrite(ppufile:tcompilerppufile);virtual;abstract; procedure ppuwrite(ppufile:tcompilerppufile);virtual;abstract;
procedure writesym(ppufile:tcompilerppufile); procedure writesym(ppufile:tcompilerppufile);
function realname:string; function realname:string;
procedure buildderef;virtual;abstract; procedure buildderef;virtual;
procedure buildderefimpl;virtual;abstract; { procedure buildderefimpl;virtual;abstract;}
procedure deref;virtual;abstract; procedure deref;virtual;
procedure derefimpl;virtual;abstract; { procedure derefimpl;virtual;abstract;}
function gettypedef:tdef;virtual; function gettypedef:tdef;virtual;
procedure load_references(ppufile:tcompilerppufile;locals:boolean);virtual; procedure load_references(ppufile:tcompilerppufile;locals:boolean);virtual;
function write_references(ppufile:tcompilerppufile;locals:boolean):boolean;virtual; function write_references(ppufile:tcompilerppufile;locals:boolean):boolean;virtual;
@ -228,7 +225,8 @@ implementation
uses uses
verbose, verbose,
fmodule, fmodule,
symdef; symdef,
gdb;
{**************************************************************************** {****************************************************************************
Tdef Tdef
@ -351,7 +349,17 @@ implementation
ppufile.putsmallset(symoptions); ppufile.putsmallset(symoptions);
end; end;
{$ifdef xGDB} procedure Tsym.buildderef;
begin
end;
procedure Tsym.deref;
begin
end;
{$ifdef GDB}
function Tsym.get_var_value(const s:string):string; function Tsym.get_var_value(const s:string):string;
begin begin
@ -359,8 +367,6 @@ implementation
get_var_value:=name get_var_value:=name
else if s='ownername' then else if s='ownername' then
get_var_value:=owner.name^ get_var_value:=owner.name^
else if s='mangledname' then
get_var_value:=mangledname
else if s='line' then else if s='line' then
get_var_value:=tostr(fileinfo.line) get_var_value:=tostr(fileinfo.line)
else if s='N_LSYM' then else if s='N_LSYM' then
@ -388,9 +394,10 @@ implementation
function Tsym.stabstring : pchar; function Tsym.stabstring : pchar;
begin begin
stabstring:=stabstr_evaluate('"${name}",${N_LSYM},0,${line},0',[]); { stabstring:=stabstr_evaluate('"${name}",${N_LSYM},0,${line},0',[]);}
stabstring:=nil;
end; end;
{
procedure Tsym.concatstabto(asmlist : taasmoutput); procedure Tsym.concatstabto(asmlist : taasmoutput);
var var
stab_str : pchar; stab_str : pchar;
@ -402,8 +409,8 @@ implementation
asmList.concat(Tai_stabs.Create(stab_str)); asmList.concat(Tai_stabs.Create(stab_str));
isstabwritten:=true; isstabwritten:=true;
end; end;
end; end;}
{$endif xGDB} {$endif GDB}
function tsym.realname : string; function tsym.realname : string;
@ -1520,7 +1527,11 @@ finalization
end. end.
{ {
$Log$ $Log$
Revision 1.35 2004-01-26 16:12:28 daniel Revision 1.36 2004-01-31 18:40:15 daniel
* Last steps before removal of aasmtai dependency in symsym can be
accomplished.
Revision 1.35 2004/01/26 16:12:28 daniel
* reginfo now also only allocated during register allocation * reginfo now also only allocated during register allocation
* third round of gdb cleanups: kick out most of concatstabto * third round of gdb cleanups: kick out most of concatstabto