Browse Source

* try to fix recompilation on changes problems

pierre 23 years ago
parent
commit
fc70eac139
2 changed files with 35 additions and 10 deletions
  1. 18 7
      ide/fpcompil.pas
  2. 17 3
      ide/fpmrun.inc

+ 18 - 7
ide/fpcompil.pas

@@ -118,6 +118,7 @@ const
     CompilerMessageWindow : PCompilerMessageWindow  = nil;
     CompilerMessageWindow : PCompilerMessageWindow  = nil;
     CompilerStatusDialog  : PCompilerStatusDialog = nil;
     CompilerStatusDialog  : PCompilerStatusDialog = nil;
     CompileStamp          : longint = 0;
     CompileStamp          : longint = 0;
+    RestartingDebugger    : boolean = false;
 
 
 procedure DoCompile(Mode: TCompileMode);
 procedure DoCompile(Mode: TCompileMode);
 function  NeedRecompile(Mode :TCompileMode; verbose : boolean): boolean;
 function  NeedRecompile(Mode :TCompileMode; verbose : boolean): boolean;
@@ -792,10 +793,12 @@ begin
         FileName:=PrimaryFileMain
         FileName:=PrimaryFileMain
       else if assigned(P) then
       else if assigned(P) then
         begin
         begin
-            FileName:=P^.Editor^.FileName;
-            if FileName='' then
+          FileName:=P^.Editor^.FileName;
+          if FileName='' then
+            begin
               P^.Editor^.SaveAsk(true);
               P^.Editor^.SaveAsk(true);
-            FileName:=P^.Editor^.FileName;
+              FileName:=P^.Editor^.FileName;
+            end;
         end
         end
       else
       else
         FileName:='';
         FileName:='';
@@ -948,7 +951,6 @@ begin
             MustRestartDebugger:=true;
             MustRestartDebugger:=true;
           end;
           end;
 {$endif NODEBUG}
 {$endif NODEBUG}
-      LastCompileTime := cardinal(Now);
       FpIntF.Compile(FileName,SwitchesPath);
       FpIntF.Compile(FileName,SwitchesPath);
       SetStatus('Finished compiling...');
       SetStatus('Finished compiling...');
     end
     end
@@ -1049,7 +1051,10 @@ begin
 { Set end status }
 { Set end status }
   if not (CompilationPhase in [cpAborted,cpFailed]) then
   if not (CompilationPhase in [cpAborted,cpFailed]) then
     if (status.errorCount=0) then
     if (status.errorCount=0) then
-      CompilationPhase:=cpDone
+      begin
+        CompilationPhase:=cpDone;
+        LastCompileTime := cardinal(Now);
+      end
     else
     else
       CompilationPhase:=cpFailed;
       CompilationPhase:=cpFailed;
 { Show end status }
 { Show end status }
@@ -1060,12 +1065,15 @@ begin
       CompilerStatusDialog^.Update;
       CompilerStatusDialog^.Update;
       CompilerStatusDialog^.ReDraw;
       CompilerStatusDialog^.ReDraw;
       CompilerStatusDialog^.SetState(sfModal,false);
       CompilerStatusDialog^.SetState(sfModal,false);
-      if ((CompilationPhase in[cpAborted,cpDone,cpFailed]) or (ShowStatusOnError)) and (Mode<>cRun) then
+      if ((CompilationPhase in [cpAborted,cpDone,cpFailed]) or (ShowStatusOnError))
+        and ((Mode<>cRun) or (CompilationPhase<>cpDone)) then
        repeat
        repeat
          CompilerStatusDialog^.GetEvent(E);
          CompilerStatusDialog^.GetEvent(E);
          if IsExitEvent(E)=false then
          if IsExitEvent(E)=false then
           CompilerStatusDialog^.HandleEvent(E);
           CompilerStatusDialog^.HandleEvent(E);
        until IsExitEvent(E) or not assigned(CompilerStatusDialog);
        until IsExitEvent(E) or not assigned(CompilerStatusDialog);
+       {if IsExitEvent(E) then
+         Application^.PutEvent(E);}
       if assigned(CompilerStatusDialog) then
       if assigned(CompilerStatusDialog) then
         begin
         begin
           Application^.Delete(CompilerStatusDialog);
           Application^.Delete(CompilerStatusDialog);
@@ -1279,7 +1287,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.10  2002-09-04 14:07:12  pierre
+  Revision 1.11  2002-09-05 08:45:40  pierre
+   * try to fix recompilation on changes problems
+
+  Revision 1.10  2002/09/04 14:07:12  pierre
    + Enhance code complete by inserting unit symbols
    + Enhance code complete by inserting unit symbols
 
 
   Revision 1.9  2002/08/26 13:03:14  pierre
   Revision 1.9  2002/08/26 13:03:14  pierre

+ 17 - 3
ide/fpmrun.inc

@@ -49,6 +49,11 @@ begin
    begin
    begin
      if (MessageBox(#3+'You''ve edited a file, recompile the project?',nil,mfinformation+mfyesbutton+mfnobutton)=cmYes) then
      if (MessageBox(#3+'You''ve edited a file, recompile the project?',nil,mfinformation+mfyesbutton+mfnobutton)=cmYes) then
       begin
       begin
+        if Assigned(Debugger) then
+          begin
+            if Debugger^.IsRunning then
+              RestartingDebugger:=true;
+          end;
         DoResetDebugger;
         DoResetDebugger;
         DoRun;
         DoRun;
         AskRecompileIfModified:=true;
         AskRecompileIfModified:=true;
@@ -208,7 +213,7 @@ begin
 {$ifndef NODEBUG}
 {$ifndef NODEBUG}
       { we use debugger if and only if there are active breakpoints
       { we use debugger if and only if there are active breakpoints
         AND the target is correct for debugging !! PM }
         AND the target is correct for debugging !! PM }
-      if ActiveBreakpoints and
+      if (ActiveBreakpoints or RestartingDebugger) and
 {$ifdef COMPILER_1_0}
 {$ifdef COMPILER_1_0}
         (target_os.shortname=source_os.shortname)
         (target_os.shortname=source_os.shortname)
 {$else COMPILER_1_0}
 {$else COMPILER_1_0}
@@ -220,7 +225,13 @@ begin
             InitDebugger;
             InitDebugger;
           if assigned(Debugger) then
           if assigned(Debugger) then
             begin
             begin
-              Debugger^.Run;
+              if RestartingDebugger then
+                begin
+                  RestartingDebugger:=false;
+                  Debugger^.StartTrace;
+                end
+              else
+                Debugger^.Run;
               RunDirect:=false;
               RunDirect:=false;
             end;
             end;
         end;
         end;
@@ -472,7 +483,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2002-08-13 08:59:12  pierre
+  Revision 1.4  2002-09-05 08:45:59  pierre
+   * try to fix recompilation on changes problems
+
+  Revision 1.3  2002/08/13 08:59:12  pierre
    + Run menu changes depending on wether the debuggee is running or not
    + Run menu changes depending on wether the debuggee is running or not
 
 
   Revision 1.2  2001/11/07 00:28:53  pierre
   Revision 1.2  2001/11/07 00:28:53  pierre