2
0
Эх сурвалжийг харах

* fixes a stabs problem for functions
+ includes a stabs local var for with statements
the name is with in lowercase followed by an index
for nested with.
+ Withdebuglist added because the stabs declarations of local
var are postponed to end of function.

pierre 25 жил өмнө
parent
commit
c6a47280b9

+ 11 - 3
compiler/aasm.pas

@@ -335,7 +335,7 @@ type
       exprasmlist,
     { default lists }
       datasegment,codesegment,bsssegment,
-      debuglist,consts,
+      debuglist,withdebuglist,consts,
       importssection,exportssection,
       resourcesection,rttilist,
       resourcestringlist         : paasmoutput;
@@ -1044,7 +1044,15 @@ uses
 end.
 {
   $Log$
-  Revision 1.77  2000-02-09 13:22:42  peter
+  Revision 1.78  2000-02-18 20:53:14  pierre
+    * fixes a stabs problem for functions
+    + includes a stabs local var for with statements
+      the name is with in lowercase followed by an index
+      for nested with.
+    + Withdebuglist added because the stabs declarations of local
+      var are postponed to end of function.
+
+  Revision 1.77  2000/02/09 13:22:42  peter
     * log truncated
 
   Revision 1.76  2000/02/03 23:01:45  peter
@@ -1124,4 +1132,4 @@ end.
   Revision 1.57  1999/08/02 21:01:41  michael
   * Moved toperand type back =(
 
-}
+}

+ 61 - 4
compiler/cg386mem.pas

@@ -43,6 +43,9 @@ interface
 implementation
 
     uses
+{$ifdef GDB}
+      strings,gdb,
+{$endif GDB}
       globtype,systems,
       cobjects,verbose,globals,
       symconst,symtable,aasm,types,
@@ -809,6 +812,14 @@ implementation
     procedure secondwith(var p : ptree);
       var
         usetemp,with_expr_in_temp : boolean;
+{$ifdef GDB}
+        withstartlabel,withendlabel : pasmlabel;
+        pp : pchar;
+        mangled_length  : longint;
+
+      const
+        withlevel : longint = 0;
+{$endif GDB}
       begin
          if assigned(p^.left) then
             begin
@@ -870,6 +881,28 @@ implementation
 {$ifndef noAllocEdi}
                   ungetregister32(R_EDI);
 {$endif noAllocEdi}
+{$ifdef GDB}
+                  if (cs_debuginfo in aktmoduleswitches) then
+                    begin
+                      inc(withlevel);
+                      getlabel(withstartlabel);
+                      getlabel(withendlabel);
+                      emitlab(withstartlabel);
+                      withdebuglist^.concat(new(pai_stabs,init(strpnew(
+                         '"with'+tostr(withlevel)+':'+tostr(symtablestack^.getnewtypecount)+
+                         '=*'+p^.left^.resulttype^.numberstring+'",'+
+                         tostr(N_LSYM)+',0,0,'+tostr(p^.withreference^.offset)))));
+                      mangled_length:=length(aktprocsym^.definition^.mangledname);
+                      getmem(pp,mangled_length+50);
+                      strpcopy(pp,'192,0,0,'+withstartlabel^.name);
+                      if (target_os.use_function_relative_addresses) then
+                        begin
+                          strpcopy(strend(pp),'-');
+                          strpcopy(strend(pp),aktprocsym^.definition^.mangledname);
+                        end;
+                      withdebuglist^.concat(new(pai_stabn,init(strnew(pp))));
+                    end;
+{$endif GDB}
                   del_reference(p^.left^.location.reference);
                 end;
 
@@ -878,7 +911,24 @@ implementation
                  secondpass(p^.right);
 
                if usetemp then
