* fixed ttypesym bug finally

* fileinfo in the symtable and better using for unused vars
This commit is contained in:
peter 1998-07-09 23:59:59 +00:00
parent 552737ab67
commit 5e5e2fd78d
5 changed files with 92 additions and 26 deletions

View File

@ -207,11 +207,17 @@ unit pbase;
begin begin
s:=sc^.get_with_tokeninfo(filepos); while not sc^.empty do
while s<>'' do
begin begin
s:=sc^.get_with_tokeninfo(filepos);
ss:=new(pvarsym,init(s,def)); ss:=new(pvarsym,init(s,def));
{$ifdef NEWINPUT}
ss^.fileinfo:=filepos;
{$else}
ss^.line_no:=filepos.line; ss^.line_no:=filepos.line;
{$endif}
st^.insert(ss); st^.insert(ss);
{ static data fields are inserted in the globalsymtable } { static data fields are inserted in the globalsymtable }
if (st^.symtabletype=objectsymtable) and if (st^.symtabletype=objectsymtable) and
@ -220,7 +226,6 @@ unit pbase;
s:=lower(st^.name^)+'_'+s; s:=lower(st^.name^)+'_'+s;
st^.defowner^.owner^.insert(new(pvarsym,init(s,def))); st^.defowner^.owner^.insert(new(pvarsym,init(s,def)));
end; end;
s:=sc^.get_with_tokeninfo(filepos);
end; end;
dispose(sc,done); dispose(sc,done);
end; end;
@ -229,7 +234,11 @@ end.
{ {
$Log$ $Log$
Revision 1.11 1998-07-07 11:20:02 peter Revision 1.12 1998-07-09 23:59:59 peter
* fixed ttypesym bug finally
* fileinfo in the symtable and better using for unused vars
Revision 1.11 1998/07/07 11:20:02 peter
+ NEWINPUT for a better inputfile and scanner object + NEWINPUT for a better inputfile and scanner object
Revision 1.10 1998/06/05 14:37:31 pierre Revision 1.10 1998/06/05 14:37:31 pierre

View File

@ -188,7 +188,8 @@ unit pdecl;
symdone : boolean; symdone : boolean;
{ to handle absolute } { to handle absolute }
abssym : pabsolutesym; abssym : pabsolutesym;
{$ifdef i386} {$ifdef i386}
l : longint; l : longint;
code : word; code : word;
{$endif i386} {$endif i386}
@ -196,7 +197,7 @@ unit pdecl;
Csym : pvarsym; Csym : pvarsym;
is_cdecl,extern_Csym,export_Csym : boolean; is_cdecl,extern_Csym,export_Csym : boolean;
C_name : string; C_name : string;
{ case } { case }
p,casedef : pdef; p,casedef : pdef;
{ maxsize contains the max. size of a variant } { maxsize contains the max. size of a variant }
{ startvarrec contains the start of the variant part of a record } { startvarrec contains the start of the variant part of a record }
@ -240,7 +241,13 @@ unit pdecl;
abssym^.typ:=absolutesym; abssym^.typ:=absolutesym;
abssym^.abstyp:=tovar; abssym^.abstyp:=tovar;
abssym^.ref:=srsym; abssym^.ref:=srsym;
{$ifdef NEWINPUT}
abssym^.fileinfo:=filepos;
{$else}
abssym^.line_no:=filepos.line; abssym^.line_no:=filepos.line;
{$endif}
symtablestack^.insert(abssym); symtablestack^.insert(abssym);
end end
else else
@ -252,7 +259,13 @@ unit pdecl;
abssym^.typ:=absolutesym; abssym^.typ:=absolutesym;
abssym^.abstyp:=toasm; abssym^.abstyp:=toasm;
abssym^.asmname:=stringdup(s); abssym^.asmname:=stringdup(s);
{$ifdef NEWINPUT}
abssym^.fileinfo:=filepos;
{$else}
abssym^.line_no:=filepos.line; abssym^.line_no:=filepos.line;
{$endif}
symtablestack^.insert(abssym); symtablestack^.insert(abssym);
end end
else else
@ -266,7 +279,13 @@ unit pdecl;
abssym^.typ:=absolutesym; abssym^.typ:=absolutesym;
abssym^.abstyp:=toaddr; abssym^.abstyp:=toaddr;
abssym^.absseg:=false; abssym^.absseg:=false;
{$ifdef NEWINPUT}
abssym^.fileinfo:=filepos;
{$else}
abssym^.line_no:=filepos.line; abssym^.line_no:=filepos.line;
{$endif}
s:=pattern; s:=pattern;
consume(INTCONST); consume(INTCONST);
val(s,abssym^.address,code); val(s,abssym^.address,code);
@ -1754,7 +1773,10 @@ unit pdecl;
else else
begin begin
newtype:=new(ptypesym,init(typename,read_type(typename))); newtype:=new(ptypesym,init(typename,read_type(typename)));
symtablestack^.insert(newtype); { load newtype with the new pointer to the inserted type
because it can be an already defined forwarded type !! }
newtype:=ptypesym(symtablestack^.insert(newtype));
end; end;
end; end;
consume(SEMICOLON); consume(SEMICOLON);
@ -1860,7 +1882,11 @@ unit pdecl;
end. end.
{ {
$Log$ $Log$
Revision 1.29 1998-06-25 14:04:21 peter Revision 1.30 1998-07-10 00:00:00 peter
* fixed ttypesym bug finally
* fileinfo in the symtable and better using for unused vars
Revision 1.29 1998/06/25 14:04:21 peter
+ internal inc/dec + internal inc/dec
Revision 1.28 1998/06/24 12:26:45 peter Revision 1.28 1998/06/24 12:26:45 peter

View File

@ -33,10 +33,10 @@ unit scanner;
const const
{$ifdef TP} {$ifdef TP}
maxmacrolen=1024; maxmacrolen=1024;
InputFileBufSize=75; InputFileBufSize=1024;
{$else} {$else}
maxmacrolen=16*1024; maxmacrolen=16*1024;
InputFileBufSize=1024; InputFileBufSize=32*1024;
{$endif} {$endif}
id_len = 14; id_len = 14;
@ -1753,8 +1753,12 @@ exit_label:
end. end.
{ {
$Log$ $Log$
Revision 1.31 1998-07-07 17:39:38 peter Revision 1.32 1998-07-10 00:00:02 peter
* fixed {$I } with following eof * fixed ttypesym bug finally
* fileinfo in the symtable and better using for unused vars
Revision 1.31 1998/07/07 17:39:38 peter
* fixed $I with following eof
Revision 1.30 1998/07/07 12:32:55 peter Revision 1.30 1998/07/07 12:32:55 peter
* status.currentsource is now calculated in verbose (more accurated) * status.currentsource is now calculated in verbose (more accurated)

View File

@ -204,7 +204,13 @@
if assigned(sym) then if assigned(sym) then
begin begin
name := sym^.name; name := sym^.name;
{$ifdef NEWINPUT}
sym_line_no:=sym^.fileinfo.line;
{$else}
sym_line_no:=sym^.line_no; sym_line_no:=sym^.line_no;
{$endif}
end end
else else
begin begin
@ -1045,7 +1051,13 @@
if assigned(sym) then if assigned(sym) then
begin begin
st := sym^.name; st := sym^.name;
{$ifdef NEWINPUT}
sym_line_no:=sym^.fileinfo.line;
{$else}
sym_line_no:=sym^.line_no; sym_line_no:=sym^.line_no;
{$endif}
end end
else else
begin begin
@ -2646,7 +2658,11 @@
{ {
$Log$ $Log$
Revision 1.16 1998-07-07 11:20:13 peter Revision 1.17 1998-07-10 00:00:03 peter
* fixed ttypesym bug finally
* fileinfo in the symtable and better using for unused vars
Revision 1.16 1998/07/07 11:20:13 peter
+ NEWINPUT for a better inputfile and scanner object + NEWINPUT for a better inputfile and scanner object
Revision 1.15 1998/06/24 14:48:37 peter Revision 1.15 1998/06/24 14:48:37 peter

View File

@ -35,7 +35,7 @@
isstabwritten := false; isstabwritten := false;
{$endif GDB} {$endif GDB}
{$ifdef NEWINPUT} {$ifdef NEWINPUT}
line_no:=aktfilepos.line; fileinfo:=aktfilepos;
{$else} {$else}
if assigned(current_module) and assigned(current_module^.current_inputfile) then if assigned(current_module) and assigned(current_module^.current_inputfile) then
line_no:=current_module^.current_inputfile^.line_no line_no:=current_module^.current_inputfile^.line_no
@ -62,7 +62,14 @@
right:=nil; right:=nil;
setname(readstring); setname(readstring);
typ:=abstractsym; typ:=abstractsym;
{$ifdef NEWINPUT}
fillchar(fileinfo,sizeof(fileinfo),0);
{$else}
line_no:=0; line_no:=0;
{$endif}
if object_options then if object_options then
properties:=symprop(readbyte) properties:=symprop(readbyte)
else else
@ -330,7 +337,7 @@
function tsym.stabstring : pchar; function tsym.stabstring : pchar;
begin begin
stabstring:=strpnew('"'+name+'",'+tostr(N_LSYM)+',0,'+tostr(line_no)+',0'); stabstring:=strpnew('"'+name+'",'+tostr(N_LSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',0');
end; end;
procedure tsym.concatstabto(asmlist : paasmoutput); procedure tsym.concatstabto(asmlist : paasmoutput);
@ -1084,7 +1091,7 @@
if use_gsym then st := 'G' else st := 'S'; if use_gsym then st := 'G' else st := 'S';
stabstring := strpnew('"'+owner^.name^+'__'+name+':'+ stabstring := strpnew('"'+owner^.name^+'__'+name+':'+
+definition^.numberstring+'",'+ +definition^.numberstring+'",'+
tostr(N_LCSYM)+',0,'+tostr(line_no)+','+mangledname); tostr(N_LCSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
end end
else if (owner^.symtabletype = globalsymtable) or else if (owner^.symtabletype = globalsymtable) or
(owner^.symtabletype = unitsymtable) then (owner^.symtabletype = unitsymtable) then
@ -1096,13 +1103,13 @@
if use_gsym then st := 'G' else st := 'S'; if use_gsym then st := 'G' else st := 'S';
stabstring := strpnew('"'+name+':'+st stabstring := strpnew('"'+name+':'+st
+definition^.numberstring+'",'+ +definition^.numberstring+'",'+
tostr(N_LCSYM)+',0,'+tostr(line_no)+','+mangledname); tostr(N_LCSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
end end
else if owner^.symtabletype = staticsymtable then else if owner^.symtabletype = staticsymtable then
begin begin
stabstring := strpnew('"'+name+':S' stabstring := strpnew('"'+name+':S'
+definition^.numberstring+'",'+ +definition^.numberstring+'",'+
tostr(N_LCSYM)+',0,'+tostr(line_no)+','+mangledname); tostr(N_LCSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
end end
else if (owner^.symtabletype=parasymtable) then else if (owner^.symtabletype=parasymtable) then
begin begin
@ -1116,7 +1123,7 @@
end; end;
stabstring := strpnew('"'+name+':'+st stabstring := strpnew('"'+name+':'+st
+definition^.numberstring+'",'+ +definition^.numberstring+'",'+
tostr(N_PSYM)+',0,'+tostr(line_no)+','+tostr(address+owner^.call_offset)) tostr(N_PSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+tostr(address+owner^.call_offset))
{offset to ebp => will not work if the framepointer is esp {offset to ebp => will not work if the framepointer is esp
so some optimizing will make things harder to debug } so some optimizing will make things harder to debug }
end end
@ -1128,13 +1135,13 @@
{ this is the register order for GDB} { this is the register order for GDB}
stabstring:=strpnew('"'+name+':r' stabstring:=strpnew('"'+name+':r'
+definition^.numberstring+'",'+ +definition^.numberstring+'",'+
tostr(N_RSYM)+',0,'+tostr(line_no)+','+tostr(GDB_i386index[reg])); tostr(N_RSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+tostr(GDB_i386index[reg]));
end end
else else
{$endif i386} {$endif i386}
stabstring := strpnew('"'+name+':' stabstring := strpnew('"'+name+':'
+definition^.numberstring+'",'+ +definition^.numberstring+'",'+
tostr(N_LSYM)+',0,'+tostr(line_no)+',-'+tostr(address)) tostr(N_LSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',-'+tostr(address))
else else
stabstring := inherited stabstring; stabstring := inherited stabstring;
end; end;
@ -1153,7 +1160,7 @@
{ this is the register order for GDB} { this is the register order for GDB}
stab_str:=strpnew('"'+name+':r' stab_str:=strpnew('"'+name+':r'
+definition^.numberstring+'",'+ +definition^.numberstring+'",'+
tostr(N_RSYM)+',0,'+tostr(line_no)+','+tostr(GDB_i386index[reg])); tostr(N_RSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+tostr(GDB_i386index[reg]));
asmlist^.concat(new(pai_stabs,init(stab_str))); asmlist^.concat(new(pai_stabs,init(stab_str)));
end; end;
{$endif i386} {$endif i386}
@ -1271,7 +1278,7 @@
else else
st := 'S'; st := 'S';
stabstring := strpnew('"'+name+':'+st stabstring := strpnew('"'+name+':'+st
+definition^.numberstring+'",'+tostr(n_STSYM)+',0,'+tostr(line_no)+','+mangledname); +definition^.numberstring+'",'+tostr(n_STSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
end; end;
{$endif GDB} {$endif GDB}
@ -1395,7 +1402,7 @@
{ sets are not recognized by GDB} { sets are not recognized by GDB}
{***} {***}
end; end;
stabstring := strpnew('"'+name+':c='+st+'",'+tostr(N_function)+',0,'+tostr(line_no)+',0'); stabstring := strpnew('"'+name+':c='+st+'",'+tostr(N_function)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',0');
end; end;
procedure tconstsym.concatstabto(asmlist : paasmoutput); procedure tconstsym.concatstabto(asmlist : paasmoutput);
@ -1567,7 +1574,7 @@
else else
stabchar := 't'; stabchar := 't';
short := '"'+name+':'+stabchar+definition^.numberstring short := '"'+name+':'+stabchar+definition^.numberstring
+'",'+tostr(N_LSYM)+',0,'+tostr(line_no)+',0'; +'",'+tostr(N_LSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',0';
stabstring := strpnew(short); stabstring := strpnew(short);
end; end;
@ -1625,7 +1632,11 @@
{ {
$Log$ $Log$
Revision 1.19 1998-07-07 17:40:39 peter Revision 1.20 1998-07-10 00:00:05 peter
* fixed ttypesym bug finally
* fileinfo in the symtable and better using for unused vars
Revision 1.19 1998/07/07 17:40:39 peter
* packrecords 4 works * packrecords 4 works
* word aligning of parameters * word aligning of parameters