Debugger: Add dfNotSuitableForOsArch, to filter out unusable backends

This commit is contained in:
Martin 2022-12-31 18:56:39 +01:00
parent 8cd89c5af8
commit c7de909539
4 changed files with 22 additions and 5 deletions

View File

@ -62,7 +62,13 @@ type
TDBGFeature = ( TDBGFeature = (
dfEvalFunctionCalls, // The debugger supports calling functions in watches/expressions. defAllowFunctionCall in TWatcheEvaluateFlags dfEvalFunctionCalls, // The debugger supports calling functions in watches/expressions. defAllowFunctionCall in TWatcheEvaluateFlags
dfThreadSuspension dfThreadSuspension,
(* dfNotSuitableForOsArch:
If this is set, then this debugger can not be used on the current
architecture and/or OS
*)
dfNotSuitableForOsArch
); );
TDBGFeatures = set of TDBGFeature; TDBGFeatures = set of TDBGFeature;

View File

@ -4621,7 +4621,11 @@ end;
class function TFpDebugDebugger.SupportedFeatures: TDBGFeatures; class function TFpDebugDebugger.SupportedFeatures: TDBGFeatures;
begin begin
{$IF defined(windows) or defined(linux)}
Result := [dfEvalFunctionCalls, dfThreadSuspension]; Result := [dfEvalFunctionCalls, dfThreadSuspension];
{$ELSE}
Result := [dfNotSuitableForOsArch];
{$ENDIF}
end; end;
initialization initialization

View File

@ -332,6 +332,8 @@ begin
List := TStringListUTF8Fast.Create; List := TStringListUTF8Fast.Create;
for i := 0 to TBaseDebugManagerIntf.DebuggerCount - 1 do begin for i := 0 to TBaseDebugManagerIntf.DebuggerCount - 1 do begin
d := TBaseDebugManagerIntf.Debuggers[i]; d := TBaseDebugManagerIntf.Debuggers[i];
if dfNotSuitableForOsArch in d.SupportedFeatures then
continue;
List.AddObject(d.Caption, TObject(d)); List.AddObject(d.Caption, TObject(d));
end; end;
List.Sorted := True; List.Sorted := True;

View File

@ -187,7 +187,9 @@ begin
FActive := False; FActive := False;
FDebuggerClass := TBaseDebugManagerIntf.DebuggersByClassName[ConfigClass]; FDebuggerClass := TBaseDebugManagerIntf.DebuggersByClassName[ConfigClass];
if FDebuggerClass <> nil then begin if (FDebuggerClass <> nil) and
( Active or not (dfNotSuitableForOsArch in FDebuggerClass.SupportedFeatures) ) // Active entries will always be loaded for compatibility
then begin
FDebuggerProperties := FDebuggerClass.CreateProperties; FDebuggerProperties := FDebuggerClass.CreateProperties;
if FDebuggerProperties <> nil then if FDebuggerProperties <> nil then
AXMLCfg.ReadObject(APath + 'Properties/', FDebuggerProperties); AXMLCfg.ReadObject(APath + 'Properties/', FDebuggerProperties);
@ -235,7 +237,8 @@ begin
FDebuggerProperties := FDebuggerClass.CreateProperties; FDebuggerProperties := FDebuggerClass.CreateProperties;
if FDebuggerProperties <> nil then if FDebuggerProperties <> nil then
AXMLCfg.ReadObject(p, FDebuggerProperties); AXMLCfg.ReadObject(p, FDebuggerProperties);
FFLags := [dpcLoaded]; if Active or not (dfNotSuitableForOsArch in FDebuggerClass.SupportedFeatures) then
FFLags := [dpcLoaded];
end end
else begin else begin
if p[Length(p)] = '/' then if p[Length(p)] = '/' then
@ -263,7 +266,8 @@ begin
FConfigName := ''; FConfigName := '';
FActive := ACreateAsActive; FActive := ACreateAsActive;
FDebuggerProperties := ADebuggerClass.CreateProperties; FDebuggerProperties := ADebuggerClass.CreateProperties;
FFLags := [dpcLoaded]; // i.e. treat as loaded, save when saving all if FActive or not (dfNotSuitableForOsArch in FDebuggerClass.SupportedFeatures) then
FFLags := [dpcLoaded]; // i.e. treat as loaded, save when saving all
InitUID; InitUID;
end; end;
@ -279,7 +283,8 @@ begin
FDebuggerClass := TBaseDebugManagerIntf.DebuggersByClassName[ConfigClass]; FDebuggerClass := TBaseDebugManagerIntf.DebuggersByClassName[ConfigClass];
if FDebuggerClass <> nil then begin if FDebuggerClass <> nil then begin
FDebuggerProperties := FDebuggerClass.CreateProperties; FDebuggerProperties := FDebuggerClass.CreateProperties;
FFLags := [dpcLoaded]; // i.e. treat as loaded, save when saving all if FActive or not (dfNotSuitableForOsArch in FDebuggerClass.SupportedFeatures) then
FFLags := [dpcLoaded]; // i.e. treat as loaded, save when saving all
end; end;
InitUID; InitUID;