IDE: debug messages on run/save project failures

git-svn-id: trunk@60721 -
This commit is contained in:
mattias 2019-03-19 21:31:34 +00:00
parent fac4d989d7
commit d8c53e3eb0
3 changed files with 66 additions and 18 deletions

View File

@ -6884,7 +6884,10 @@ begin
Result:=IDEQuestionDialog(lisInvalidFileName, Result:=IDEQuestionDialog(lisInvalidFileName,
lisTheTargetFileNameIsADirectory, lisTheTargetFileNameIsADirectory,
mtWarning, [mrCancel,mrIgnore]); mtWarning, [mrCancel,mrIgnore]);
if Result<>mrIgnore then exit(mrCancel); if Result<>mrIgnore then begin
debugln(['Error: (lazarus) [TMainIDE.DoBuildProject] invalid TargetExeName="',TargetExeName,'"']);
exit(mrCancel);
end;
end; end;
// create application bundle // create application bundle
@ -6984,6 +6987,8 @@ begin
DoCheckFilesOnDisk; DoCheckFilesOnDisk;
end; end;
IDEWindowCreators.ShowForm(MessagesView,EnvironmentOptions.MsgViewFocus); IDEWindowCreators.ShowForm(MessagesView,EnvironmentOptions.MsgViewFocus);
if ConsoleVerbosity>=0 then
debugln(['Info: (lazarus) [TMainIDE.DoBuildProject] Success']);
Result:=mrOk; Result:=mrOk;
end; end;
@ -7137,17 +7142,20 @@ begin
// Build project first // Build project first
if ConsoleVerbosity>0 then if ConsoleVerbosity>0 then
debugln('Hint: (lazarus) TMainIDE.DoInitProjectRun Check build ...'); debugln('Hint: (lazarus) [TMainIDE.DoInitProjectRun] Check build ...');
if DoBuildProject(crRun,[]) <> mrOk then if DoBuildProject(crRun,[]) <> mrOk then begin
debugln(['Info: (lazarus) [TMainIDE.DoInitProjectRun] DoBuildProject failed']);
Exit; Exit;
end;
// Check project build // Check project build
ProgramFilename := MainBuildBoss.GetProjectTargetFilename(Project1); ProgramFilename := MainBuildBoss.GetProjectTargetFilename(Project1);
if ConsoleVerbosity>0 then if ConsoleVerbosity>0 then
DebugLn(['Hint: (lazarus) TMainIDE.DoInitProjectRun ProgramFilename=',ProgramFilename]); DebugLn(['Hint: (lazarus) [TMainIDE.DoInitProjectRun] ProgramFilename=',ProgramFilename]);
if ((DebugClass = nil) or DebugClass.RequiresLocalExecutable) if ((DebugClass = nil) or DebugClass.RequiresLocalExecutable)
and not FileExistsUTF8(ProgramFilename) and not FileExistsUTF8(ProgramFilename)
then begin then begin
debugln(['Info: (lazarus) [TMainIDE.DoInitProjectRun] File TargetFile found: "',ProgramFilename,'"']);
IDEMessageDialog(lisFileNotFound, IDEMessageDialog(lisFileNotFound,
Format(lisNoProgramFileSFound, [ProgramFilename]), Format(lisNoProgramFileSFound, [ProgramFilename]),
mtError,[mbCancel]); mtError,[mbCancel]);
@ -7155,8 +7163,13 @@ begin
end; end;
// Setup debugger // Setup debugger
if not DebugBoss.InitDebugger then Exit; if not DebugBoss.InitDebugger then begin
debugln(['Info: (lazarus) [TMainIDE.DoInitProjectRun] DebugBoss.InitDebugger failed']);
Exit;
end;
if ConsoleVerbosity>0 then
debugln(['Info: (lazarus) [TMainIDE.DoInitProjectRun] Success']);
Result := mrOK; Result := mrOK;
ToolStatus := itDebugger; ToolStatus := itDebugger;
end; end;
@ -7177,7 +7190,11 @@ begin
Handled:=false; Handled:=false;
Result:=DoCallRunDebug(Handled); Result:=DoCallRunDebug(Handled);
if Handled then exit; if Handled then begin
if Result<>mrOk then
ToolStatus:=itNone;
exit;
end;
Result := DebugBoss.StartDebugging; Result := DebugBoss.StartDebugging;

