示例#1
0
        /// <summary>
        /// Create an instance of the hosting class
        /// </summary>
        public SOSHost(IDataReader dataReader, ISOSHostContext context)
        {
            string rid = InstallHelper.GetRid();

            SOSPath  = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), rid);
            _wrapper = new LLDBServicesWrapper(this, dataReader, context);
        }
示例#2
0
        /// <summary>
        /// Create an instance of the service wrapper SOS uses.
        /// </summary>
        /// <param name="dataReader">clrmd data reader instance</param>
        /// <param name="context">sos hosting context</param>
        public LLDBServicesWrapper(SOSHost host, IDataReader dataReader, ISOSHostContext context)
        {
            _sosHost    = host;
            _dataReader = dataReader;
            _context    = context;

            VTableBuilder builder = AddInterface(IID_ILLDBServices, validate: false);

            builder.AddMethod(new GetCoreClrDirectoryDelegate(GetCoreClrDirectory));
            builder.AddMethod(new GetExpressionDelegate(GetExpression));
            builder.AddMethod(new VirtualUnwindDelegate(VirtualUnwind));
            builder.AddMethod(new SetExceptionCallbackDelegate(SetExceptionCallback));
            builder.AddMethod(new ClearExceptionCallbackDelegate(ClearExceptionCallback));

            builder.AddMethod(new GetInterruptDelegate(GetInterrupt));
            builder.AddMethod(new OutputVaListDelegate(OutputVaList));
            builder.AddMethod(new GetDebuggerTypeDelegate(GetDebuggerType));
            builder.AddMethod(new GetPageSizeDelegate(GetPageSize));
            builder.AddMethod(new GetExecutingProcessorTypeDelegate(GetExecutingProcessorType));
            builder.AddMethod(new ExecuteDelegate(Execute));
            builder.AddMethod(new GetLastEventInformationDelegate(GetLastEventInformation));
            builder.AddMethod(new DisassembleDelegate(Disassemble));

            builder.AddMethod(new GetContextStackTraceDelegate(GetContextStackTrace));
            builder.AddMethod(new ReadVirtualDelegate(ReadVirtual));
            builder.AddMethod(new WriteVirtualDelegate(WriteVirtual));

            builder.AddMethod(new GetSymbolOptionsDelegate(GetSymbolOptions));
            builder.AddMethod(new GetNameByOffsetDelegate(GetNameByOffset));
            builder.AddMethod(new GetNumberModulesDelegate(GetNumberModules));
            builder.AddMethod(new GetModuleByIndexDelegate(GetModuleByIndex));
            builder.AddMethod(new GetModuleByModuleNameDelegate(GetModuleByModuleName));
            builder.AddMethod(new GetModuleByOffsetDelegate(GetModuleByOffset));
            builder.AddMethod(new GetModuleNamesDelegate(GetModuleNames));
            builder.AddMethod(new GetLineByOffsetDelegate(GetLineByOffset));
            builder.AddMethod(new GetSourceFileLineOffsetsDelegate(GetSourceFileLineOffsets));
            builder.AddMethod(new FindSourceFileDelegate(FindSourceFile));

            builder.AddMethod(new GetCurrentProcessIdDelegate(GetCurrentProcessId));
            builder.AddMethod(new GetCurrentThreadIdDelegate(GetCurrentThreadId));
            builder.AddMethod(new SetCurrentThreadIdDelegate(SetCurrentThreadId));
            builder.AddMethod(new GetCurrentThreadSystemIdDelegate(GetCurrentThreadSystemId));
            builder.AddMethod(new GetThreadIdBySystemIdDelegate(GetThreadIdBySystemId));
            builder.AddMethod(new GetThreadContextByIdDelegate(GetThreadContextById));

            builder.AddMethod(new GetValueByNameDelegate(GetValueByName));
            builder.AddMethod(new GetInstructionOffsetDelegate(GetInstructionOffset));
            builder.AddMethod(new GetStackOffsetDelegate(GetStackOffset));
            builder.AddMethod(new GetFrameOffsetDelegate(GetFrameOffset));

            ILLDBServices = builder.Complete();

            builder = AddInterface(IID_ILLDBServices2, validate: false);
            builder.AddMethod(new LoadNativeSymbolsDelegate2(LoadNativeSymbols2));
            builder.AddMethod(new AddModuleSymbolDelegate(AddModuleSymbol));
            builder.Complete();

            AddRef();
        }
示例#3
0
        /// <summary>
        /// Create an instance of the hosting class
        /// </summary>
        public SOSHost(IDataReader dataReader, ISOSHostContext context)
        {
            DataReader     = dataReader;
            SOSHostContext = context;
            string rid = InstallHelper.GetRid();

            SOSPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), rid);
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                var debugClient = new DebugClient(this);
                _ccw       = debugClient;
                _interface = debugClient.IDebugClient;
            }
            else
            {
                var lldbServices = new LLDBServices(this);
                _ccw       = lldbServices;
                _interface = lldbServices.ILLDBServices;
            }
        }
示例#4
0
        /// <summary>
        /// Create an instance of the hosting class
        /// </summary>
        public SOSHost(IDataReader dataReader, ISOSHostContext context)
        {
            string os = null;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                os = "win";
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                os = "linux";
            }
            if (os == null)
            {
                throw new PlatformNotSupportedException($"Unsupported operating system: {RuntimeInformation.OSDescription}");
            }
            string architecture = RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant();
            string rid          = os + "-" + architecture;

            SOSPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), rid);

            _wrapper = new LLDBServicesWrapper(this, dataReader, context);
        }