2
0
pierre 23 жил өмнө
parent
commit
43d0fa7bf5

+ 45 - 10
packages/gdbint/gdbint.pp

@@ -24,7 +24,22 @@ interface
 {$define NotImplemented}
 
 
+{ Default version for GDB 5 is 5.01 for now PM }
+
+{$ifdef GDB_V5}
+  {$ifndef GDB_V500}
+    {$define GDB_V501}
+  {$endif ndef GDB_V500}
+{$endif def GDB_V5}
+
+{$ifdef GDB_V502}
+  {$define GDB_V501}
+  {$define GDB_USES_PTID}
+  {$define GDB_V5}
+{$endif GDB_V502}
+
 {$ifdef GDB_V501}
+  {$define GDB_USES_PTID}
   {$define GDB_V5}
 {$endif GDB_V501}
 
@@ -263,6 +278,27 @@ type
 
 {$endif GDB_V5}
 
+{$ifdef GDB_USES_PTID}
+  type
+
+  (* struct ptid
+  {
+    /* Process id */
+    int pid;
+
+    /* Lightweight process id */
+    long lwp;
+
+    /* Thread id */
+    long tid;
+  }; *)
+   pinferior_ptid = ^tinferior_ptid;
+   tinferior_ptid = record
+      pid : longint{C int};
+      lwp : longint{ C long};
+      tid : longint{ C long};
+     end;
+{$endif}
 
 {$ifdef win32}
 
@@ -383,8 +419,8 @@ const
   use_gdb_file : boolean = false;
 var
   gdb_file : text;
-{$ifdef GDB_V501}
-  inferior_ptid : longint;cvar;external;
+{$ifdef GDB_USES_PTID}
+  inferior_ptid : tinferior_ptid;cvar;external;
 {$else}
   inferior_pid : longint;cvar;external;
 {$endif}
@@ -395,7 +431,7 @@ var
   procedure reload_fs;
 {$endif go32v2}
 
-{$ifdef GDB_V501}
+{$ifdef GDB_USES_PTID}
 function inferior_pid : longint;
 {$endif}
 
@@ -1371,11 +1407,7 @@ begin
 {$endif go32v2}
      DebuggerScreen;
      current_pc:=stop_pc;
-{$ifdef GDB_V501}
-     Debuggee_started:=inferior_ptid<>0;
-{$else}
      Debuggee_started:=inferior_pid<>0;
-{$endif}
      if not Debuggee_started then exit;
      if reset_command then exit;
       sym:=find_pc_line(stop_pc,0);
@@ -1387,10 +1419,10 @@ begin
    end;
 end;
 
-{$ifdef GDB_V501}
+{$ifdef GDB_USES_PTID}
 function inferior_pid : longint;
 begin
-  inferior_pid:=inferior_ptid{.pid};
+  inferior_pid:=inferior_ptid.pid;
 end;
 {$endif}
 
@@ -2480,7 +2512,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.10  2002-01-07 10:31:57  pierre
+  Revision 1.11  2002-01-24 09:14:39  pierre
+   * adapt to GDB 5.1
+
+  Revision 1.10  2002/01/07 10:31:57  pierre
    * avoid problem if gdb start generates output
 
   Revision 1.9  2001/09/19 15:25:56  pierre

+ 11 - 4
packages/gdbint/gdbver.pp

@@ -17,6 +17,10 @@ const
 {$else not unix}
   ver_name = '_version';
 {$endif}
+  { This variable should be change with
+    change in GDB CVS PM }
+  Current_cvs_version : longint = 502;
+
 var
   v5_version : array[0..0] of char;external name ver_name;
   v4_version : pchar;external name ver_name;
@@ -34,12 +38,12 @@ begin
         Writeln('GDB version is ',pchar(@v5_version));
       version_number:=ord(version[0])-ord('0');
     end
-  else if (version[0]='2') and (version[1]='0') and 
+  else if (version[0]='2') and (version[1]='0') and
           (version[2] in ['0'..'9']) and (version[3] in ['0'..'9']) then
     begin
       { CVS version from 2000 to 2099,
-        assume version 5.01 PM } 
-      version_number:=501;
+        assume current_cvs_version  PM }
+      version_number:=Current_cvs_version;
     end
   else
     begin
@@ -55,7 +59,10 @@ end.
 
 {
   $Log$
-  Revision 1.3  2001-09-11 10:22:09  pierre
+  Revision 1.4  2002-01-24 09:14:40  pierre
+   * adapt to GDB 5.1
+
+  Revision 1.3  2001/09/11 10:22:09  pierre
    * Hack to allow to recognize CVS version as 5.01
 
   Revision 1.2  2001/04/08 11:44:01  peter