View File

@ -3435,9 +3435,10 @@ begin
end else begin end else begin
WriteLPS:=WriteLPI or SomeSessionModified or (not FileExistsUTF8(SessFilename)); WriteLPS:=WriteLPI or SomeSessionModified or (not FileExistsUTF8(SessFilename));
end; end;
//debugln(['TProject.WriteProject WriteLPI=',WriteLPI,' WriteLPS=',WriteLPS]);
if not (WriteLPI or WriteLPS) then exit(mrOk); if not (WriteLPI or WriteLPS) then exit(mrOk);
end; end;
//debugln(['TProject.WriteProject WriteLPI=',WriteLPI,' WriteLPS=',WriteLPS,' Modifed=',Modified,' SessionModified=',SessionModified]); //debugln(['TProject.WriteProject WriteLPI=',WriteLPI,' WriteLPS=',WriteLPS,' Modified=',Modified,' SessionModified=',SessionModified]);
// increase usage counters // increase usage counters
UpdateUsageCounts(CfgFilename); UpdateUsageCounts(CfgFilename);

View File

@ -3940,17 +3940,25 @@ begin
SaveEditorChangesToCodeCache(nil); SaveEditorChangesToCodeCache(nil);
//DebugLn('SaveProject A SaveAs=',dbgs(sfSaveAs in Flags),' SaveToTestDir=',dbgs(sfSaveToTestDir in Flags),' ProjectInfoFile=',Project1.ProjectInfoFile); //DebugLn('SaveProject A SaveAs=',dbgs(sfSaveAs in Flags),' SaveToTestDir=',dbgs(sfSaveToTestDir in Flags),' ProjectInfoFile=',Project1.ProjectInfoFile);
Result:=MainIDE.DoCheckFilesOnDisk(true); Result:=MainIDE.DoCheckFilesOnDisk(true);
if Result in [mrCancel,mrAbort] then exit; if Result in [mrCancel,mrAbort] then begin
debugln(['Info: (lazarus) [SaveProject] MainIDE.DoCheckFilesOnDisk failed']);
exit;
end;
if CheckMainSrcLCLInterfaces(sfQuietUnitCheck in Flags)<>mrOk then if CheckMainSrcLCLInterfaces(sfQuietUnitCheck in Flags)<>mrOk then begin
debugln(['Info: (lazarus) [SaveProject] CheckMainSrcLCLInterfaces failed']);
exit(mrCancel); exit(mrCancel);
end;
// if this is a virtual project then save first the project info file // if this is a virtual project then save first the project info file
// to get a project directory // to get a project directory
if Project1.IsVirtual and ([sfSaveToTestDir,sfDoNotSaveVirtualFiles]*Flags=[]) if Project1.IsVirtual and ([sfSaveToTestDir,sfDoNotSaveVirtualFiles]*Flags=[])
then begin then begin
Result:=SaveProjectInfo(Flags); Result:=SaveProjectInfo(Flags);
if Result in [mrCancel,mrAbort] then exit; if Result in [mrCancel,mrAbort] then begin
debugln(['Info: (lazarus) [SaveProject] SaveProjectInfo failed']);
exit;
end;
end; end;
// save virtual files // save virtual files
@ -3970,13 +3978,19 @@ begin
Include(SaveFileFlags,sfSaveToTestDir); Include(SaveFileFlags,sfSaveToTestDir);
end; end;
Result:=SaveEditorFile(AnUnitInfo.OpenEditorInfo[0].EditorComponent, SaveFileFlags); Result:=SaveEditorFile(AnUnitInfo.OpenEditorInfo[0].EditorComponent, SaveFileFlags);
if Result in [mrCancel,mrAbort] then exit; if Result in [mrCancel,mrAbort] then begin
debugln(['Info: (lazarus) [SaveProject] SaveEditorFile "',AnUnitInfo.Filename,'" failed']);
exit;
end;
end; end;
end; end;
end; end;
Result:=SaveProjectInfo(Flags); Result:=SaveProjectInfo(Flags);
if Result in [mrCancel,mrAbort] then exit; if Result in [mrCancel,mrAbort] then begin
debugln(['Info: (lazarus) [SaveProject] SaveProjectInfo failed']);
exit;
end;
// save all editor files // save all editor files
for i:=0 to SourceEditorManager.SourceEditorCount-1 do begin for i:=0 to SourceEditorManager.SourceEditorCount-1 do begin
@ -4010,8 +4024,11 @@ begin
continue; continue;
end; end;
end; end;
Result:=SaveEditorFile(SourceEditorManager.SourceEditors[i], SaveFileFlags); Result:=SaveEditorFile(SrcEdit, SaveFileFlags);
if Result=mrAbort then exit; if Result=mrAbort then begin
debugln(['Info: (lazarus) [SaveProject] SaveEditorFile "',SrcEdit.FileName,'" failed']);
exit;
end;
// mrCancel: continue saving other files // mrCancel: continue saving other files
end; end;
@ -7383,7 +7400,10 @@ begin
if ([sfSaveAs,sfSaveToTestDir]*Flags=[sfSaveAs]) then begin if ([sfSaveAs,sfSaveToTestDir]*Flags=[sfSaveAs]) then begin
// let user choose a filename // let user choose a filename
Result:=ShowSaveProjectAsDialog(sfSaveMainSourceAs in Flags); Result:=ShowSaveProjectAsDialog(sfSaveMainSourceAs in Flags);
if Result<>mrOk then exit; if Result<>mrOk then begin
debugln(['Info: (lazarus) [SaveProjectInfo] ShowSaveProjectAsDialog failed']);
exit;
end;
Flags:=Flags-[sfSaveAs,sfSaveMainSourceAs]; Flags:=Flags-[sfSaveAs,sfSaveMainSourceAs];
end; end;
@ -7391,10 +7411,14 @@ begin
UpdateProjectResourceInfo; UpdateProjectResourceInfo;
// save project info file // save project info file
//debugln(['SaveProjectInfo ',Project1.ProjectInfoFile,' Test=',sfSaveToTestDir in Flags,' Virt=',Project1.IsVirtual]);
if (not (sfSaveToTestDir in Flags)) if (not (sfSaveToTestDir in Flags))
and (not Project1.IsVirtual) then begin and (not Project1.IsVirtual) then begin
Result:=Project1.WriteProject([],'',EnvironmentOptions.BuildMatrixOptions); Result:=Project1.WriteProject([],'',EnvironmentOptions.BuildMatrixOptions);
if Result=mrAbort then exit; if Result=mrAbort then begin
debugln(['Info: (lazarus) [SaveProjectInfo] Project1.WriteProject failed']);
exit;
end;
EnvironmentOptions.LastSavedProjectFile:=Project1.ProjectInfoFile; EnvironmentOptions.LastSavedProjectFile:=Project1.ProjectInfoFile;
IDEProtocolOpts.LastProjectLoadingCrashed := False; IDEProtocolOpts.LastProjectLoadingCrashed := False;
AddRecentProjectFile(Project1.ProjectInfoFile); AddRecentProjectFile(Project1.ProjectInfoFile);
@ -7415,7 +7439,10 @@ begin
// loaded in source editor // loaded in source editor
Result:=SaveEditorFile(MainUnitInfo.OpenEditorInfo[0].EditorComponent, Result:=SaveEditorFile(MainUnitInfo.OpenEditorInfo[0].EditorComponent,
[sfProjectSaving]+[sfSaveToTestDir,sfCheckAmbiguousFiles]*Flags); [sfProjectSaving]+[sfSaveToTestDir,sfCheckAmbiguousFiles]*Flags);
if Result=mrAbort then exit; if Result=mrAbort then begin
debugln(['Info: (lazarus) [SaveProjectInfo] SaveEditorFile MainUnitInfo failed "',DestFilename,'"']);
exit;
end;
end else end else
begin begin
// not loaded in source editor (hidden) // not loaded in source editor (hidden)
@ -7425,7 +7452,10 @@ begin
if (not SkipSavingMainSource) and (MainUnitInfo.Source<>nil) then if (not SkipSavingMainSource) and (MainUnitInfo.Source<>nil) then
begin begin
Result:=SaveCodeBufferToFile(MainUnitInfo.Source, DestFilename); Result:=SaveCodeBufferToFile(MainUnitInfo.Source, DestFilename);
if Result=mrAbort then exit; if Result=mrAbort then begin
debugln(['Info: (lazarus) [SaveProjectInfo] SaveEditorFile failed "',DestFilename,'"']);
exit;
end;
end; end;
end; end;