internal CorDebugDataTargetWrapper(IServiceProvider services) { Debug.Assert(services != null); _target = services.GetService <ITarget>(); _symbolService = services.GetService <ISymbolService>(); _memoryService = services.GetService <IMemoryService>(); _threadService = services.GetService <IThreadService>(); _threadUnwindService = services.GetService <IThreadUnwindService>(); _ignoreAddressBitsMask = _memoryService.SignExtensionMask(); VTableBuilder builder = AddInterface(IID_ICorDebugDataTarget, validate: false); builder.AddMethod(new GetPlatformDelegate(GetPlatform)); builder.AddMethod(new ReadVirtualDelegate(ReadVirtual)); builder.AddMethod(new GetThreadContextDelegate(GetThreadContext)); ICorDebugDataTarget = builder.Complete(); builder = AddInterface(IID_ICorDebugDataTarget4, validate: false); builder.AddMethod(new VirtualUnwindDelegate(VirtualUnwind)); builder.Complete(); builder = AddInterface(IID_ICorDebugMutableDataTarget, validate: false); builder.AddMethod(new WriteVirtualDelegate(WriteVirtual)); builder.AddMethod(new SetThreadContextDelegate((self, threadId, contextSize, context) => HResult.E_NOTIMPL)); builder.AddMethod(new ContinueStatusChangeDelegate((self, continueStatus) => HResult.E_NOTIMPL)); builder.Complete(); builder = AddInterface(IID_ICorDebugMetaDataLocator, validate: false); builder.AddMethod(new GetMetaDataDelegate(GetMetaData)); builder.Complete(); AddRef(); }
public DataTargetWrapper(IServiceProvider services, IRuntime runtime) { Debug.Assert(services != null); Debug.Assert(runtime != null); _services = services; _runtimeBaseAddress = runtime.RuntimeModule.ImageBase; _symbolService = services.GetService <ISymbolService>(); _memoryService = services.GetService <IMemoryService>(); _threadService = services.GetService <IThreadService>(); _threadUnwindService = services.GetService <IThreadUnwindService>(); _moduleService = services.GetService <IModuleService>(); _remoteMemoryService = services.GetService <IRemoteMemoryService>(); _ignoreAddressBitsMask = _memoryService.SignExtensionMask(); VTableBuilder builder = AddInterface(IID_ICLRDataTarget, false); AddDataTarget(builder); IDataTarget = builder.Complete(); builder = AddInterface(IID_ICLRDataTarget2, false); AddDataTarget2(builder); builder.Complete(); builder = AddInterface(IID_ICLRDataTarget4, validate: false); builder.AddMethod(new VirtualUnwindDelegate(VirtualUnwind)); builder.Complete(); builder = AddInterface(IID_ICLRMetadataLocator, false); builder.AddMethod(new GetMetadataDelegate(GetMetadata)); builder.Complete(); builder = AddInterface(IID_ICLRRuntimeLocator, false); builder.AddMethod(new GetRuntimeBaseDelegate(GetRuntimeBase)); builder.Complete(); }
/// <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(); }
/// <summary> /// Create an instance of the service wrapper SOS uses. /// </summary> /// <param name="soshost">SOS host instance</param> internal LLDBServices(SOSHost soshost) { _soshost = soshost; VTableBuilder builder = AddInterface(IID_ILLDBServices, validate: false); builder.AddMethod(new GetCoreClrDirectoryDelegate(GetCoreClrDirectory)); builder.AddMethod(new GetExpressionDelegate((self, expression) => SOSHost.GetExpression(expression))); builder.AddMethod(new VirtualUnwindDelegate(VirtualUnwind)); builder.AddMethod(new SetExceptionCallbackDelegate(SetExceptionCallback)); builder.AddMethod(new ClearExceptionCallbackDelegate(ClearExceptionCallback)); builder.AddMethod(new GetInterruptDelegate(soshost.GetInterrupt)); builder.AddMethod(new OutputVaListDelegate(soshost.OutputVaList)); builder.AddMethod(new GetDebuggeeTypeDelegate(soshost.GetDebuggeeType)); builder.AddMethod(new GetPageSizeDelegate(soshost.GetPageSize)); builder.AddMethod(new GetExecutingProcessorTypeDelegate(soshost.GetExecutingProcessorType)); builder.AddMethod(new ExecuteDelegate(soshost.Execute)); builder.AddMethod(new GetLastEventInformationDelegate(soshost.GetLastEventInformation)); builder.AddMethod(new DisassembleDelegate(soshost.Disassemble)); builder.AddMethod(new GetContextStackTraceDelegate(GetContextStackTrace)); builder.AddMethod(new ReadVirtualDelegate(soshost.ReadVirtual)); builder.AddMethod(new WriteVirtualDelegate(soshost.WriteVirtual)); builder.AddMethod(new GetSymbolOptionsDelegate(soshost.GetSymbolOptions)); builder.AddMethod(new GetNameByOffsetDelegate(soshost.GetNameByOffset)); builder.AddMethod(new GetNumberModulesDelegate(soshost.GetNumberModules)); builder.AddMethod(new GetModuleByIndexDelegate(soshost.GetModuleByIndex)); builder.AddMethod(new GetModuleByModuleNameDelegate(soshost.GetModuleByModuleName)); builder.AddMethod(new GetModuleByOffsetDelegate(soshost.GetModuleByOffset)); builder.AddMethod(new GetModuleNamesDelegate(soshost.GetModuleNames)); builder.AddMethod(new GetLineByOffsetDelegate(soshost.GetLineByOffset)); builder.AddMethod(new GetSourceFileLineOffsetsDelegate(soshost.GetSourceFileLineOffsets)); builder.AddMethod(new FindSourceFileDelegate(soshost.FindSourceFile)); builder.AddMethod(new GetCurrentProcessSystemIdDelegate(soshost.GetCurrentProcessSystemId)); builder.AddMethod(new GetCurrentThreadIdDelegate(soshost.GetCurrentThreadId)); builder.AddMethod(new SetCurrentThreadIdDelegate(soshost.SetCurrentThreadId)); builder.AddMethod(new GetCurrentThreadSystemIdDelegate(soshost.GetCurrentThreadSystemId)); builder.AddMethod(new GetThreadIdBySystemIdDelegate(soshost.GetThreadIdBySystemId)); builder.AddMethod(new GetThreadContextBySystemIdDelegate(soshost.GetThreadContextBySystemId)); builder.AddMethod(new GetValueByNameDelegate(GetValueByName)); builder.AddMethod(new GetInstructionOffsetDelegate(soshost.GetInstructionOffset)); builder.AddMethod(new GetStackOffsetDelegate(soshost.GetStackOffset)); builder.AddMethod(new GetFrameOffsetDelegate(soshost.GetFrameOffset)); ILLDBServices = builder.Complete(); builder = AddInterface(IID_ILLDBServices2, validate: false); builder.AddMethod(new LoadNativeSymbolsDelegate2(LoadNativeSymbols2)); builder.AddMethod(new AddModuleSymbolDelegate(AddModuleSymbol)); builder.AddMethod(new GetModuleInfoDelegate(GetModuleInfo)); builder.AddMethod(new GetModuleVersionInformationDelegate(soshost.GetModuleVersionInformation)); builder.Complete(); AddRef(); }
internal DebugDataSpaces(DebugClient client, SOSHost soshost) { VTableBuilder builder = client.AddInterface(typeof(IDebugDataSpaces).GUID, validate: true); AddDebugDataSpaces(builder, soshost); builder.Complete(); builder = client.AddInterface(typeof(IDebugDataSpaces2).GUID, validate: true); AddDebugDataSpaces2(builder, soshost); builder.Complete(); }
private HostServices() { _serviceProvider = new ServiceProvider(); _symbolService = new SymbolService(this); _commandProcessor = new CommandProcessor(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ">!ext" : null); _commandProcessor.AddCommands(new Assembly[] { typeof(HostServices).Assembly }); _commandProcessor.AddCommands(new Assembly[] { typeof(ClrMDHelper).Assembly }); _serviceProvider.AddService <IHost>(this); _serviceProvider.AddService <ICommandService>(_commandProcessor); _serviceProvider.AddService <ISymbolService>(_symbolService); _hostWrapper = new HostWrapper(this); _hostWrapper.AddServiceWrapper(IID_IHostServices, this); _hostWrapper.AddServiceWrapper(SymbolServiceWrapper.IID_ISymbolService, () => new SymbolServiceWrapper(this)); VTableBuilder builder = AddInterface(IID_IHostServices, validate: false); builder.AddMethod(new GetHostDelegate(GetHost)); builder.AddMethod(new RegisterDebuggerServicesDelegate(RegisterDebuggerServices)); builder.AddMethod(new CreateTargetDelegate(CreateTarget)); builder.AddMethod(new UpdateTargetDelegate(UpdateTarget)); builder.AddMethod(new FlushTargetDelegate(FlushTarget)); builder.AddMethod(new DestroyTargetDelegate(DestroyTarget)); builder.AddMethod(new DispatchCommandDelegate(DispatchCommand)); builder.AddMethod(new DispatchCommandDelegate(DisplayHelp)); builder.AddMethod(new UninitializeDelegate(Uninitialize)); IHostServices = builder.Complete(); AddRef(); }
public SymbolServiceWrapper(IHost host) { Debug.Assert(host != null); _host = host; _symbolService = host.Services.GetService <ISymbolService>(); VTableBuilder builder = AddInterface(IID_ISymbolService, validate: false); builder.AddMethod(new IsSymbolStoreEnabledDelegate((IntPtr self) => _symbolService.IsSymbolStoreEnabled)); builder.AddMethod(new InitializeSymbolStoreDelegate(InitializeSymbolStore)); builder.AddMethod(new ParseSymbolPathDelegate(ParseSymbolPath)); builder.AddMethod(new DisplaySymbolStoreDelegate(DisplaySymbolStore)); builder.AddMethod(new DisableSymbolStoreDelegate((IntPtr self) => _symbolService.DisableSymbolStore())); builder.AddMethod(new LoadNativeSymbolsDelegate(LoadNativeSymbols)); builder.AddMethod(new LoadNativeSymbolsFromIndexDelegate(LoadNativeSymbolsFromIndex)); builder.AddMethod(new LoadSymbolsForModuleDelegate(LoadSymbolsForModule)); builder.AddMethod(new DisposeDelegate(Dispose)); builder.AddMethod(new ResolveSequencePointDelegate(ResolveSequencePoint)); builder.AddMethod(new GetLocalVariableNameDelegate(GetLocalVariableName)); builder.AddMethod(new GetLineByILOffsetDelegate(GetLineByILOffset)); builder.AddMethod(new GetExpressionValueDelegate(GetExpressionValue)); builder.AddMethod(new GetMetadataLocatorDelegate(GetMetadataLocator)); builder.AddMethod(new GetICorDebugMetadataLocatorDelegate(GetICorDebugMetadataLocator)); builder.Complete(); }
public ManagedCallbackWrapper(DebuggeeInfo startInfo) { _startInfo = startInfo; VTableBuilder builder = AddInterface(IID_ICorDebugManagedCallback, validate: false); builder.AddMethod(new BreakpointDelegate((self, pAppDomain, pThread, pBreakpoint) => HResult.E_NOTIMPL)); builder.AddMethod(new StepCompleteDelegate((self, pAppDomain, pThread, pStepper, reason) => HResult.E_NOTIMPL)); builder.AddMethod(new BreakDelegate((self, pAppDomain, pThread) => WriteLine("Break"))); builder.AddMethod(new ExceptionDelegate((self, pAppDomain, pThread, unhandled) => WriteLine("Exception"))); builder.AddMethod(new EvalCompleteDelegate((self, pAppDomain, pThread, pEval) => HResult.E_NOTIMPL)); builder.AddMethod(new EvalExceptionDelegate((self, pAppDomain, pThread, pEval) => HResult.E_NOTIMPL)); builder.AddMethod(new CreateProcessDelegate((self, pProcess) => CreateProcess(pProcess))); builder.AddMethod(new ExitProcessDelegate((self, pProcess) => WriteLine("ExitProcess"))); builder.AddMethod(new CreateThreadDelegate((self, pAppDomain, pThread) => HResult.E_NOTIMPL)); builder.AddMethod(new ExitThreadDelegate((self, pAppDomain, pThread) => HResult.E_NOTIMPL)); builder.AddMethod(new LoadModuleDelegate((self, pAppDomain, pModule) => HResult.E_NOTIMPL)); builder.AddMethod(new UnloadModuleDelegate((self, pAppDomain, pModule) => HResult.E_NOTIMPL)); builder.AddMethod(new LoadClassDelegate((self, pAppDomain, c) => HResult.E_NOTIMPL)); builder.AddMethod(new UnloadClassDelegate((self, pAppDomain, c) => HResult.E_NOTIMPL)); builder.AddMethod(new DebuggerErrorDelegate((self, pProcess, errorHR, errorCode) => WriteLine($"DebuggerError {errorHR} {errorCode:X8}"))); builder.AddMethod(new LogMessageDelegate((self, pAppDomain, pThread, lLevel, pLogSwitchName, pMessage) => HResult.E_NOTIMPL)); builder.AddMethod(new LogSwitchDelegate((self, pAppDomain, pThread, lLevel, ulReason, pLogSwitchName, pParentName) => HResult.E_NOTIMPL)); builder.AddMethod(new CreateAppDomainDelegate((self, pProcess, pAppDomain) => HResult.E_NOTIMPL)); builder.AddMethod(new ExitAppDomainDelegate((self, pProcess, pAppDomain) => HResult.E_NOTIMPL)); builder.AddMethod(new LoadAssemblyDelegate((self, pAppDomain, pAssembly) => HResult.E_NOTIMPL)); builder.AddMethod(new UnloadAssemblyDelegate((self, pAppDomain, pAssembly) => HResult.E_NOTIMPL)); builder.AddMethod(new ControlCTrapDelegate((self, pProcess) => HResult.E_NOTIMPL)); builder.AddMethod(new NameChangeDelegate((self, pAppDomain, pThread) => HResult.E_NOTIMPL)); builder.AddMethod(new UpdateModuleSymbolsDelegate((self, pAppDomain, pModule, pSymbolStream) => HResult.E_NOTIMPL)); builder.AddMethod(new EditAndContinueRemapDelegate((self, pAppDomain, pThread, pFunction, fAccurate) => HResult.E_NOTIMPL)); builder.AddMethod(new BreakpointSetErrorDelegate((self, pAppDomain, pThread, pBreakpoint, dwError) => HResult.E_NOTIMPL)); ICorDebugManagedCallback = builder.Complete(); builder = AddInterface(IID_ICorDebugManagedCallback2, validate: false); builder.AddMethod(new FunctionRemapOpportunityDelegate((self, pAppDomain, pThread, pOldFunction, pNewFunction, oldILOffset) => HResult.E_NOTIMPL)); builder.AddMethod(new CreateConnectionDelegate((IntPtr self, IntPtr pProcess, uint dwConnectionId, ref ushort pConnName) => HResult.E_NOTIMPL)); builder.AddMethod(new ChangeConnectionDelegate((self, pProcess, dwConnectionId) => HResult.E_NOTIMPL)); builder.AddMethod(new DestroyConnectionDelegate((self, pProcess, dwConnectionId) => HResult.E_NOTIMPL)); builder.AddMethod(new ExceptionDelegate2((self, pAppDomain, pThread, pFrame, nOffset, dwEventType, dwFlags) => HResult.E_NOTIMPL)); builder.AddMethod(new ExceptionUnwindDelegate((self, pAppDomain, pThread, dwEventType, dwFlags) => HResult.E_NOTIMPL)); builder.AddMethod(new FunctionRemapCompleteDelegate((self, pAppDomain, pThread, pFunction) => HResult.E_NOTIMPL)); builder.AddMethod(new MDANotificationDelegate((self, pController, pThread, pMDA) => HResult.E_NOTIMPL)); builder.Complete(); AddRef(); }
internal DebugAdvanced(DebugClient client, SOSHost soshost) { VTableBuilder builder = client.AddInterface(typeof(IDebugAdvanced).GUID, validate: true); builder.AddMethod(new GetThreadContextDelegate(soshost.GetThreadContext)); builder.AddMethod(new SetThreadContextDelegate(soshost.SetThreadContext)); builder.Complete(); }
public HostWrapper(IHost host) { _host = host; VTableBuilder builder = AddInterface(IID_IHost, validate: false); builder.AddMethod(new GetHostTypeDelegate(GetHostType)); builder.AddMethod(new GetServiceDelegate(GetService)); builder.AddMethod(new GetCurrentTargetDelegate(GetCurrentTarget)); IHost = builder.Complete(); AddRef(); }
public LibraryProviderWrapper(OSPlatform targetOS, ImmutableArray <byte> runtimeModuleBuildId, string dbiModulePath, string dacModulePath) { _targetOS = targetOS; _runtimeModuleBuildId = runtimeModuleBuildId; _dbiModulePath = dbiModulePath; _dacModulePath = dacModulePath; VTableBuilder builder = AddInterface(IID_ICLRDebuggingLibraryProvider, validate: false); builder.AddMethod(new ProvideLibraryDelegate(ProvideLibrary)); ILibraryProvider = builder.Complete(); builder = AddInterface(IID_ICLRDebuggingLibraryProvider2, validate: false); builder.AddMethod(new ProvideLibrary2Delegate(ProvideLibrary2)); builder.Complete(); builder = AddInterface(IID_ICLRDebuggingLibraryProvider3, validate: false); builder.AddMethod(new ProvideWindowsLibraryDelegate(ProvideWindowsLibrary)); builder.AddMethod(new ProvideUnixLibraryDelegate(ProvideUnixLibrary)); builder.Complete(); AddRef(); }
public TargetWrapper(IServiceProvider services) { _services = services; _target = services.GetService <ITarget>() ?? throw new DiagnosticsException("No target"); VTableBuilder builder = AddInterface(IID_ITarget, validate: false); builder.AddMethod(new GetOperatingSystemDelegate(GetOperatingSystem)); builder.AddMethod(new GetTempDirectoryDelegate(GetTempDirectory)); builder.AddMethod(new GetRuntimeDelegate(GetRuntime)); builder.AddMethod(new FlushDelegate(Flush)); ITarget = builder.Complete(); AddRef(); }
/// <summary> /// Create an instance of the service wrapper SOS uses. /// </summary> /// <param name="soshost">SOS host instance</param> public DebugClient(SOSHost soshost) { VTableBuilder builder = AddInterface(typeof(IDebugClient).GUID, validate: true); AddDebugClient(builder, soshost); IDebugClient = builder.Complete(); _debugAdvanced = new DebugAdvanced(this, soshost); _debugControl = new DebugControl(this, soshost); _debugDataSpaces = new DebugDataSpaces(this, soshost); _debugRegisters = new DebugRegisters(this, soshost); _debugSymbols = new DebugSymbols(this, soshost); _debugSystemObjects = new DebugSystemObjects(this, soshost); AddRef(); }
public TargetWrapper(ITarget target) { Debug.Assert(target != null); _target = target; VTableBuilder builder = AddInterface(IID_ITarget, validate: false); builder.AddMethod(new GetOperatingSystemDelegate(GetOperatingSystem)); builder.AddMethod(new GetTempDirectoryDelegate(GetTempDirectory)); builder.AddMethod(new GetRuntimeDirectoryDelegate(GetRuntimeDirectory)); builder.AddMethod(new GetRuntimeDelegate(GetRuntime)); builder.AddMethod(new FlushDelegate(Flush)); builder.AddMethod(new CloseDelegate(Close)); ITarget = builder.Complete(); AddRef(); }
public SymbolServiceWrapper(ISymbolService symbolService, IMemoryService memoryService) { Debug.Assert(symbolService != null); Debug.Assert(memoryService != null); _symbolService = symbolService; _memoryService = memoryService; _ignoreAddressBitsMask = memoryService.SignExtensionMask(); Debug.Assert(_symbolService != null); VTableBuilder builder = AddInterface(IID_ISymbolService, validate: false); builder.AddMethod(new ParseSymbolPathDelegate(ParseSymbolPath)); builder.AddMethod(new LoadSymbolsForModuleDelegate(LoadSymbolsForModule)); builder.AddMethod(new DisposeDelegate(Dispose)); builder.AddMethod(new ResolveSequencePointDelegate(ResolveSequencePoint)); builder.AddMethod(new GetLocalVariableNameDelegate(GetLocalVariableName)); builder.AddMethod(new GetLineByILOffsetDelegate(GetLineByILOffset)); builder.AddMethod(new GetExpressionValueDelegate(GetExpressionValue)); builder.AddMethod(new GetMetadataLocatorDelegate(GetMetadataLocator)); builder.AddMethod(new GetICorDebugMetadataLocatorDelegate(GetICorDebugMetadataLocator)); builder.Complete(); AddRef(); }