Browse Source

* renamed mark_InlineStart/mark_InlineEnd to mark_NoLineinfoStart/
mark_NoLineinfoEnd
* add "no line info" markers for try/except and try/finally internal cleanup
code, so the debugger doesn't jump back and forth between the end and start
of exception blocks when you arrive at the end
* honour "no line info" markers in dbgdwarf.pas

git-svn-id: trunk@14327 -

Jonas Maebe 15 years ago
parent
commit
4838ebe73b

+ 1 - 1
compiler/aasmtai.pas

@@ -253,7 +253,7 @@ interface
       TAsmMarker = (
         mark_NoPropInfoStart,mark_NoPropInfoEnd,
         mark_AsmBlockStart,mark_AsmBlockEnd,
-        mark_InlineStart,mark_InlineEnd,mark_BlockStart,
+        mark_NoLineInfoStart,mark_NoLineInfoEnd,mark_BlockStart,
         mark_Position
       );
 

+ 2 - 2
compiler/aggas.pas

@@ -1161,9 +1161,9 @@ implementation
              end;
 
            ait_marker :
-             if tai_marker(hp).kind=mark_InlineStart then
+             if tai_marker(hp).kind=mark_NoLineInfoStart then
                inc(InlineLevel)
-             else if tai_marker(hp).kind=mark_InlineEnd then
+             else if tai_marker(hp).kind=mark_NoLineInfoEnd then
                dec(InlineLevel);
 
            ait_directive :

+ 18 - 5
compiler/dbgdwarf.pas

@@ -2866,7 +2866,8 @@ implementation
         diffline,
         prevline,
         prevfileidx,
-        currfileidx: Integer;
+        currfileidx,
+        nolineinfolevel : Integer;
         prevlabel,
         currlabel     : tasmlabel;
       begin
@@ -2880,6 +2881,7 @@ implementation
         prevline := 1;
         prevfileidx := 1;
         prevlabel := nil;
+        nolineinfolevel:=0;
         while assigned(hp) do
           begin
             case hp.typ of
@@ -2890,13 +2892,24 @@ implementation
                   currfuncname:=tai_function_name(hp).funcname;
                   asmline.concat(tai_comment.Create(strpnew('function: '+currfuncname^)));
                 end;
-              ait_force_line : begin
-                lastfileinfo.line:=-1;
-              end;
+              ait_force_line :
+                begin
+                  lastfileinfo.line:=-1;
+                end;
+              ait_marker :
+                begin
+                  case tai_marker(hp).kind of
+                    mark_NoLineInfoStart:
+                      inc(nolineinfolevel);
+                    mark_NoLineInfoEnd:
+                      dec(nolineinfolevel);
+                  end;
+                end;
             end;
 
             if (currsectype=sec_code) and
-               (hp.typ=ait_instruction) then
+               (hp.typ=ait_instruction) and
+               (nolineinfolevel=0) then
               begin
                 currfileinfo:=tailineinfo(hp).fileinfo;
                 { file changed ? (must be before line info) }

+ 2 - 2
compiler/i386/ag386nsm.pas

@@ -1010,9 +1010,9 @@ interface
              end;
 
            ait_marker :
-             if tai_marker(hp).kind=mark_InlineStart then
+             if tai_marker(hp).kind=mark_NoLineInfoStart then
                inc(InlineLevel)
-             else if tai_marker(hp).kind=mark_InlineEnd then
+             else if tai_marker(hp).kind=mark_NoLineInfoEnd then
                dec(InlineLevel);
 
            ait_directive :

+ 2 - 2
compiler/i386/daopt386.pas

@@ -1086,7 +1086,7 @@ begin
     oldp := p;
     if (p.typ in SkipInstr) or
        ((p.typ = ait_marker) and
-        (tai_Marker(p).Kind in [mark_AsmBlockEnd,mark_InlineStart,mark_InlineEnd])) then
+        (tai_Marker(p).Kind in [mark_AsmBlockEnd,mark_NoLineInfoStart,mark_NoLineInfoEnd])) then
       GetNextInstruction(p,p)
     else if ((p.Typ = Ait_Marker) and
         (tai_Marker(p).Kind = mark_NoPropInfoStart)) then