-                 ungetpersistanttemp(p^.withreference^.offset);
+                 begin
+                   ungetpersistanttemp(p^.withreference^.offset);
+{$ifdef GDB}
+                   if (cs_debuginfo in aktmoduleswitches) then
+                     begin
+                       emitlab(withendlabel);
+                       strpcopy(pp,'224,0,0,'+withendlabel^.name);
+                      if (target_os.use_function_relative_addresses) then
+                        begin
+                          strpcopy(strend(pp),'-');
+                          strpcopy(strend(pp),aktprocsym^.definition^.mangledname);
+                        end;
+                       withdebuglist^.concat(new(pai_stabn,init(strnew(pp))));
+                       freemem(pp,mangled_length+50);
+                       dec(withlevel);
+                     end;
+{$endif GDB}
+                 end;
 
                if with_expr_in_temp then
                  ungetpersistanttemp(p^.left^.location.reference.offset);
@@ -892,7 +942,15 @@ implementation
 end.
 {
   $Log$
-  Revision 1.71  2000-02-09 18:08:33  jonas
+  Revision 1.72  2000-02-18 20:53:14  pierre
+    * fixes a stabs problem for functions
+    + includes a stabs local var for with statements
+      the name is with in lowercase followed by an index
+      for nested with.
+    + Withdebuglist added because the stabs declarations of local
+      var are postponed to end of function.
+
+  Revision 1.71  2000/02/09 18:08:33  jonas
     * added regallocs for esi
 
   Revision 1.70  2000/02/09 13:22:47  peter
@@ -970,5 +1028,4 @@ end.
   Revision 1.50  1999/08/14 00:36:05  peter
     * array constructor support
 
-}
-
+}

+ 25 - 5
compiler/cgai386.pas

@@ -3668,7 +3668,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 
               { define calling EBP as pseudo local var PM }
               { this enables test if the function is a local one !! }
-              if  assigned(procinfo^.parent) then
+              if  assigned(procinfo^.parent) and (lexlevel>normal_function_level) then
                 exprasmlist^.concat(new(pai_stabs,init(strpnew(
                  '"parent_ebp:'+voidpointerdef^.numberstring+'",'+
                  tostr(N_LSYM)+',0,0,'+tostr(procinfo^.framepointer_offset)))));
@@ -3694,19 +3694,31 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                        tostr(N_PSYM)+',0,0,'+tostr(procinfo^.return_offset)))));
                 end;
               mangled_length:=length(aktprocsym^.definition^.mangledname);
-              getmem(p,mangled_length+50);
+              getmem(p,2*mangled_length+50);
               strpcopy(p,'192,0,0,');
               strpcopy(strend(p),aktprocsym^.definition^.mangledname);
+              if (target_os.use_function_relative_addresses) then
+                begin
+                  strpcopy(strend(p),'-');
+                  strpcopy(strend(p),aktprocsym^.definition^.mangledname);
+                end;
               exprasmlist^.concat(new(pai_stabn,init(strnew(p))));
               {list^.concat(new(pai_stabn,init(strpnew('192,0,0,'
                +aktprocsym^.definition^.mangledname))));
               p[0]:='2';p[1]:='2';p[2]:='4';
               strpcopy(strend(p),'_end');}
-              freemem(p,mangled_length+50);
+              strpcopy(p,'224,0,0,'+aktexit2label^.name);
+              if (target_os.use_function_relative_addresses) then
+                begin
+                  strpcopy(strend(p),'-');
+                  strpcopy(strend(p),aktprocsym^.definition^.mangledname);
+                end;
+              exprasmlist^.concatlist(withdebuglist);
               exprasmlist^.concat(new(pai_stabn,init(
-                strpnew('224,0,0,'+aktexit2label^.name))));
+                strnew(p))));
                { strpnew('224,0,0,'
                +aktprocsym^.definition^.mangledname+'_end'))));}
+              freemem(p,2*mangled_length+50);
           end;
 {$endif GDB}
       exprasmlist:=oldexprasmlist;
