pierre 25 anos atrás
pai
commit
705b7cb752
5 arquivos alterados com 109 adições e 19 exclusões
  1. 40 12
      ide/text/fpdebug.pas
  2. 35 1
      ide/text/fpswitch.pas
  3. 1 1
      ide/text/globdir.inc
  4. 15 2
      ide/text/readme.txt
  5. 18 3
      ide/text/test.pas

+ 40 - 12
ide/text/fpdebug.pas

@@ -340,7 +340,7 @@ uses
   Dos,Mouse,Video,
   Dos,Mouse,Video,
   App,Commands,Strings,
   App,Commands,Strings,
   Systems,
   Systems,
-  FPVars,FPUtils,FPConst,
+  FPVars,FPUtils,FPConst,FPSwitch,
   FPIntf,FPCompile,FPIde,FPHelp,
   FPIntf,FPCompile,FPIde,FPHelp,
   Validate,WEditor,WUtils;
   Validate,WEditor,WUtils;
 
 
@@ -1860,6 +1860,15 @@ procedure TWatch.Get_new_value;
       p:=StrNew(Debugger^.GetOutput);
       p:=StrNew(Debugger^.GetOutput);
     { do not open a messagebox for such errors }
     { do not open a messagebox for such errors }
     Debugger^.got_error:=false;
     Debugger^.got_error:=false;
+
+    { We should try here to find the expr in parent
+      procedure if there are
+      I will implement this as I added a
+      parent_ebp pseudo local var to local procedure
+      in stabs debug info PM }
+    { But there are some pitfalls like
+      locals redefined in other sublocals that call the function }
+
     q:=nil;
     q:=nil;
     if assigned(p) and (p[0]='$') then
     if assigned(p) and (p[0]='$') then
       q:=StrPos(p,'=');
       q:=StrPos(p,'=');
@@ -2831,7 +2840,7 @@ end;
       Debugger^.Command('backtrace');
       Debugger^.Command('backtrace');
       { generate list }
       { generate list }
       { all is in tframeentry }
       { all is in tframeentry }
-      for i:=Debugger^.frame_count-1 downto 0 do
+      for i:=0 to Debugger^.frame_count-1 do
         begin
         begin
           with Debugger^.frames[i]^ do
           with Debugger^.frames[i]^ do
             begin
             begin
@@ -2859,7 +2868,7 @@ end;
       { select frame for watches }
       { select frame for watches }
       If not assigned(Debugger) then
       If not assigned(Debugger) then
         exit;
         exit;
-    {$ifdef NODEBUG}
+    {$ifndef NODEBUG}
       Debugger^.Command('f '+IntToStr(Focused));
       Debugger^.Command('f '+IntToStr(Focused));
       { for local vars }
       { for local vars }
       Debugger^.ReadWatches;
       Debugger^.ReadWatches;
@@ -2948,9 +2957,11 @@ procedure InitDebugger;
 var s : string;
 var s : string;
     i,p : longint;
     i,p : longint;
 {$endif DEBUG}
 {$endif DEBUG}
+var
+   cm : longint;
+
 begin
 begin
 {$ifdef DEBUG}
 {$ifdef DEBUG}
-  PushStatus('Starting debugger');
   Assign(gdb_file,GDBOutFileName);
   Assign(gdb_file,GDBOutFileName);
   {$I-}
   {$I-}
   Rewrite(gdb_file);
   Rewrite(gdb_file);
@@ -2973,7 +2984,24 @@ begin
     Use_gdb_file:=true;
     Use_gdb_file:=true;
   {$I+}
   {$I+}
 {$endif}
 {$endif}
