Browse Source

* CrtlF9 starts debugger if there are active breakpoints

pierre 25 years ago
parent
commit
11572b7343
2 changed files with 45 additions and 2 deletions
  1. 22 1
      ide/text/fpdebug.pas
  2. 23 1
      ide/text/fpmrun.inc

+ 22 - 1
ide/text/fpdebug.pas

@@ -299,6 +299,7 @@ const
 
   procedure InitRegistersWindow;
   procedure DoneRegistersWindow;
+  function  ActiveBreakpoints : boolean;
 
 
 const
@@ -511,6 +512,23 @@ begin
    BreakpointsCollection^.ForEach(@DoResetVal);
 end;
 
+function  ActiveBreakpoints : boolean;
+  var
+    IsActive : boolean;
+
+  procedure TestActive(PB : PBreakpoint);
+    begin
+        If PB^.state=bs_enabled then
+          IsActive:=true;
+    end;
+begin
+   IsActive:=false;
+   If assigned(BreakpointsCollection) then
+     BreakpointsCollection^.ForEach(@TestActive);
+   ActiveBreakpoints:=IsActive;
+end;
+
+
 destructor TDebugController.Done;
 begin
   { kill the program if running }
@@ -3000,7 +3018,10 @@ end.
 
 {
   $Log$
-  Revision 1.44  2000-01-27 22:30:38  florian
+  Revision 1.45  2000-01-28 22:38:21  pierre
+   * CrtlF9 starts debugger if there are active breakpoints
+
+  Revision 1.44  2000/01/27 22:30:38  florian
     * start of FPU window
     * current executed line color has a higher priority then a breakpoint now
 

+ 23 - 1
ide/text/fpmrun.inc

@@ -90,6 +90,8 @@ begin
 end;
 
 procedure TIDEApp.DoRun;
+var
+  RunDirect : boolean;
 begin
 
 {$ifndef NODEBUG}
@@ -111,6 +113,23 @@ begin
           ErrorBox('Invalid filename %s',@MsgParms);
           Exit;
         end;
+      RunDirect:=true;
+{$ifndef NODEBUG}
+      { we use debugger if and only if there are active breakpoints
+        AND the target is correct for debugging !! PM }
+      if ActiveBreakpoints and (target_os.shortname=source_os.shortname) then
+        begin
+          if not assigned(Debugger) then
+            InitDebugger;
+          if assigned(Debugger) then
+            begin
+              Debugger^.StartTrace;
+              RunDirect:=false;
+            end;
+        end;
+{$endif ndef NODEBUG}
+      if Not RunDirect then
+        exit;
       DoExecute(ExeFile,GetRunParameters,'','',exNormal);
       LastExitCode:=ExecuteResult;
       If IOStatus<>0 then
@@ -245,7 +264,10 @@ end;
 
 {
   $Log$
-  Revision 1.24  2000-01-10 13:23:28  pierre
+  Revision 1.25  2000-01-28 22:38:21  pierre
+   * CrtlF9 starts debugger if there are active breakpoints
+
+  Revision 1.24  2000/01/10 13:23:28  pierre
    * Debugger test missing in ContTo
 
   Revision 1.23  1999/12/10 13:01:01  pierre