Init-Setup: Change detection of incorrect dbg settings

git-svn-id: trunk@61632 -
This commit is contained in:
martin 2019-07-27 13:11:25 +00:00
parent 0aa50e2f0f
commit 4f145f9709
3 changed files with 29 additions and 32 deletions

View File

@ -534,6 +534,7 @@ type
XML_PATH_DEBUGGER_CONF_OLD = 'EnvironmentOptions/Debugger/Class%s/%s/';
private
FCurrentDebuggerPropertiesConfig: TDebuggerPropertiesConfig;
FHasActiveDebuggerEntry: Boolean;
fRegisteredSubConfig: TObjectList;
FDebuggerAutoCloseAsm: boolean;
// config file
@ -927,6 +928,7 @@ type
function DebuggerPropertiesConfigList: TDebuggerPropertiesConfigList;
property CurrentDebuggerPropertiesConfig: TDebuggerPropertiesConfig read GetCurrentDebuggerPropertiesConfig write SetCurrentDebuggerPropertiesOpt;
property CurrentDebuggerClass: TDebuggerClass read GetCurrentDebuggerClass;
property HasActiveDebuggerEntry: Boolean read FHasActiveDebuggerEntry write FHasActiveDebuggerEntry; // for the initial setup dialog / entry may be of unknown class
property DebuggerConfig: TDebuggerConfigStore read FDebuggerConfig;
// Debugger event log
@ -3437,6 +3439,7 @@ begin
then
exit;
FKnownDebuggerClassCount := TBaseDebugManagerIntf.DebuggerCount;
HasActiveDebuggerEntry := False;
FDebuggerProperties.ClearAll;
@ -3448,6 +3451,8 @@ begin
for i := 1 to ConfCount do begin
Entry := TDebuggerPropertiesConfig.CreateFromXmlConf(FXMLCfg, XML_PATH_DEBUGGER_CONF, i);
FDebuggerProperties.AddObject(Entry.ConfigName, Entry);
if Entry.Active then
HasActiveDebuggerEntry := True;
if Entry.Active and Entry.IsLoaded and (FCurrentDebuggerPropertiesConfig = nil) then
FCurrentDebuggerPropertiesConfig := Entry;
if Entry.Active and (UnloadedCurrent = nil) then
@ -3462,6 +3467,7 @@ begin
ActiveClassSeen := False;
if FCurrentDebuggerPropertiesConfig = nil then
ActiveClassName := FXMLCfg.GetValue('EnvironmentOptions/Debugger/Class', '');
HasActiveDebuggerEntry := HasActiveDebuggerEntry or (ActiveClassName <> '');
// There is only one filename for all classes
CurFilename:=FXMLCfg.GetValue('EnvironmentOptions/DebuggerFilename/Value','');
@ -3480,17 +3486,6 @@ begin
if (Entry.ConfigClass = ActiveClassName) and (FCurrentDebuggerPropertiesConfig = nil) then
FCurrentDebuggerPropertiesConfig := Entry;
end;
// current active debugger was not found / may not an unknown class
// InitialSetupDlg depends on having a debugger loaded, with the ONLY exception: ActiveClassName = ''
if (not ActiveClassSeen) and (ActiveClassName <> '') then begin
Entry := TDebuggerPropertiesConfig.CreateFromOldXmlConf(FXMLCfg, XML_PATH_DEBUGGER_CONF_OLD, ActiveClassName, True);
if (Entry.DebuggerFilename = '') and (Entry.NeedsExePath or (not Entry.IsLoaded)) then
Entry.DebuggerFilename := CurFilename;
FDebuggerProperties.AddObject(Entry.ConfigName, Entry);
// FCurrentDebuggerPropertiesConfig may NOT be loaded !!!
FCurrentDebuggerPropertiesConfig := Entry;
end;
end;
function TEnvironmentOptions.GetCurrentDebuggerClass: TDebuggerClass;

View File

