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 GetTargetCPU: string; virtual; abstract;
function GetLCLWidgetType: string; virtual; abstract; function GetLCLWidgetType: string; virtual; abstract;
function GetRunCommandLine: string; virtual; abstract; function GetRunCommandLine: string; virtual; abstract;
procedure WriteDebug_RunCommandLine; virtual; abstract;
function GetCompilerFilename: string; virtual; abstract; function GetCompilerFilename: string; virtual; abstract;
function GetFPCompilerFilename: string; virtual; abstract; function GetFPCompilerFilename: string; virtual; abstract;

View File

@ -200,6 +200,7 @@ type
function GetTargetCPU: string; override; function GetTargetCPU: string; override;
function GetLCLWidgetType: string; override; function GetLCLWidgetType: string; override;
function GetRunCommandLine: string; override; function GetRunCommandLine: string; override;
procedure WriteDebug_RunCommandLine; override;
function GetCompilerFilename: string; override; function GetCompilerFilename: string; override;
function GetFPCompilerFilename: string; override; function GetFPCompilerFilename: string; override;
@ -646,6 +647,49 @@ begin
end; end;
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; function TBuildManager.GetCompilerFilename: string;
var var
Opts: TProjectCompilerOptions; Opts: TProjectCompilerOptions;

View File

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

View File

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