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

            % check that GDB and DDD are available and issue an error if
            % not
            if ~rtw.connectivity.HostSILDebugger.commandExists('gdb')
                error(message('PIL:pil:SILDebuggingGDBNotFound'));
            end
            
            if ~rtw.connectivity.HostSILDebugger.commandExists('ddd')
                error(message('PIL:pil:SILDebuggingDDDNotFound'));
            end
        end
        
                
        function debugger = createDebugger(~, componentArgs, topContext, silDebuggingInfo)
            % Launch the target application and attach DDD to
            % process
            debugger = rtw.connectivity.LinuxSILDebugger(componentArgs, ...
                topContext, ...
                silDebuggingInfo);
        end
        
        function populateToolchainInfo(this, defaultComp)
            if strcmp(defaultComp.compStr, 'GNU-x')
                this.populateBasicToolchainInfo(defaultComp);
            end
        end
    end
end