Преглед на файлове

* local browser support fixed

peter преди 24 години
родител
ревизия
7b45b6a4a9
променени са 6 файла, в които са добавени 188 реда и са изтрити 228 реда
  1. 5 7
      compiler/browlog.pas
  2. 16 13
      compiler/fppu.pas
  3. 26 83
      compiler/symdef.pas
  4. 34 33
      compiler/symsym.pas
  5. 39 37
      compiler/symtable.pas
  6. 68 55
      compiler/utils/ppudump.pp

+ 5 - 7
compiler/browlog.pas

@@ -375,7 +375,7 @@ implementation
                        symb:=tstoredsym(symt.search(upper(ss)));
                      if not assigned(symb) then
                        begin
-                          symt:=tprocsym(sym).definition.parast;
+                          symt:=tprocsym(sym).definition.localst;
                           sym:=tstoredsym(symt.search(ss));
                           if symb=nil then
                             symb:=tstoredsym(symt.search(upper(ss)));
@@ -461,11 +461,6 @@ implementation
                                  writesymtable(prdef.localst);
                             end;
                         end;
-                       if assigned(tprocdef(prdef).defref) then
-                        begin
-                          browserlog.AddLog('***'+tprocdef(prdef).name+'***');
-                          browserlog.AddLogRefs(tprocdef(prdef).defref);
-                        end;
                        prdef:=tprocdef(prdef).nextoverloaded;
                      end;
                   end;
@@ -519,7 +514,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.8  2001-04-18 22:01:53  peter
+  Revision 1.9  2001-08-19 09:39:27  peter
+    * local browser support fixed
+
+  Revision 1.8  2001/04/18 22:01:53  peter
     * registration of targets and assemblers
 
   Revision 1.7  2001/04/13 01:22:06  peter

+ 16 - 13
compiler/fppu.pas

@@ -303,8 +303,8 @@ uses
          if not onlysource then
           begin
             fnd:=PPUSearchPath('.');
-            if (not fnd) and (current_module.outputpath^<>'') then
-             fnd:=PPUSearchPath(current_module.outputpath^);
+            if (not fnd) and (outputpath^<>'') then
+             fnd:=PPUSearchPath(outputpath^);
            end;
          if (not fnd) and (fn<>'') then
           begin
@@ -330,7 +330,7 @@ uses
          if (not fnd) then
           fnd:=SourceSearchPath('.');
          if (not fnd) then
-          fnd:=SearchPathList(current_module.LocalUnitSearchPath);
+          fnd:=SearchPathList(LocalUnitSearchPath);
          if (not fnd) then
           fnd:=SearchPathList(UnitSearchPath);
 
@@ -341,7 +341,7 @@ uses
             filename:=copy(filename,1,8);
             fnd:=SearchPath('.');
             if (not fnd) then
-             fnd:=SearchPathList(current_module.LocalUnitSearchPath);
+             fnd:=SearchPathList(LocalUnitSearchPath);
             if not fnd then
              fnd:=SearchPathList(UnitSearchPath);
           end;
@@ -686,22 +686,22 @@ uses
           end;
 
         { load browser }
-        if (current_module.flags and uf_has_browser)<>0 then
+        if (flags and uf_has_browser)<>0 then
           begin
-            tstoredsymtable(globalsymtable).load_browser(ppufile);
+            tstoredsymtable(globalsymtable).load_references(ppufile,true);
             unitindex:=1;
             while assigned(map^[unitindex]) do
              begin
                { each unit wrote one browser entry }
-               tstoredsymtable(globalsymtable).load_browser(ppufile);
+               tstoredsymtable(globalsymtable).load_references(ppufile,false);
                inc(unitindex);
              end;
             b:=ppufile.readentry;
             if b<>ibendbrowser then
              Message1(unit_f_ppu_invalid_entry,tostr(b));
           end;
-        if ((current_module.flags and uf_local_browser)<>0) then
-          tstaticsymtable(current_module.localsymtable).load_browser(ppufile);
+        if ((flags and uf_local_browser)<>0) then
+          tstaticsymtable(localsymtable).load_references(ppufile,true);
       end;
 
 
@@ -772,18 +772,18 @@ uses
          { write all browser section }
          if (flags and uf_has_browser)<>0 then
           begin