@ -245,7 +245,7 @@ begin
Result:=sddqCompatible;
if ASkip and // assume compatible
( (EnvironmentOptions.CurrentDebuggerPropertiesConfig = nil) or
(EnvironmentOptions.DebuggerFilename = AFilename) // unless the user edited the filename
(EnvironmentOptions.CurrentDebuggerPropertiesConfig.DebuggerFilename = AFilename) // unless the user edited the filename
)
then
exit;
@ -745,13 +745,10 @@ begin
s:=MakeExeComboBox.Text;
if s<>'' then
EnvironmentOptions.MakeFilename:=s;
if not (FSkipDebugger and (EnvironmentOptions.CurrentDebuggerPropertiesConfig = nil))
if not (FSkipDebugger and (EnvironmentOptions.CurrentDebuggerPropertiesConfig <> nil))
then begin
s:=DebuggerComboBox.Text;
if s<>'' then begin
if EnvironmentOptions.CurrentDebuggerPropertiesConfig = nil then
EnvironmentOptions.CurrentDebuggerPropertiesConfig :=
TDebuggerPropertiesConfig.CreateForDebuggerClass(TGDBMIDebugger);
EnvironmentOptions.CurrentDebuggerPropertiesConfig.DebuggerFilename:=s;
EnvironmentOptions.SaveDebuggerPropertiesList; // Update XML
end;
@ -1373,26 +1370,30 @@ begin
UpdateMakeExeNote;
RegisterDebugger(TGDBMIDebugger); // make sure we can read the config
FSkipDebugger := (EnvironmentOptions.CurrentDebuggerPropertiesConfig <> nil) and ( // Has a debugger
(EnvironmentOptions.CurrentDebuggerClass = nil) or // Unknown existing debugger class
(not EnvironmentOptions.CurrentDebuggerPropertiesConfig.NeedsExePath) // Does not need an exe
);
FSkipDebugger := EnvironmentOptions.HasActiveDebuggerEntry // There is a configured entry. Assume it is right, unless we can prove it is incorrect
and not (
(EnvironmentOptions.CurrentDebuggerPropertiesConfig <> nil) and // The ACTIVE dbg is a known debugger
(EnvironmentOptions.CurrentDebuggerClass <> nil) and // with existing debugger class
(EnvironmentOptions.CurrentDebuggerPropertiesConfig.NeedsExePath) // Does need an exe
);
// Debugger
FInitialDebuggerFileName := EnvironmentOptions.DebuggerFilename;
UpdateDebuggerCandidates;
if (not FSkipDebugger) and
( IsFirstStart or (not FileExistsCached(EnvironmentOptions.GetParsedDebuggerFilename)) )
then begin
// first start => choose first best candidate
Candidate:=GetFirstCandidate(FCandidates[sddtDebuggerFilename]);
if Candidate<>nil then begin
if EnvironmentOptions.CurrentDebuggerPropertiesConfig = nil then
EnvironmentOptions.CurrentDebuggerPropertiesConfig :=
TDebuggerPropertiesConfig.CreateForDebuggerClass(TGDBMIDebugger);
EnvironmentOptions.CurrentDebuggerPropertiesConfig.DebuggerFilename:=Candidate.Caption;
EnvironmentOptions.SaveDebuggerPropertiesList; // Update XML
if (not FSkipDebugger) then begin
if EnvironmentOptions.CurrentDebuggerPropertiesConfig = nil then
EnvironmentOptions.CurrentDebuggerPropertiesConfig :=
TDebuggerPropertiesConfig.CreateForDebuggerClass(TGDBMIDebugger);
if IsFirstStart or (not FileExistsCached(EnvironmentOptions.GetParsedDebuggerFilename))
then begin
// first start => choose first best candidate
Candidate:=GetFirstCandidate(FCandidates[sddtDebuggerFilename]);
if Candidate<>nil then begin
EnvironmentOptions.CurrentDebuggerPropertiesConfig.DebuggerFilename:=Candidate.Caption;
end;
end;
EnvironmentOptions.SaveDebuggerPropertiesList; // Update XML
end;
DebuggerComboBox.Text:=EnvironmentOptions.DebuggerFilename;
fLastParsedDebugger:='. .';
UpdateDebuggerNote;

View File

@ -1434,7 +1434,8 @@ begin
RegisterDebugger(TGDBMIDebugger); // make sure we can read the config
// Todo: add LldbFpDebugger for Mac
// If the default debugger is of a class that is not yet Registered, then the dialog is not shown
if (EnvironmentOptions.CurrentDebuggerPropertiesConfig = nil) // no debugger at all / not even with unknown class
if ( (EnvironmentOptions.CurrentDebuggerPropertiesConfig = nil) and // no debugger at all
(not EnvironmentOptions.HasActiveDebuggerEntry) ) // not even with unknown class
or ( (EnvironmentOptions.CurrentDebuggerClass <> nil) // Debugger with known class
and (EnvironmentOptions.CurrentDebuggerPropertiesConfig.NeedsExePath) // Which does need an exe
and (CheckDebuggerQuality(EnvironmentOptions.GetParsedDebuggerFilename, Note)<>sddqCompatible)