classdef MacHostDebuggerManager < rtw.connectivity.HostDebuggerManager
    %MACHOSTDEBUGGERMANAGER utility class to create an instance of
    % rtw.connectivity.LLDBSILDebugger
    %
    %   This is an undocumented class. Its methods and properties are
    %   likely to change without warning from one release to the next.
    
    %   Copyright 2020-2022 The MathWorks, Inc.
    
    methods
        function this = MacHostDebuggerManager(spkgManager)
            compilerID = {'Clang'};
            % No restriction on Clang version, set to empty
            compilerVersionPairs = {...
                {'Clang', ''}};
            this = this@rtw.connectivity.HostDebuggerManager(compilerID, compilerVersionPairs, spkgManager);
        end
    end
    
    methods(Access = protected)    
        function checkDebuggerIsAvailable(this, ~)

            % Check if LLDB is available. If it is not, and the VS Code
            % Debug Tool is not enabled or not installed, throw and error.
            this.throwOnMissingUnixDebugger('lldb', 'PIL:pil:SILDebuggingLLDBNotFound');
        end
               
        function service = getDebugTool(this)

            if this.TFSPKGManager.isInstalledAndEnabled('VSCodeDebugTool')
                service = target.internal.get('ExecutionService', 'Visual Studio Code');
            else
                service = target.internal.get('ExecutionService', 'LLDB');
            end
        end
        
        function populateToolchainInfo(this, defaultComp)
            if strcmp(defaultComp.compStr, 'Apple-x')
                this.populateBasicToolchainInfo(defaultComp);
            end
        end
    end
end