@@ -3740,7 +3752,15 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 end.
 {
   $Log$
-  Revision 1.81  2000-02-10 23:44:43  florian
+  Revision 1.82  2000-02-18 20:53:14  pierre
+    * fixes a stabs problem for functions
+    + includes a stabs local var for with statements
+      the name is with in lowercase followed by an index
+      for nested with.
+    + Withdebuglist added because the stabs declarations of local
+      var are postponed to end of function.
+
+  Revision 1.81  2000/02/10 23:44:43  florian
     * big update for exception handling code generation: possible mem holes
       fixed, break/continue/exit should work always now as expected
 

+ 12 - 2
compiler/hcodegen.pas

@@ -357,6 +357,7 @@ implementation
          codesegment:=new(paasmoutput,init);
          bsssegment:=new(paasmoutput,init);
          debuglist:=new(paasmoutput,init);
+         withdebuglist:=new(paasmoutput,init);
          consts:=new(paasmoutput,init);
          rttilist:=new(paasmoutput,init);
          importssection:=nil;
@@ -383,6 +384,7 @@ implementation
          dispose(bsssegment,done);
          dispose(datasegment,done);
          dispose(debuglist,done);
+         dispose(withdebuglist,done);
          dispose(consts,done);
          dispose(rttilist,done);
          if assigned(importssection) then
@@ -447,7 +449,15 @@ end.
 
 {
   $Log$
-  Revision 1.56  2000-02-09 13:22:53  peter
+  Revision 1.57  2000-02-18 20:53:14  pierre
+    * fixes a stabs problem for functions
+    + includes a stabs local var for with statements
+      the name is with in lowercase followed by an index
+      for nested with.
+    + Withdebuglist added because the stabs declarations of local
+      var are postponed to end of function.
+
+  Revision 1.56  2000/02/09 13:22:53  peter
     * log truncated
 
   Revision 1.55  2000/01/16 22:17:11  peter
@@ -514,4 +524,4 @@ end.
   Revision 1.36  1999/08/01 23:09:26  michael
   * procbase -> cpubase
 
-}
+}

+ 14 - 1
compiler/parser.pas

@@ -26,6 +26,7 @@
 unit parser;
 
 { Use exception catching so the compiler goes futher after a Stop }
+{$ifndef NOUSEEXCEPT}
 {$ifdef i386}
   {$define USEEXCEPT}
 {$endif}
@@ -35,6 +36,7 @@ unit parser;
     {$undef USEEXCEPT}
   {$endif}
 {$endif}
+{$endif ndef NOUSEEXCEPT}
 
   interface
 
@@ -258,6 +260,7 @@ unit parser;
          oldcodesegment,
          oldexprasmlist,
          olddebuglist,
+         oldwithdebuglist,
          oldconsts     : paasmoutput;
          oldasmsymbollist : pasmsymbollist;
        { akt.. things }
@@ -313,6 +316,7 @@ unit parser;
          oldbsssegment:=bsssegment;
          oldcodesegment:=codesegment;
          olddebuglist:=debuglist;
+         oldwithdebuglist:=withdebuglist;
          oldconsts:=consts;
          oldrttilist:=rttilist;
          oldexprasmlist:=exprasmlist;
@@ -498,6 +502,7 @@ unit parser;
               codesegment:=oldcodesegment;
               consts:=oldconsts;
               debuglist:=olddebuglist;
+              withdebuglist:=oldwithdebuglist;
               importssection:=oldimports;
               exportssection:=oldexports;
               resourcesection:=oldresource;
@@ -594,7 +599,15 @@ unit parser;
 end.
 {
   $Log$
-  Revision 1.100  2000-02-14 20:58:44  marco
+  Revision 1.101  2000-02-18 20:53:15  pierre
+    * fixes a stabs problem for functions
+    + includes a stabs local var for with statements
+      the name is with in lowercase followed by an index
+      for nested with.
+    + Withdebuglist added because the stabs declarations of local
+      var are postponed to end of function.
+
+  Revision 1.100  2000/02/14 20:58:44  marco
    * Basic structures for new sethandling implemented.
 
   Revision 1.99  2000/02/09 13:22:55  peter