-  if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) then
+
+  if TargetSwitches^.GetCurrSelParam<>source_os.shortname then
+    begin
+     cm:=ConfirmBox(#3'Sorry, can not debug'#13#3'programs compiled for'
+       +TargetSwitches^.GetCurrSelParam+'.'#13#3
+       +'Change target to'
+       +source_os.shortname+'?',nil,true);
+     if cm=cmCancel then
+       Exit;
+     if cm=cmYes then
+       begin
+         { force recompilation }
+         PrevMainFile:='';
+         TargetSwitches^.SetCurrSelParam(source_os.shortname);
+       end;
+    end;
+  if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) or
+     (PrevMainFile<>MainFile) then
     DoCompile(cRun);
     DoCompile(cRun);
   if CompilationPhase<>cpDone then
   if CompilationPhase<>cpDone then
     Exit;
     Exit;
@@ -2982,12 +3010,9 @@ begin
      ErrorBox('Oooops, nothing to debug.',nil);
      ErrorBox('Oooops, nothing to debug.',nil);
      Exit;
      Exit;
    end;
    end;
-  if target_os.shortname<>source_os.shortname then
-    begin
-     ErrorBox(#3'Sorry, I can only debug'#13#3'programs compiled for '#13#3
-       +source_os.shortname,nil);
-     Exit;
-    end;
+{$ifdef DEBUG}
+  PushStatus('Starting debugger');
+{$endif DEBUG}
 { init debugcontroller }
 { init debugcontroller }
   if assigned(Debugger) then
   if assigned(Debugger) then
    dispose(Debugger,Done);
    dispose(Debugger,Done);
@@ -3119,7 +3144,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.47  2000-02-04 00:10:58  pierre
+  Revision 1.48  2000-02-04 14:34:46  pierre
+  readme.txt
+
+  Revision 1.47  2000/02/04 00:10:58  pierre
    * Breakpoint line in Source Window better handled
    * Breakpoint line in Source Window better handled
 
 
   Revision 1.46  2000/02/01 10:59:58  pierre
   Revision 1.46  2000/02/01 10:59:58  pierre

+ 35 - 1
ide/text/fpswitch.pas

@@ -89,10 +89,12 @@ type
       procedure AddLongintItem(const name,param:string);
       procedure AddLongintItem(const name,param:string);
       procedure AddStringItem(const name,param:string;mult:boolean);
       procedure AddStringItem(const name,param:string;mult:boolean);
       function  GetCurrSel:integer;
       function  GetCurrSel:integer;
+      function  GetCurrSelParam : String;
       function  GetBooleanItem(index:integer):boolean;
       function  GetBooleanItem(index:integer):boolean;
       function  GetLongintItem(index:integer):longint;
       function  GetLongintItem(index:integer):longint;
       function  GetStringItem(index:integer):string;
       function  GetStringItem(index:integer):string;
       procedure SetCurrSel(index:integer);
       procedure SetCurrSel(index:integer);
+      function  SetCurrSelParam(const s : String) : boolean;
       procedure SetBooleanItem(index:integer;b:boolean);
       procedure SetBooleanItem(index:integer;b:boolean);
       procedure SetLongintItem(index:integer;l:longint);
       procedure SetLongintItem(index:integer;l:longint);
       procedure SetStringItem(index:integer;const s:string);
       procedure SetStringItem(index:integer;const s:string);
@@ -440,12 +442,41 @@ begin
 end;
 end;
 
 
 
 
+function  TSwitches.GetCurrSelParam : String;
+begin
+  if IsSel then
+    GetCurrSelParam:=PSwitchItem(Items^.At(SelNr[SwitchesMode]))^.Param
+  else
+    GetCurrSelParam:='';
+end;
+
 procedure TSwitches.SetCurrSel(index:integer);
 procedure TSwitches.SetCurrSel(index:integer);
 begin
 begin
   if IsSel then
   if IsSel then
    SelNr[SwitchesMode]:=index;
    SelNr[SwitchesMode]:=index;
 end;
 end;
 
 
