IDE: debug launching application

git-svn-id: trunk@63588 -
This commit is contained in:
mattias 2020-07-17 08:58:15 +00:00
parent d5f62b9ccb
commit a028a923fa
4 changed files with 52 additions and 1 deletions

View File

@ -55,6 +55,7 @@ type
function GetTargetCPU: string; virtual; abstract;
function GetLCLWidgetType: string; virtual; abstract;
function GetRunCommandLine: string; virtual; abstract;
procedure WriteDebug_RunCommandLine; virtual; abstract;
function GetCompilerFilename: string; virtual; abstract;
function GetFPCompilerFilename: string; virtual; abstract;

View File

@ -200,6 +200,7 @@ type
function GetTargetCPU: string; override;
function GetLCLWidgetType: string; override;
function GetRunCommandLine: string; override;
procedure WriteDebug_RunCommandLine; override;
function GetCompilerFilename: string; override;
function GetFPCompilerFilename: string; override;
@ -646,6 +647,49 @@ begin
end;
end;
procedure TBuildManager.WriteDebug_RunCommandLine;
var
AMode: TRunParamsOptionsMode;
s, TargetFilename: String;
begin
s:='';
if Project1=nil then
begin
debugln(['Note: (lazarus) [TBuildManager.WriteDebug_RunCommandLine] Project1=nil RunCmdLine=[',GetRunCommandLine,']']);
end else begin
AMode := Project1.RunParameterOptions.GetActiveMode;
if AMode<>nil then
debugln(['Note: (lazarus) [TBuildManager.WriteDebug_RunCommandLine] AMode="',AMode.Name,'" AMode.WorkingDirectory=[',AMode.WorkingDirectory,']'])
else
debugln(['Note: (lazarus) [TBuildManager.WriteDebug_RunCommandLine] AMode=nil']);
if (AMode<>nil) and AMode.UseLaunchingApplication then
begin
s := AMode.LaunchingApplicationPathPlusParams;
debugln(['Note: (lazarus) [TBuildManager.WriteDebug_RunCommandLine] LaunchingApplicationPathPlusParams=[',s,']']);
end;
if s='' then
begin
// no launching app
debugln(['Note: (lazarus) [TBuildManager.WriteDebug_RunCommandLine] no LaunchingApplication']);
if (AMode<>nil) then
begin
s := AMode.CmdLineParams;
if s<>'' then
debugln(['Note: (lazarus) [TBuildManager.WriteDebug_RunCommandLine] AMode.CmdLineParams=[',s,']']);
end;
TargetFilename := GetTargetFilename;
if (TargetFilename <> '')
and (TargetFilename[Length(TargetFilename)] in AllowDirectorySeparators) then
TargetFilename += ExtractFileNameOnly(
Project1.CompilerOptions.GetDefaultMainSourceFileName);
debugln(['Note: (lazarus) [TBuildManager.WriteDebug_RunCommandLine] TargetFilename=[',TargetFilename,']']);
end;
debugln(['Note: (lazarus) [TBuildManager.WriteDebug_RunCommandLine] Project1<>nil RunCmdLine=[',GetRunCommandLine,']']);
end;
end;
function TBuildManager.GetCompilerFilename: string;
var
Opts: TProjectCompilerOptions;

View File

@ -2361,7 +2361,8 @@ begin
begin
if not PromptOnError then
ClearPathAndExe
else
else begin
BuildBoss.WriteDebug_RunCommandLine;
if IDEMessageDialog(lisLaunchingApplicationInvalid,
Format(lisTheLaunchingApplicationBundleDoesNotExists,
[LaunchingApplication, LineEnding, LineEnding, LineEnding+LineEnding]),
@ -2371,6 +2372,7 @@ begin
end
else
Exit;
end;
end;
if (NewDebuggerClass = TProcessDebugger) and (LaunchingApplication <> '') then
@ -2382,6 +2384,7 @@ begin
else
if not FileIsExecutable(LaunchingApplication)
then begin
BuildBoss.WriteDebug_RunCommandLine;
if not PromptOnError then
ClearPathAndExe
else begin
@ -2400,6 +2403,7 @@ begin
if not PromptOnError then
ClearPathAndExe
else begin
debugln(['Info: (lazarus) [TDebugManager.GetLaunchPathAndExe] EnvironmentOptions.DebuggerFilename="',EnvironmentOptions.DebuggerFilename,'"']);
IDEMessageDialog(lisDebuggerInvalid,
Format(lisTheDebuggerDoesNotExistsOrIsNotExecutableSeeEnviro,
[EnvironmentOptions.DebuggerFilename(Project1), LineEnding, LineEnding+LineEnding]),

View File

@ -7461,6 +7461,7 @@ begin
Process.Executable := '/usr/bin/open';
end else if not FileIsExecutable(Process.Executable) then
begin
MainBuildBoss.WriteDebug_RunCommandLine;
if (ARunMode<>nil) and ARunMode.UseLaunchingApplication then
IDEMessageDialog(lisLaunchingApplicationInvalid,
Format(lisTheLaunchingApplicationDoesNotExistsOrIsNotExecuta,
@ -7475,6 +7476,7 @@ begin
if not DirectoryExists(Process.CurrentDirectory) then
begin
MainBuildBoss.WriteDebug_RunCommandLine;
IDEMessageDialog(lisUnableToRun,
Format(lisTheWorkingDirectoryDoesNotExistPleaseCheckTheWorki,
[Process.CurrentDirectory, LineEnding]),