Browse Source

valgrind args must be passed before compiler executable

Pierre Muller 1 month ago
parent
commit
e255eda4f5
1 changed files with 5 additions and 3 deletions
  1. 5 3
      compiler/utils/vppcx64.pp

+ 5 - 3
compiler/utils/vppcx64.pp

@@ -69,6 +69,7 @@ begin
 end;
 end;
 
 
 var
 var
+   valgrind_args,
    all_args : String;
    all_args : String;
    ValGrindExeName : String;
    ValGrindExeName : String;
    CompilerName : String;
    CompilerName : String;
@@ -83,6 +84,7 @@ var
 
 
 begin
 begin
   all_args:='';
   all_args:='';
+  valgrind_args:='';
   if FileExists('.'+DirSep+FpcValgrindIniName) then
   if FileExists('.'+DirSep+FpcValgrindIniName) then
     begin
     begin
       Assign(F,'.'+DirSep+FpcValgrindIniName);
       Assign(F,'.'+DirSep+FpcValgrindIniName);
@@ -90,7 +92,7 @@ begin
       while not eof(F) do
       while not eof(F) do
         begin
         begin
           readln(f,line);
           readln(f,line);
-	  all_args:=all_args+' '+line;
+	  valgrind_args:=valgrind_args+' '+line;
 	end;
 	end;
       Close(F);
       Close(F);
     end;
     end;
@@ -155,10 +157,10 @@ begin
     end;
     end;
   AdaptToValgrind(FullCompilerName);
   AdaptToValgrind(FullCompilerName);
   {$ifdef EXTDEBUG}
   {$ifdef EXTDEBUG}
-  Writeln(stderr,'Starting ',ValgrindExeName+' '+FullCompilerName+all_args);
+  Writeln(stderr,'Starting ',ValgrindExeName+' '+valgrind_args+' '+FullCompilerName+all_args);
   flush(stderr);
   flush(stderr);
   {$endif}
   {$endif}
-  ValgrindExitCode:=ExecuteProcess(ValgrindExeName,FullCompilerName+all_args);
+  ValgrindExitCode:=ExecuteProcess(ValgrindExeName,valgrind_args+' '+FullCompilerName+all_args);
   if (ValgrindExitCode<>0) then
   if (ValgrindExitCode<>0) then
     begin
     begin
       Writeln('Error running Valgrind');
       Writeln('Error running Valgrind');