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 = (
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;

View File

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

View File

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

View File

@ -187,7 +187,9 @@ begin
FActive := False;
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;
if FDebuggerProperties <> nil then
AXMLCfg.ReadObject(APath + 'Properties/', FDebuggerProperties);
@ -235,7 +237,8 @@ begin
FDebuggerProperties := FDebuggerClass.CreateProperties;
if FDebuggerProperties <> nil then
AXMLCfg.ReadObject(p, FDebuggerProperties);
FFLags := [dpcLoaded];
if Active or not (dfNotSuitableForOsArch in FDebuggerClass.SupportedFeatures) then
FFLags := [dpcLoaded];
end
else begin
if p[Length(p)] = '/' then
@ -263,7 +266,8 @@ begin
FConfigName := '';
FActive := ACreateAsActive;
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;
end;
@ -279,7 +283,8 @@ begin
FDebuggerClass := TBaseDebugManagerIntf.DebuggersByClassName[ConfigClass];
if FDebuggerClass <> nil then begin
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;
InitUID;