+function  TSwitches.SetCurrSelParam(const s : String) : boolean;
+  function checkitem(P:PSwitchItem):boolean;{$ifndef FPC}far;{$endif}
+  begin
+    { empty items are not equivalent to others !! }
+    CheckItem:=((S='') and (P^.Param='')) or
+               ((Length(S)>0) and (P^.Param=s));
+  end;
+
+var
+  FoundP : PSwitchItem;
+begin
+  FoundP:=Items^.FirstThat(@CheckItem);
+  if Assigned(FoundP) then
+    begin
+      SetCurrSelParam:=true;
+      SelNr[SwitchesMode]:=Items^.IndexOf(FoundP);
+    end
+  else
+    SetCurrSelParam:=false;
+end;
+
 
 
 procedure TSwitches.WriteItemsCfg;
 procedure TSwitches.WriteItemsCfg;
 var
 var
@@ -905,7 +936,10 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2000-02-04 00:05:20  pierre
+  Revision 1.17  2000-02-04 14:34:47  pierre
+  readme.txt
+
+  Revision 1.16  2000/02/04 00:05:20  pierre
    * -Fi must also be used for GetSourceDirectories
    * -Fi must also be used for GetSourceDirectories
 
 
   Revision 1.15  2000/01/10 15:52:53  pierre
   Revision 1.15  2000/01/10 15:52:53  pierre

+ 1 - 1
ide/text/globdir.inc

@@ -78,4 +78,4 @@
 {$define Undo}
 {$define Undo}
 {$ifdef DEBUG}
 {$ifdef DEBUG}
   {$define DebugUndo}
   {$define DebugUndo}
-{$endif DEBUG}
+{$endif DEBUG}

+ 15 - 2
ide/text/readme.txt

@@ -4,8 +4,21 @@ This file is just a log of important changes
 starting 1999/10/29
 starting 1999/10/29
 
 
 
 
-1999/10/29 :
+2000/01/28:
+   + Partial Syntax released:
+     this allows to open highlighted files faster.
+     The highlighting is only computed up to the current editor position
+     and is continued in the Idle loop as a background process
+     (it not a real separate process).
+
+2000/01/10:
+   + working register window
+
+1999/11/10:
+   + Grouped action started for Undo.
+     Undo of Copy/Cut/Paste or Clear should work.
+
+1999/10/29:
   Undo/Redo stuff added to normal compilation
   Undo/Redo stuff added to normal compilation
   this is still buggy !!!
   this is still buggy !!!
   Any use of Copy/Cut/Paste or Clear will generate wrong Undo
   Any use of Copy/Cut/Paste or Clear will generate wrong Undo
-  We will t

+ 18 - 3
ide/text/test.pas

@@ -1,5 +1,7 @@
-program TestProgram;
+{$mode objfpc}
+{$R-}
 
 
+program TestProgram;
 
 
 uses
 uses
 {$ifdef go32v2}
 {$ifdef go32v2}
@@ -114,6 +116,8 @@ end;
 
 
 function Func1(x,z : word; var y : boolean; const r: TRecord): shortint;
 function Func1(x,z : word; var y : boolean; const r: TRecord): shortint;
 
 
+var loc : string;
+
   procedure test_local(c,f : longint);
   procedure test_local(c,f : longint);
    var
    var
       int_loc : longint;
       int_loc : longint;
@@ -121,9 +125,18 @@ function Func1(x,z : word; var y : boolean; const r: TRecord): shortint;
       Writeln('dummy for browser');
       Writeln('dummy for browser');
    end;
    end;
 
 
+  procedure indirect_call;
+   var
+     loc : longint;
+   begin
+     loc:=1;
+     test_local(5,7);
+   end;
 begin
 begin
+  loc:='This is a string';
   if Hello=0 then X:=0 else X:=1;
   if Hello=0 then X:=0 else X:=1;
   test_local(0,2);
   test_local(0,2);
+  indirect_call;
   Func1:=X;
   Func1:=X;
 end;
 end;
 
 
@@ -140,5 +153,7 @@ BEGIN
   new(X);
   new(X);
   X^.next:=X;
   X^.next:=X;
   dispose(X);
   dispose(X);
-  Halt;
-END.
+ { for i:=1 to 99 do
+    Writeln('Line ',i); }
+  Halt(4);
+END.