-            tstoredsymtable(globalsymtable).write_browser(ppufile);
+            tstoredsymtable(globalsymtable).write_references(ppufile,true);
             pu:=tused_unit(used_units.first);
             while assigned(pu) do
              begin
-               tstoredsymtable(pu.u.globalsymtable).write_browser(ppufile);
+               tstoredsymtable(pu.u.globalsymtable).write_references(ppufile,false);
                pu:=tused_unit(pu.next);
              end;
             ppufile.writeentry(ibendbrowser);
           end;
          if ((flags and uf_local_browser)<>0) and
             assigned(localsymtable) then
-           tstaticsymtable(localsymtable).write_browser(ppufile);
+           tstaticsymtable(localsymtable).write_references(ppufile,true);
 
          { the last entry ibend is written automaticly }
 
@@ -1180,7 +1180,10 @@ uses
 end.
 {
   $Log$
-  Revision 1.9  2001-06-18 20:36:23  peter
+  Revision 1.10  2001-08-19 09:39:27  peter
+    * local browser support fixed
+
+  Revision 1.9  2001/06/18 20:36:23  peter
     * -Ur switch (merged)
     * masm fixes (merged)
     * quoted filenames for go32v2 and win32

+ 26 - 83
compiler/symdef.pas

@@ -70,7 +70,6 @@ interface
           function  size:longint;override;
           function  alignment:longint;override;
           function  is_publishable : boolean;override;
-          function  is_in_current : boolean;
           { debug }
 {$ifdef GDB}
           function  stabstring : pchar;virtual;
@@ -540,8 +539,8 @@ interface
           function  haspara:boolean;
           function  mangledname : string;
           procedure setmangledname(const s : string);
-          procedure load_references(ppufile:tcompilerppufile);
-          function  write_references(ppufile:tcompilerppufile) : boolean;
+          procedure load_references(ppufile:tcompilerppufile;locals:boolean);
+          function  write_references(ppufile:tcompilerppufile;locals:boolean):boolean;
           function  fullprocname:string;
           function fullprocnamewithret:string;
           function  cplusplusmangledname : string;
@@ -701,6 +700,7 @@ interface
        pbestrealtype : ^ttype = @s64floattype;
 {$endif}
 
+
 {$ifdef GDB}
     { GDB Helpers }
     function typeglobalnumber(const s : string) : string;
@@ -742,6 +742,7 @@ implementation
        gendef
        ;
 
+
 {****************************************************************************
                                   Helpers
 ****************************************************************************}
@@ -855,33 +856,6 @@ implementation
       end;
 
 
-    function tstoreddef.is_in_current : boolean;
-      var
-        p : tsymtable;
-      begin
-         p:=owner;
-         is_in_current:=false;
-         while assigned(p) do
-           begin
-              if (p=tsymtable(current_module.globalsymtable)) or (p=tsymtable(current_module.localsymtable))
-                 or (p.symtabletype in [globalsymtable,staticsymtable]) then
-                begin
-                   is_in_current:=true;
-                   exit;
-                end
-              else if p.symtabletype in [localsymtable,parasymtable,objectsymtable] then
-                begin
-                  if assigned(p.defowner) then
-                    p:=tobjectdef(p.defowner).owner
-                  else
-                    exit;
-                end
-              else
-                exit;
-           end;
-
-      end;
-
     procedure tstoreddef.writedef(ppufile:tcompilerppufile);
       begin
         ppufile.putword(indexnr);
@@ -3515,9 +3489,10 @@ implementation
           end;
          tparasymtable(parast).write(ppufile);
 
-         { save localsymtable for inline procedures, this has no influence
-           on the crc }
-         if (pocall_inline in proccalloptions) then
+         { save localsymtable for inline procedures or when local
+           browser info is requested, this has no influence on the crc }
+         if (pocall_inline in proccalloptions) or
+            ((current_module.flags and uf_local_browser)<>0) then
           begin
             oldintfcrc:=ppufile.do_crc;
             ppufile.do_crc:=false;
@@ -3568,9 +3543,7 @@ implementation
         end;
       end;
 
-Const local_symtable_index : longint = $8001;
-
-    procedure tprocdef.load_references(ppufile:tcompilerppufile);
+    procedure tprocdef.load_references(ppufile:tcompilerppufile;locals:boolean);
       var
         pos : tfileposinfo;
         oldsymtablestack,
@@ -3589,43 +3562,28 @@ Const local_symtable_index : longint = $8001;
          end;
         if move_last then
           lastwritten:=lastref;
-        if ((current_module.flags and uf_local_browser)<>0)
-           and is_in_current then
+        if ((current_module.flags and uf_local_browser)<>0) and
+           locals then
           begin
-             oldsymtablestack:=symtablestack;
-             st:=aktlocalsymtable;
-             parast:=tparasymtable.create;
-             tparasymtable(parast).load(ppufile);
-             parast.defowner:=self;
-             aktlocalsymtable:=parast;
-             tparasymtable(parast).deref;
-             parast.next:=owner;
-             tparasymtable(parast).load_browser(ppufile);
-             aktlocalsymtable:=st;
-             localst:=tlocalsymtable.create;
-             tlocalsymtable(localst).load(ppufile);
-             localst.defowner:=self;
-             aktlocalsymtable:=localst;
-             symtablestack:=parast;
-             tlocalsymtable(localst).deref;
-             localst.next:=parast;
-             tlocalsymtable(localst).load_browser(ppufile);
-             aktlocalsymtable:=st;
-             symtablestack:=oldsymtablestack;
+             tparasymtable(parast).load_references(ppufile,locals);
+             tlocalsymtable(localst).load_references(ppufile,locals);
           end;
       end;
 
 
-    function tprocdef.write_references(ppufile:tcompilerppufile) : boolean;
+    Const
+      local_symtable_index : longint = $8001;
+
+    function tprocdef.write_references(ppufile:tcompilerppufile;locals:boolean):boolean;
       var
         ref : tref;
-        st : tsymtable;
         pdo : tobjectdef;
         move_last : boolean;
       begin
         move_last:=lastwritten=lastref;
-        if move_last and (((current_module.flags and uf_local_browser)=0)
-           or not is_in_current) then
+        if move_last and
+           (((current_module.flags and uf_local_browser)=0) or
+            not locals) then
           exit;
       { write address of this symbol }
         ppufile.putderef(self);
@@ -3651,8 +3609,8 @@ Const local_symtable_index : longint = $8001;
          end;
         ppufile.writeentry(ibdefref);
         write_references:=true;
-        if ((current_module.flags and uf_local_browser)<>0)
-           and is_in_current then
+        if ((current_module.flags and uf_local_browser)<>0) and
+           locals then
           begin
              pdo:=_class;
              if (owner.symtabletype<>localsymtable) then
@@ -3665,27 +3623,12 @@ Const local_symtable_index : longint = $8001;
                       end;
                     pdo:=pdo.childof;
                  end;
-
-             { we need TESTLOCALBROWSER para and local symtables
-               PPU files are then easier to read PM }
-             if not assigned(parast) then
-               parast:=tparasymtable.create;
-             parast.defowner:=self;
-             st:=aktlocalsymtable;
-             aktlocalsymtable:=parast;
-             tstoredsymtable(parast).write(ppufile);
              parast.unitid:=local_symtable_index;
              inc(local_symtable_index);
-             tstoredsymtable(parast).write_browser(ppufile);
-             if not assigned(localst) then
-               localst:=tlocalsymtable.create;
-             localst.defowner:=self;
-             aktlocalsymtable:=localst;
-             tstoredsymtable(localst).write(ppufile);
              localst.unitid:=local_symtable_index;
              inc(local_symtable_index);
-             tstoredsymtable(localst).write_browser(ppufile);
-             aktlocalsymtable:=st;
+             tstoredsymtable(parast).write_references(ppufile,locals);
+             tstoredsymtable(localst).write_references(ppufile,locals);
              { decrement for }
              local_symtable_index:=local_symtable_index-2;
              pdo:=_class;
@@ -5546,8 +5489,8 @@ Const local_symtable_index : longint = $8001;
 end.
 {
   $Log$
-  Revision 1.42  2001-08-12 22:09:40  peter
-    * write also dynamicarray flag to ppu
+  Revision 1.43  2001-08-19 09:39:27  peter
+    * local browser support fixed
 
   Revision 1.41  2001/08/12 20:04:33  peter
     * fpu_used=0 when simplify_ppu is used

+ 34 - 33
compiler/symsym.pas

@@ -64,8 +64,8 @@ interface
           function  stabstring : pchar;virtual;
           procedure concatstabto(asmlist : taasmoutput);virtual;
 {$endif GDB}
-          procedure load_references(ppufile:tcompilerppufile);virtual;
-          function  write_references(ppufile:tcompilerppufile) : boolean;virtual;
+          procedure load_references(ppufile:tcompilerppufile;locals:boolean);virtual;
+          function  write_references(ppufile:tcompilerppufile;locals:boolean):boolean;virtual;
        end;
 
        tlabelsym = class(tstoredsym)
@@ -115,8 +115,8 @@ interface
           procedure order_overloaded;
           procedure write(ppufile:tcompilerppufile);override;
           procedure deref;override;
-          procedure load_references(ppufile:tcompilerppufile);override;
-          function  write_references(ppufile:tcompilerppufile) : boolean;override;
+          procedure load_references(ppufile:tcompilerppufile;locals:boolean);override;
+          function  write_references(ppufile:tcompilerppufile;locals:boolean):boolean;override;
 {$ifdef GDB}
           function stabstring : pchar;override;
           procedure concatstabto(asmlist : taasmoutput);override;
@@ -133,8 +133,8 @@ interface
           procedure write(ppufile:tcompilerppufile);override;
           procedure deref;override;
           function  gettypedef:tdef;override;
-          procedure load_references(ppufile:tcompilerppufile);override;
-          function  write_references(ppufile:tcompilerppufile) : boolean;override;
+          procedure load_references(ppufile:tcompilerppufile;locals:boolean);override;
+          function  write_references(ppufile:tcompilerppufile;locals:boolean):boolean;override;
 {$ifdef GDB}
           function stabstring : pchar;override;
           procedure concatstabto(asmlist : taasmoutput);override;
@@ -394,7 +394,7 @@ implementation
       end;
 
 
-    procedure tstoredsym.load_references(ppufile:tcompilerppufile);
+    procedure tstoredsym.load_references(ppufile:tcompilerppufile;locals:boolean);
       var
         pos : tfileposinfo;
         move_last : boolean;
@@ -418,7 +418,7 @@ implementation
       interface parsing of other units PM
       moduleindex must be checked !! }
 
-    function tstoredsym.write_references(ppufile:tcompilerppufile) : boolean;
+    function tstoredsym.write_references(ppufile:tcompilerppufile;locals:boolean):boolean;
       var
         ref   : tref;
         symref_written,move_last : boolean;
@@ -783,12 +783,12 @@ implementation
       end;
 
 
-    procedure tprocsym.load_references(ppufile:tcompilerppufile);
+    procedure tprocsym.load_references(ppufile:tcompilerppufile;locals:boolean);
       (*var
         prdef,prdef2 : tprocdef;
         b : byte; *)
       begin
-         inherited load_references(ppufile);
+         inherited load_references(ppufile,locals);
          (*prdef:=definition;
            done in tsymtable.load_browser (PM)
          { take care about operators !!  }
@@ -807,18 +807,18 @@ implementation
              end; *)
       end;
 
-    function tprocsym.write_references(ppufile:tcompilerppufile) : boolean;
+    function tprocsym.write_references(ppufile:tcompilerppufile;locals:boolean) : boolean;
       var
         prdef : tprocdef;
       begin
          write_references:=false;
-         if not inherited write_references(ppufile) then
+         if not inherited write_references(ppufile,locals) then
            exit;
          write_references:=true;
          prdef:=definition;
          while assigned(prdef) and (prdef.owner=definition.owner) do
           begin
-            prdef.write_references(ppufile);
+            prdef.write_references(ppufile,locals);
             prdef:=prdef.nextoverloaded;
           end;
       end;
@@ -1428,7 +1428,7 @@ implementation
                    varstate:=vs_declared;
                    varalign:=size_2_align(l);
                    varalign:=used_align(varalign,aktalignment.localalignmin,aktalignment.localalignmax);
-                   address:=align(owner.datasize,varalign)+l;
+                   address:=align(owner.datasize+l,varalign);
                    owner.datasize:=address;
                  end;
                staticsymtable :
@@ -2142,33 +2142,34 @@ implementation
       end;
 
 
-    procedure ttypesym.load_references(ppufile:tcompilerppufile);
+    procedure ttypesym.load_references(ppufile:tcompilerppufile;locals:boolean);
       begin
-         inherited load_references(ppufile);
+         inherited load_references(ppufile,locals);
          if (restype.def.deftype=recorddef) then
-           tstoredsymtable(trecorddef(restype.def).symtable).load_browser(ppufile);
+           tstoredsymtable(trecorddef(restype.def).symtable).load_references(ppufile,locals);
          if (restype.def.deftype=objectdef) then
-           tstoredsymtable(tobjectdef(restype.def).symtable).load_browser(ppufile);
+           tstoredsymtable(tobjectdef(restype.def).symtable).load_references(ppufile,locals);
       end;
 
 
-    function ttypesym.write_references(ppufile:tcompilerppufile) : boolean;
+    function ttypesym.write_references(ppufile:tcompilerppufile;locals:boolean):boolean;
       begin
-        if not inherited write_references(ppufile) then
+        if not inherited write_references(ppufile,locals) then
+         begin
          { write address of this symbol if record or object
            even if no real refs are there
            because we need it for the symtable }
-         if (restype.def.deftype=recorddef) or
-            (restype.def.deftype=objectdef) then
-          begin
-            ppufile.putderef(self);
-            ppufile.writeentry(ibsymref);
-          end;
-         write_references:=true;
-         if (restype.def.deftype=recorddef) then
-           tstoredsymtable(trecorddef(restype.def).symtable).write_browser(ppufile);
-         if (restype.def.deftype=objectdef) then
-           tstoredsymtable(tobjectdef(restype.def).symtable).write_browser(ppufile);
+           if (restype.def.deftype in [recorddef,objectdef]) then
+            begin
+              ppufile.putderef(self);
+              ppufile.writeentry(ibsymref);
+            end;
+         end;
+        write_references:=true;
+        if (restype.def.deftype=recorddef) then
+           tstoredsymtable(trecorddef(restype.def).symtable).write_references(ppufile,locals);
+        if (restype.def.deftype=objectdef) then
+           tstoredsymtable(tobjectdef(restype.def).symtable).write_references(ppufile,locals);
       end;
 
 
@@ -2239,8 +2240,8 @@ implementation
 end.
 {
   $Log$
-  Revision 1.17  2001-08-12 22:11:52  peter
-    * errordef.typesym is not updated anymore
+  Revision 1.18  2001-08-19 09:39:28  peter
+    * local browser support fixed
 
   Revision 1.16  2001/08/12 20:00:26  peter
     * don't write fpuregable for varoptions

+ 39 - 37
compiler/symtable.pas

@@ -70,8 +70,8 @@ interface
           { load/write }
           procedure load(ppufile:tcompilerppufile);virtual;
           procedure write(ppufile:tcompilerppufile);virtual;
-          procedure load_browser(ppufile:tcompilerppufile);virtual;
-          procedure write_browser(ppufile:tcompilerppufile);virtual;
+          procedure load_references(ppufile:tcompilerppufile;locals:boolean);virtual;
+          procedure write_references(ppufile:tcompilerppufile;locals:boolean);virtual;
           procedure deref;virtual;
           procedure derefimpl;virtual;
           procedure insert(sym : tsymentry);override;
@@ -97,8 +97,8 @@ interface
        public
           procedure load(ppufile:tcompilerppufile);override;
           procedure write(ppufile:tcompilerppufile);override;
-          procedure load_browser(ppufile:tcompilerppufile);override;
-          procedure write_browser(ppufile:tcompilerppufile);override;
+          procedure load_references(ppufile:tcompilerppufile;locals:boolean);override;
+          procedure write_references(ppufile:tcompilerppufile;locals:boolean);override;
        end;
 
        trecordsymtable = class(tabstractrecordsymtable)
@@ -117,8 +117,8 @@ interface
        public
           procedure load(ppufile:tcompilerppufile);override;
           procedure write(ppufile:tcompilerppufile);override;
-          procedure load_browser(ppufile:tcompilerppufile);override;
-          procedure write_browser(ppufile:tcompilerppufile);override;
+          procedure load_references(ppufile:tcompilerppufile;locals:boolean);override;
+          procedure write_references(ppufile:tcompilerppufile;locals:boolean);override;
        end;
 
        tlocalsymtable = class(tabstractlocalsymtable)
@@ -168,8 +168,8 @@ interface
           constructor create(const n : string);
           procedure load(ppufile:tcompilerppufile);override;
           procedure write(ppufile:tcompilerppufile);override;
-          procedure load_browser(ppufile:tcompilerppufile);override;
-          procedure write_browser(ppufile:tcompilerppufile);override;
+          procedure load_references(ppufile:tcompilerppufile;locals:boolean);override;
+          procedure write_references(ppufile:tcompilerppufile;locals:boolean);override;
           procedure insert(sym : tsymentry);override;
        end;
 
@@ -435,7 +435,7 @@ implementation
       end;
 
 
-    procedure tstoredsymtable.load_browser(ppufile:tcompilerppufile);
+    procedure tstoredsymtable.load_references(ppufile:tcompilerppufile;locals:boolean);
       var
         b     : byte;
         sym   : tstoredsym;
@@ -452,7 +452,7 @@ implementation
                  sym:=tstoredsym(ppufile.getderef);
                  resolvesym(tsym(sym));
                  if assigned(sym) then
-                   sym.load_references(ppufile);
+                   sym.load_references(ppufile,locals);
                end;
              ibdefref :
                begin
@@ -462,7 +462,7 @@ implementation
                    begin
                      if prdef.deftype<>procdef then
                        Message(unit_f_ppu_read_error);
-                     tprocdef(prdef).load_references(ppufile);
+                     tprocdef(prdef).load_references(ppufile,locals);
                    end;
                end;
              ibendsymtablebrowser :
@@ -474,16 +474,16 @@ implementation
       end;
 
 
-    procedure tstoredsymtable.write_browser(ppufile:tcompilerppufile);
+    procedure tstoredsymtable.write_references(ppufile:tcompilerppufile;locals:boolean);
       var
         pd : tstoredsym;
       begin
          ppufile.writeentry(ibbeginsymtablebrowser);
-       { foreach is used to write all symbols }
+         { write all symbols }
          pd:=tstoredsym(symindex.first);
          while assigned(pd) do
            begin
-              pd.write_references(ppufile);
+              pd.write_references(ppufile,locals);
               pd:=tstoredsym(pd.indexnext);
            end;
          ppufile.writeentry(ibendsymtablebrowser);
@@ -985,6 +985,15 @@ implementation
 {$endif}
 
 
+    { returns true, if p contains data which needs init/final code }
+    function tstoredsymtable.needs_init_final : boolean;
+      begin
+         b_needs_init_final:=false;
+         foreach({$ifdef FPCPROCVAR}@{$endif}_needs_init_final);
+         needs_init_final:=b_needs_init_final;
+      end;
+
+
 {****************************************************************************
                           TAbstractRecordSymtable
 ****************************************************************************}
@@ -1022,27 +1031,27 @@ implementation
       end;
 
 
-    procedure tabstractrecordsymtable.load_browser(ppufile:tcompilerppufile);
+    procedure tabstractrecordsymtable.load_references(ppufile:tcompilerppufile;locals:boolean);
       var
         storesymtable : tsymtable;
       begin
         storesymtable:=aktrecordsymtable;
         aktrecordsymtable:=self;
 
-        inherited load_browser(ppufile);
+        inherited load_references(ppufile,locals);
 
         aktrecordsymtable:=storesymtable;
       end;
 
 
-    procedure tabstractrecordsymtable.write_browser(ppufile:tcompilerppufile);
+    procedure tabstractrecordsymtable.write_references(ppufile:tcompilerppufile;locals:boolean);
       var
         storesymtable : tsymtable;
       begin
         storesymtable:=aktrecordsymtable;
         aktrecordsymtable:=self;
 
-        inherited write_browser(ppufile);
+        inherited write_references(ppufile,locals);
 
         aktrecordsymtable:=storesymtable;
       end;
@@ -1059,16 +1068,6 @@ implementation
       end;
 
 
-    { returns true, if p contains data which needs init/final code }
-    function tstoredsymtable.needs_init_final : boolean;
-      begin
-         b_needs_init_final:=false;
-         foreach({$ifdef FPCPROCVAR}@{$endif}_needs_init_final);
-         needs_init_final:=b_needs_init_final;
-      end;
-
-
-
 {****************************************************************************
                               TRecordSymtable
 ****************************************************************************}
@@ -1199,27 +1198,27 @@ implementation
       end;
 
 
-    procedure tabstractlocalsymtable.load_browser(ppufile:tcompilerppufile);
+    procedure tabstractlocalsymtable.load_references(ppufile:tcompilerppufile;locals:boolean);
       var
         storesymtable : tsymtable;
       begin
         storesymtable:=aktlocalsymtable;
         aktlocalsymtable:=self;
 
-        inherited load_browser(ppufile);
+        inherited load_references(ppufile,locals);
 
         aktlocalsymtable:=storesymtable;
       end;
 
 
-    procedure tabstractlocalsymtable.write_browser(ppufile:tcompilerppufile);
+    procedure tabstractlocalsymtable.write_references(ppufile:tcompilerppufile;locals:boolean);
       var
         storesymtable : tsymtable;
       begin
         storesymtable:=aktlocalsymtable;
         aktlocalsymtable:=self;
 
-        inherited load_browser(ppufile);
+        inherited write_references(ppufile,locals);
 
         aktlocalsymtable:=storesymtable;
       end;
@@ -1472,19 +1471,19 @@ implementation
       end;
 
 
-    procedure tstaticsymtable.load_browser(ppufile:tcompilerppufile);
+    procedure tstaticsymtable.load_references(ppufile:tcompilerppufile;locals:boolean);
       begin
         aktstaticsymtable:=self;
 
-        inherited load_browser(ppufile);
+        inherited load_references(ppufile,locals);
       end;
 
 
-    procedure tstaticsymtable.write_browser(ppufile:tcompilerppufile);
+    procedure tstaticsymtable.write_references(ppufile:tcompilerppufile;locals:boolean);
       begin
         aktstaticsymtable:=self;
 
-        inherited write_browser(ppufile);
+        inherited write_references(ppufile,locals);
       end;
 
 
@@ -2072,7 +2071,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.40  2001-08-06 21:40:49  peter
+  Revision 1.41  2001-08-19 09:39:29  peter
+    * local browser support fixed
+
+  Revision 1.40  2001/08/06 21:40:49  peter
     * funcret moved from tprocinfo to tprocdef
 
   Revision 1.39  2001/07/29 22:12:58  peter

+ 68 - 55
compiler/utils/ppudump.pp

@@ -48,6 +48,7 @@ var
   ppufile     : tppufile;
   space       : string;
   read_member : boolean;
+  unitindex   : longint;
   verbose     : longint;
 
 {****************************************************************************
@@ -344,7 +345,7 @@ begin
 end;
 
 
-procedure read_abstract_proc_def;
+{ Read abstract procdef and return if inline procdef }
 type
   tproccalloption=(pocall_none,
     pocall_clearstack,    { Use IBM flat calling convention. (Used by GCC.) }
@@ -390,6 +391,7 @@ type
     po_varargs            { printf like arguments }
   );
   tprocoptions=set of tprocoption;
+function read_abstract_proc_def:tproccalloptions;
 type
   tproccallopt=record
     mask : tproccalloption;
@@ -477,6 +479,7 @@ begin
      writeln;
    end;
   ppufile.getsmallset(proccalloptions);
+  read_abstract_proc_def:=proccalloptions;
   if proccalloptions<>[] then
    begin
      write(space,'      CallOptions : ');
@@ -862,6 +865,7 @@ var
   oldread_member : boolean;
   totaldefs,l,j,
   defcnt : longint;
+  calloption : tproccalloptions;
 begin
   defcnt:=0;
   with ppufile do
@@ -934,12 +938,13 @@ begin
              readtype;
              writeln(space,'            Range : ',getlongint,' to ',getlongint);
              writeln(space,'   Is Constructor : ',(getbyte<>0));
+             writeln(space,'       Is Dynamic : ',(getbyte<>0));
            end;
 
          ibprocdef :
            begin
              readcommondef('Procedure definition');
-             read_abstract_proc_def;
+             calloption:=read_abstract_proc_def;
              writeln(space,'    Used Register : ',getbyte);
              writeln(space,'     Mangled name : ',getstring);
              writeln(space,'           Number : ',getlongint);
@@ -949,13 +954,22 @@ begin
              readdefref;
              write  (space,'         File Pos : ');
              readposinfo;
+             if (pocall_inline in calloption) then
+              begin
+                write  (space,'       FuncretSym : ');
+                readdefref;
+              end;
              space:='    '+space;
              { parast }
              readdefinitions(false);
              readsymbols;
              { localst }
-             {readdefinitions(false);
-             readsymbols;}
+             if (pocall_inline in calloption) or
+                ((ppufile.header.flags and uf_local_browser) <> 0) then
+              begin
+                readdefinitions(false);
+                readsymbols;
+              end;
              delete(space,1,4);
            end;
 
@@ -1276,50 +1290,49 @@ begin
      repeat
        b:=readentry;
        case b of
-        ibbeginsymtablebrowser :
-                         { here we must read object and record symtables !! }
-                    begin
-                      indent:=indent+'  ';
-                      Writeln(indent,'Record/Object symtable');
-                      readbrowser;
-                      Indent:=Copy(Indent,1,Length(Indent)-2);
-                    end;
-            ibsymref : begin
-                         readsymref;
-                         readref;
-                       end;
-            ibdefref : begin
-                         readdefref;
-                         readref;
-                         if (ppufile.header.flags and uf_local_browser)<>0 then
-                           begin
-                             { parast and localst }
-                             indent:=indent+'  ';
-                             Writeln(indent,'Parasymtable for function');
-                             readdefinitions(false);
-                             readsymbols;
-                             b:=ppufile.readentry;
-                             if b=ibbeginsymtablebrowser then
-                               readbrowser;
-                             Writeln(indent,'Localsymtable for function');
-                             readdefinitions(false);
-                             readsymbols;
-                             b:=ppufile.readentry;
-                             if b=ibbeginsymtablebrowser then
-                               readbrowser;
-                             Indent:=Copy(Indent,1,Length(Indent)-2);
-                           end;
-                       end;
-             iberror : begin
-                         Writeln('Error in PPU');
-                         exit;
-                       end;
-        ibendsymtablebrowser : break;
-       else
-        begin
-        WriteLn('!! Skipping unsupported PPU Entry in Browser: ',b);
-        Halt;
-        end;
+         ibbeginsymtablebrowser :
+           begin
+             { here we must read object and record symtables !! }
+             indent:=indent+'  ';
+             Writeln(indent,'Record/Object symtable');
+             readbrowser;
+             Indent:=Copy(Indent,1,Length(Indent)-2);
+           end;
+         ibsymref :
+           begin
+             readsymref;
+             readref;
+           end;
+         ibdefref :
+           begin
+             readdefref;
+             readref;
+             if ((ppufile.header.flags and uf_local_browser)<>0) and
+                (UnitIndex=0) then
+              begin
+                { parast and localst }
+                indent:=indent+'  ';
+                b:=ppufile.readentry;
+                if b=ibbeginsymtablebrowser then
+                 readbrowser;
+                b:=ppufile.readentry;
+                if b=ibbeginsymtablebrowser then
+                 readbrowser;
+                Indent:=Copy(Indent,1,Length(Indent)-2);
+              end;
+           end;
+         iberror :
+           begin
+             Writeln('Error in PPU');
+             exit;
+           end;
+         ibendsymtablebrowser :
+           break;
+         else
+           begin
+             WriteLn('!! Skipping unsupported PPU Entry in Browser: ',b);
+             Halt;
+           end;
        end;
      until false;
    end;
@@ -1332,7 +1345,7 @@ end;
 
 procedure dofile (filename : string);
 var
-  b,unitindex : byte;
+  b : byte;
 begin
 { reset }
   space:='';
@@ -1468,13 +1481,10 @@ begin
         Writeln;
         Writeln('Static browser section');
         Writeln('---------------');
+        UnitIndex:=0;
         b:=ppufile.readentry;
         if b=ibbeginsymtablebrowser then
-          begin
-             Writeln('Unit ',UnitIndex);
-             readbrowser;
-             Inc(UnitIndex);
-          end
+          readbrowser
         else
           Writeln('Wrong end browser entry ',b,' should be ',ibendbrowser);
       end;
@@ -1550,7 +1560,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.5  2001-06-29 19:42:18  peter
+  Revision 1.6  2001-08-19 09:39:29  peter
+    * local browser support fixed
+
+  Revision 1.5  2001/06/29 19:42:18  peter
     * new flags added
 
   Revision 1.4  2001/06/04 11:53:15  peter