Browse Source

+ Also look for gdb if gdbpas is not found.
+ AdaptToGDB procedure to convert filenames with dirtectories
to the format GDB expects.

git-svn-id: trunk@17853 -

pierre 14 years ago
parent
commit
b78e0db500
1 changed files with 18 additions and 0 deletions
  1. 18 0
      compiler/utils/gppc386.pp

+ 18 - 0
compiler/utils/gppc386.pp

@@ -44,12 +44,14 @@ uses
 const
 const
 {$ifdef Unix}
 {$ifdef Unix}
   GDBExeName : String = 'gdbpas';
   GDBExeName : String = 'gdbpas';
+  GDBAltExeName = 'gdb';
   GDBIniName = '.gdbinit';
   GDBIniName = '.gdbinit';
   DefaultCompilerName = 'ppc386';
   DefaultCompilerName = 'ppc386';
   PathSep=':';
   PathSep=':';
   DirSep = '/';
   DirSep = '/';
 {$else}
 {$else}
   GDBExeName : String = 'gdbpas.exe';
   GDBExeName : String = 'gdbpas.exe';
+  GDBAltExeName = 'gdb.exe';
   GDBIniName = 'gdb.ini';
   GDBIniName = 'gdb.ini';
   DefaultCompilerName = 'ppc386.exe';
   DefaultCompilerName = 'ppc386.exe';
   PathSep=';';
   PathSep=';';
@@ -62,6 +64,17 @@ const
   FpcGDBIniName = 'gdb.fpc';
   FpcGDBIniName = 'gdb.fpc';
   GDBIniTempName : string = 'gdb4fpc.ini';
   GDBIniTempName : string = 'gdb4fpc.ini';
 
 
+
+{ Dos/Windows GDB still need forward slashes }
+procedure AdaptToGDB(var filename : string);
+var
+  i : longint;
+begin
+  for i:=1 to length(filename) do
+    if filename[i]='\' then
+      filename[i]:='/';
+end;
+
 var
 var
    fpcgdbini : text;
    fpcgdbini : text;
    CompilerName,Dir,Name,Ext : String;
    CompilerName,Dir,Name,Ext : String;
@@ -144,6 +157,11 @@ begin
   {$endif}
   {$endif}
 
 
   GDBExeName:=fsearch(GDBExeName,Dir+PathSep+GetEnv('PATH'));
   GDBExeName:=fsearch(GDBExeName,Dir+PathSep+GetEnv('PATH'));
+  if GDBExeName='' then
+    GDBExeName:=fsearch(GDBAltExeName,Dir+PathSep+GetEnv('PATH'));
+
+  AdaptToGDB(CompilerName);
+  AdaptToGDB(GDBIniTempName);
   {$ifdef EXTDEBUG}
   {$ifdef EXTDEBUG}
   Writeln(stderr,'Starting ',GDBExeName,
   Writeln(stderr,'Starting ',GDBExeName,
 {$ifdef win32}
 {$ifdef win32}