@@ -1143,7 +1143,7 @@ begin
            ((p.typ = ait_label) and
             labelCanBeSkipped(tai_label(p))) or
            ((p.typ = ait_marker) and
-            (tai_Marker(p).Kind in [mark_AsmBlockEnd,mark_InlineStart,mark_InlineEnd]))) do
+            (tai_Marker(p).Kind in [mark_AsmBlockEnd,mark_NoLineInfoStart,mark_NoLineInfoEnd]))) do
          p := tai(p.next);
     while assigned(p) and
           (p.typ=ait_RegAlloc) Do

+ 29 - 0
compiler/ncgflw.pas

@@ -1116,12 +1116,18 @@ implementation
          if codegenerror then
            goto errorexit;
 
+         { don't generate line info for internal cleanup }
+         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
+
          cg.a_label(current_asmdata.CurrAsmList,exceptlabel);
 
          free_exception(current_asmdata.CurrAsmList, excepttemps, 0, endexceptlabel, false);
 
          cg.a_label(current_asmdata.CurrAsmList,doexceptlabel);
 
+         { end cleanup }
+         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
+
          { set control flow labels for the except block }
          { and the on statements                        }
          current_procinfo.CurrExitLabel:=exitexceptlabel;
@@ -1136,6 +1142,9 @@ implementation
          if assigned(right) then
            secondpass(right);
 
+         { don't generate line info for internal cleanup }
+         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
+
          cg.a_label(current_asmdata.CurrAsmList,lastonlabel);
          { default handling except handling }
          if assigned(t1) then
@@ -1285,6 +1294,9 @@ implementation
          unget_exception_temps(current_asmdata.CurrAsmList,excepttemps);
          cg.a_label(current_asmdata.CurrAsmList,endexceptlabel);
 
+         { end cleanup }
+         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
+
        errorexit:
          { restore all saved labels }
          endexceptlabel:=oldendexceptlabel;
@@ -1389,6 +1401,10 @@ implementation
 
               secondpass(right);
            end;
+
+         { don't generate lineinfo for internal cleanup }
+         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
+
          current_asmdata.getjumplabel(doobjectdestroy);
          cg.a_label(current_asmdata.CurrAsmList,doobjectdestroyandreraise);
 
@@ -1458,6 +1474,7 @@ implementation
          cg.a_label(current_asmdata.CurrAsmList,nextonlabel);
          flowcontrol:=oldflowcontrol+(flowcontrol-[fc_inflowcontrol]);
          paraloc1.done;
+         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
 
          { next on node }
          if assigned(left) then
@@ -1531,10 +1548,16 @@ implementation
                 exit;
            end;
 
+         { don't generate line info for internal cleanup }
+         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
+
          cg.a_label(current_asmdata.CurrAsmList,finallylabel);
          { just free the frame information }
          free_exception(current_asmdata.CurrAsmList,excepttemps,1,finallylabel,true);
 
+         { end cleanup }
+         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
+
          { finally code }
          flowcontrol:=[fc_inflowcontrol];
          secondpass(right);
@@ -1545,6 +1568,9 @@ implementation
          if codegenerror then
            exit;
 
+         { don't generate line info for internal cleanup }
+         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
+
          { the value should now be in the exception handler }
          cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
          if implicitframe then
@@ -1637,6 +1663,9 @@ implementation
          unget_exception_temps(current_asmdata.CurrAsmList,excepttemps);
          cg.a_label(current_asmdata.CurrAsmList,endfinallylabel);
 
+         { end cleanup }
+         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
+
          current_procinfo.CurrExitLabel:=oldCurrExitLabel;
          if assigned(current_procinfo.CurrBreakLabel) then
           begin

+ 2 - 2
compiler/powerpc/agppcmpw.pas

@@ -1136,9 +1136,9 @@ interface
                 end;
               ait_marker :
                  begin
-                   if tai_marker(hp).kind=mark_InlineStart then
+                   if tai_marker(hp).kind=mark_NoLineInfoStart then
                      inc(InlineLevel)
-                   else if tai_marker(hp).kind=mark_InlineEnd then
+                   else if tai_marker(hp).kind=mark_NoLineInfoEnd then
                      dec(InlineLevel);
                  end;
          else

+ 2 - 2
compiler/x86/agx86int.pas

@@ -872,9 +872,9 @@ implementation
                end;
            ait_marker :
              begin
-               if tai_marker(hp).kind=mark_InlineStart then
+               if tai_marker(hp).kind=mark_NoLineInfoStart then
                  inc(InlineLevel)
-               else if tai_marker(hp).kind=mark_InlineEnd then
+               else if tai_marker(hp).kind=mark_NoLineInfoEnd then
                  dec(InlineLevel);
              end;