From 4bacd46c01513d9990ac66fa050eb69dfb1168b8 Mon Sep 17 00:00:00 2001 From: Oleg Lekarev Date: Thu, 16 Jun 2022 17:56:52 +0300 Subject: [PATCH] Change return value type from HResult to int to avoid crash on Linux x86 --- src/SOS/SOS.Extensions/DebuggerServices.cs | 92 +++++++++---------- src/SOS/SOS.Extensions/HostServices.cs | 26 +++--- .../ModuleServiceFromDebuggerServices.cs | 9 +- src/SOS/SOS.Extensions/RemoteMemoryService.cs | 4 +- src/SOS/SOS.Hosting/DataTargetWrapper.cs | 60 ++++++------ src/SOS/SOS.Hosting/HostWrapper.cs | 6 +- src/SOS/SOS.Hosting/ServiceWrapper.cs | 2 +- src/SOS/SOS.Hosting/TargetWrapper.cs | 4 +- 8 files changed, 103 insertions(+), 100 deletions(-) diff --git a/src/SOS/SOS.Extensions/DebuggerServices.cs b/src/SOS/SOS.Extensions/DebuggerServices.cs index 98ba7995d8..7eed52e670 100644 --- a/src/SOS/SOS.Extensions/DebuggerServices.cs +++ b/src/SOS/SOS.Extensions/DebuggerServices.cs @@ -37,22 +37,22 @@ internal DebuggerServices(IntPtr punk, HostType hostType) _hostType = hostType; } - public HResult GetOperatingSystem(out DebuggerServices.OperatingSystem operatingSystem) + public int GetOperatingSystem(out DebuggerServices.OperatingSystem operatingSystem) { return VTable.GetOperatingSystem(Self, out operatingSystem); } - public HResult GetDebuggeeType(out DEBUG_CLASS debugClass, out DEBUG_CLASS_QUALIFIER qualifier) + public int GetDebuggeeType(out DEBUG_CLASS debugClass, out DEBUG_CLASS_QUALIFIER qualifier) { return VTable.GetDebuggeeType(Self, out debugClass, out qualifier); } - public HResult GetExecutingProcessorType(out IMAGE_FILE_MACHINE type) + public int GetExecutingProcessorType(out IMAGE_FILE_MACHINE type) { return VTable.GetExecutingProcessorType(Self, out type); } - public HResult AddCommand(string command, string help, IEnumerable aliases) + public int AddCommand(string command, string help, IEnumerable aliases) { if (string.IsNullOrEmpty(command) || string.IsNullOrEmpty(help) || aliases == null) throw new ArgumentNullException(); @@ -88,7 +88,7 @@ public void OutputString(DEBUG_OUTPUT mask, string message) } } - public HResult ReadVirtual(ulong offset, Span buffer, out int bytesRead) + public int ReadVirtual(ulong offset, Span buffer, out int bytesRead) { fixed (byte* bufferPtr = buffer) { @@ -96,7 +96,7 @@ public HResult ReadVirtual(ulong offset, Span buffer, out int bytesRead) } } - public HResult WriteVirtual(ulong offset, Span buffer, out int bytesWritten) + public int WriteVirtual(ulong offset, Span buffer, out int bytesWritten) { fixed (byte* bufferPtr = buffer) { @@ -104,12 +104,12 @@ public HResult WriteVirtual(ulong offset, Span buffer, out int bytesWritte } } - public HResult GetNumberModules(out uint loaded, out uint unloaded) + public int GetNumberModules(out uint loaded, out uint unloaded) { return VTable.GetNumberModules(Self, out loaded, out unloaded); } - public HResult GetModuleName(int index, out string imageName) + public int GetModuleName(int index, out string imageName) { imageName = null; @@ -148,14 +148,14 @@ public HResult GetModuleName(int index, out string imageName) } } - public HResult GetModuleInfo(int index, out ulong moduleBase, out ulong moduleSize, out uint timestamp, out uint checksum) + public int GetModuleInfo(int index, out ulong moduleBase, out ulong moduleSize, out uint timestamp, out uint checksum) { return VTable.GetModuleInfo(Self, (uint)index, out moduleBase, out moduleSize, out timestamp, out checksum); } private static readonly byte[] s_getVersionInfo = Encoding.ASCII.GetBytes("\\\0"); - public HResult GetModuleVersionInformation(int index, out VS_FIXEDFILEINFO fileInfo) + public int GetModuleVersionInformation(int index, out VS_FIXEDFILEINFO fileInfo) { int versionBufferSize = Marshal.SizeOf(typeof(VS_FIXEDFILEINFO)); byte[] versionBuffer = new byte[versionBufferSize]; @@ -175,7 +175,7 @@ public HResult GetModuleVersionInformation(int index, out VS_FIXEDFILEINFO fileI private static readonly byte[] s_getVersionString = Encoding.ASCII.GetBytes("\\StringFileInfo\\040904B0\\FileVersion\0"); - public HResult GetModuleVersionString(int index, out string version) + public int GetModuleVersionString(int index, out string version) { byte[] versionBuffer = new byte[1024]; version = default; @@ -192,12 +192,12 @@ public HResult GetModuleVersionString(int index, out string version) } } - public HResult GetNumberThreads(out uint number) + public int GetNumberThreads(out uint number) { return VTable.GetNumberThreads(Self, out number); } - public HResult GetThreadIdsByIndex(uint start, uint count, uint[] ids, uint[] sysIds) + public int GetThreadIdsByIndex(uint start, uint count, uint[] ids, uint[] sysIds) { if (ids != null && (start >= ids.Length || start + count > ids.Length)) throw new ArgumentOutOfRangeException(nameof(ids)); if (sysIds != null && (start >= sysIds.Length || start + count > sysIds.Length)) throw new ArgumentOutOfRangeException(nameof(sysIds)); @@ -211,7 +211,7 @@ public HResult GetThreadIdsByIndex(uint start, uint count, uint[] ids, uint[] sy } } - public HResult GetThreadContext(uint threadId, uint contextFlags, uint contextSize, byte[] context) + public int GetThreadContext(uint threadId, uint contextFlags, uint contextSize, byte[] context) { fixed (byte* contextPtr = context) { @@ -219,29 +219,29 @@ public HResult GetThreadContext(uint threadId, uint contextFlags, uint contextSi } } - public HResult GetCurrentProcessId(out uint processId) + public int GetCurrentProcessId(out uint processId) { return VTable.GetCurrentProcessSystemId(Self, out processId); } - public HResult GetCurrentThreadId(out uint threadId) + public int GetCurrentThreadId(out uint threadId) { return VTable.GetCurrentThreadSystemId(Self, out threadId); } - public HResult SetCurrentThreadId(uint threadId) + public int SetCurrentThreadId(uint threadId) { return VTable.SetCurrentThreadSystemId(Self, threadId); } - public HResult GetThreadTeb(uint threadId, out ulong teb) + public int GetThreadTeb(uint threadId, out ulong teb) { // The native code may zero out this return pointer teb = 0; return VTable.GetThreadTeb(Self, threadId, out teb); } - public HResult VirtualUnwind(uint threadId, uint contextSize, byte[] context) + public int VirtualUnwind(uint threadId, uint contextSize, byte[] context) { fixed (byte* contextPtr = context) { @@ -249,7 +249,7 @@ public HResult VirtualUnwind(uint threadId, uint contextSize, byte[] context) } } - public HResult GetSymbolPath(out string symbolPath) + public int GetSymbolPath(out string symbolPath) { symbolPath = null; @@ -278,7 +278,7 @@ public HResult GetSymbolPath(out string symbolPath) return hr; } - public HResult GetSymbolByOffset(int moduleIndex, ulong address, out string symbol, out ulong displacement) + public int GetSymbolByOffset(int moduleIndex, ulong address, out string symbol, out ulong displacement) { symbol = null; @@ -315,7 +315,7 @@ public HResult GetSymbolByOffset(int moduleIndex, ulong address, out string symb return hr; } - public HResult GetOffsetBySymbol(int moduleIndex, string symbol, out ulong address) + public int GetOffsetBySymbol(int moduleIndex, string symbol, out ulong address) { if (symbol == null) throw new ArgumentNullException(nameof(symbol)); @@ -349,7 +349,7 @@ public void OutputDmlString(DEBUG_OUTPUT mask, string message) } } - public HResult AddModuleSymbol(string symbolFileName) + public int AddModuleSymbol(string symbolFileName) { if (symbolFileName == null) { @@ -365,32 +365,32 @@ public HResult AddModuleSymbol(string symbolFileName) [StructLayout(LayoutKind.Sequential)] private readonly unsafe struct IDebuggerServicesVTable { - public readonly delegate* unmanaged[Stdcall] GetOperatingSystem; - public readonly delegate* unmanaged[Stdcall] GetDebuggeeType; - public readonly delegate* unmanaged[Stdcall] GetExecutingProcessorType; - public readonly delegate* unmanaged[Stdcall] AddCommand; + public readonly delegate* unmanaged[Stdcall] GetOperatingSystem; + public readonly delegate* unmanaged[Stdcall] GetDebuggeeType; + public readonly delegate* unmanaged[Stdcall] GetExecutingProcessorType; + public readonly delegate* unmanaged[Stdcall] AddCommand; public readonly delegate* unmanaged[Stdcall] OutputString; - public readonly delegate* unmanaged[Stdcall] ReadVirtual; - public readonly delegate* unmanaged[Stdcall] WriteVirtual; - public readonly delegate* unmanaged[Stdcall] GetNumberModules; - public readonly delegate* unmanaged[Stdcall] GetModuleNames; - public readonly delegate* unmanaged[Stdcall] GetModuleInfo; - public readonly delegate* unmanaged[Stdcall] GetModuleVersionInformation; - public readonly delegate* unmanaged[Stdcall] GetNumberThreads; - public readonly delegate* unmanaged[Stdcall] GetThreadIdsByIndex; - public readonly delegate* unmanaged[Stdcall] GetThreadContextBySystemId; - public readonly delegate* unmanaged[Stdcall] GetCurrentProcessSystemId; - public readonly delegate* unmanaged[Stdcall] GetCurrentThreadSystemId; - public readonly delegate* unmanaged[Stdcall] SetCurrentThreadSystemId; - public readonly delegate* unmanaged[Stdcall] GetThreadTeb; - public readonly delegate* unmanaged[Stdcall] VirtualUnwind; - public readonly delegate* unmanaged[Stdcall] GetSymbolPath; - public readonly delegate* unmanaged[Stdcall] GetSymbolByOffset; - public readonly delegate* unmanaged[Stdcall] GetOffsetBySymbol; + public readonly delegate* unmanaged[Stdcall] ReadVirtual; + public readonly delegate* unmanaged[Stdcall] WriteVirtual; + public readonly delegate* unmanaged[Stdcall] GetNumberModules; + public readonly delegate* unmanaged[Stdcall] GetModuleNames; + public readonly delegate* unmanaged[Stdcall] GetModuleInfo; + public readonly delegate* unmanaged[Stdcall] GetModuleVersionInformation; + public readonly delegate* unmanaged[Stdcall] GetNumberThreads; + public readonly delegate* unmanaged[Stdcall] GetThreadIdsByIndex; + public readonly delegate* unmanaged[Stdcall] GetThreadContextBySystemId; + public readonly delegate* unmanaged[Stdcall] GetCurrentProcessSystemId; + public readonly delegate* unmanaged[Stdcall] GetCurrentThreadSystemId; + public readonly delegate* unmanaged[Stdcall] SetCurrentThreadSystemId; + public readonly delegate* unmanaged[Stdcall] GetThreadTeb; + public readonly delegate* unmanaged[Stdcall] VirtualUnwind; + public readonly delegate* unmanaged[Stdcall] GetSymbolPath; + public readonly delegate* unmanaged[Stdcall] GetSymbolByOffset; + public readonly delegate* unmanaged[Stdcall] GetOffsetBySymbol; public readonly delegate* unmanaged[Stdcall] GetOutputWidth; - public readonly delegate* unmanaged[Stdcall] SupportsDml; + public readonly delegate* unmanaged[Stdcall] SupportsDml; public readonly delegate* unmanaged[Stdcall] OutputDmlString; - public readonly delegate* unmanaged[Stdcall] AddModuleSymbol; + public readonly delegate* unmanaged[Stdcall] AddModuleSymbol; } } } diff --git a/src/SOS/SOS.Extensions/HostServices.cs b/src/SOS/SOS.Extensions/HostServices.cs index 41b9947ac8..ac466adac6 100644 --- a/src/SOS/SOS.Extensions/HostServices.cs +++ b/src/SOS/SOS.Extensions/HostServices.cs @@ -29,7 +29,7 @@ public sealed unsafe class HostServices : COMCallableIUnknown, IHost /// The instance of the host services for the native code to use /// [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate HResult InitializeCallbackDelegate( + private delegate int InitializeCallbackDelegate( IntPtr hostServices); internal IntPtr IHostServices { get; } @@ -177,7 +177,7 @@ public void DestroyTarget(ITarget target) #region IHostServices - private HResult GetHost( + private int GetHost( IntPtr self, out IntPtr host) { @@ -186,7 +186,7 @@ private HResult GetHost( return HResult.S_OK; } - private HResult RegisterDebuggerServices( + private int RegisterDebuggerServices( IntPtr self, IntPtr iunk) { @@ -257,7 +257,7 @@ private HResult RegisterDebuggerServices( return HResult.S_OK; } - private HResult CreateTarget( + private int CreateTarget( IntPtr self) { Trace.TraceInformation("HostServices.CreateTarget"); @@ -279,7 +279,7 @@ private HResult CreateTarget( return HResult.S_OK; } - private HResult UpdateTarget( + private int UpdateTarget( IntPtr self, uint processId) { @@ -323,7 +323,7 @@ private void DestroyTarget( } } - private HResult DispatchCommand( + private int DispatchCommand( IntPtr self, string commandLine) { @@ -342,7 +342,7 @@ private HResult DispatchCommand( return HResult.E_FAIL; } - private HResult DisplayHelp( + private int DisplayHelp( IntPtr self, string command) { @@ -395,21 +395,21 @@ private void Uninitialize( #region IHostServices delegates [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetHostDelegate( + private delegate int GetHostDelegate( [In] IntPtr self, [Out] out IntPtr host); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult RegisterDebuggerServicesDelegate( + private delegate int RegisterDebuggerServicesDelegate( [In] IntPtr self, [In] IntPtr iunk); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult CreateTargetDelegate( + private delegate int CreateTargetDelegate( [In] IntPtr self); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult UpdateTargetDelegate( + private delegate int UpdateTargetDelegate( [In] IntPtr self, [In] uint processId); @@ -422,12 +422,12 @@ private delegate void DestroyTargetDelegate( [In] IntPtr self); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult DispatchCommandDelegate( + private delegate int DispatchCommandDelegate( [In] IntPtr self, [In, MarshalAs(UnmanagedType.LPStr)] string commandLine); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult DisplayHelpDelegate( + private delegate int DisplayHelpDelegate( [In] IntPtr self, [In, MarshalAs(UnmanagedType.LPStr)] string command); diff --git a/src/SOS/SOS.Extensions/ModuleServiceFromDebuggerServices.cs b/src/SOS/SOS.Extensions/ModuleServiceFromDebuggerServices.cs index f94977be0c..b2f5153471 100644 --- a/src/SOS/SOS.Extensions/ModuleServiceFromDebuggerServices.cs +++ b/src/SOS/SOS.Extensions/ModuleServiceFromDebuggerServices.cs @@ -118,19 +118,22 @@ public override string LoadSymbols() bool IModuleSymbols.TryGetSymbolName(ulong address, out string symbol, out ulong displacement) { - return _moduleService._debuggerServices.GetSymbolByOffset(ModuleIndex, address, out symbol, out displacement).IsOK; + HResult hr = _moduleService._debuggerServices.GetSymbolByOffset(ModuleIndex, address, out symbol, out displacement); + return hr.IsOK; } bool IModuleSymbols.TryGetSymbolAddress(string name, out ulong address) { - return _moduleService._debuggerServices.GetOffsetBySymbol(ModuleIndex, name, out address).IsOK; + HResult hr = _moduleService._debuggerServices.GetOffsetBySymbol(ModuleIndex, name, out address); + return hr.IsOK; } #endregion protected override bool TryGetSymbolAddressInner(string name, out ulong address) { - return _moduleService._debuggerServices.GetOffsetBySymbol(ModuleIndex, name, out address).IsOK; + HResult hr = _moduleService._debuggerServices.GetOffsetBySymbol(ModuleIndex, name, out address); + return hr.IsOK; } protected override ModuleService ModuleService => _moduleService; diff --git a/src/SOS/SOS.Extensions/RemoteMemoryService.cs b/src/SOS/SOS.Extensions/RemoteMemoryService.cs index 70aa7598ef..307b657444 100644 --- a/src/SOS/SOS.Extensions/RemoteMemoryService.cs +++ b/src/SOS/SOS.Extensions/RemoteMemoryService.cs @@ -35,8 +35,8 @@ public bool FreeMemory(ulong address, uint size, uint typeFlags) [StructLayout(LayoutKind.Sequential)] private readonly unsafe struct IRemoteMemoryServiceVTable { - public readonly delegate* unmanaged[Stdcall] AllocVirtual; - public readonly delegate* unmanaged[Stdcall] FreeVirtual; + public readonly delegate* unmanaged[Stdcall] AllocVirtual; + public readonly delegate* unmanaged[Stdcall] FreeVirtual; } } } diff --git a/src/SOS/SOS.Hosting/DataTargetWrapper.cs b/src/SOS/SOS.Hosting/DataTargetWrapper.cs index 48e4e2fbb3..826143d224 100644 --- a/src/SOS/SOS.Hosting/DataTargetWrapper.cs +++ b/src/SOS/SOS.Hosting/DataTargetWrapper.cs @@ -101,7 +101,7 @@ protected override void Destroy() #region ICLRDataTarget - private HResult GetMachineType( + private int GetMachineType( IntPtr self, out IMAGE_FILE_MACHINE machineType) { @@ -121,7 +121,7 @@ private HResult GetMachineType( return HResult.S_OK; } - private HResult GetPointerSize( + private int GetPointerSize( IntPtr self, out int pointerSize) { @@ -129,7 +129,7 @@ private HResult GetPointerSize( return HResult.S_OK; } - private HResult GetImageBase( + private int GetImageBase( IntPtr self, string imagePath, out ulong baseAddress) @@ -144,7 +144,7 @@ private HResult GetImageBase( return HResult.E_FAIL; } - private HResult ReadVirtual( + private int ReadVirtual( IntPtr self, ulong address, IntPtr buffer, @@ -163,7 +163,7 @@ private HResult ReadVirtual( return HResult.S_OK; } - private HResult WriteVirtual( + private int WriteVirtual( IntPtr self, ulong address, IntPtr buffer, @@ -180,7 +180,7 @@ private HResult WriteVirtual( return HResult.S_OK; } - private HResult GetTLSValue( + private int GetTLSValue( IntPtr self, uint threadId, uint index, @@ -189,7 +189,7 @@ private HResult GetTLSValue( return HResult.E_NOTIMPL; } - private HResult SetTLSValue( + private int SetTLSValue( IntPtr self, uint threadId, uint index, @@ -198,7 +198,7 @@ private HResult SetTLSValue( return HResult.E_NOTIMPL; } - private HResult GetCurrentThreadID( + private int GetCurrentThreadID( IntPtr self, out uint threadId) { @@ -212,7 +212,7 @@ private HResult GetCurrentThreadID( return HResult.E_FAIL; } - private HResult GetThreadContext( + private int GetThreadContext( IntPtr self, uint threadId, uint contextFlags, @@ -241,7 +241,7 @@ private HResult GetThreadContext( return HResult.S_OK; } - private HResult SetThreadContext( + private int SetThreadContext( IntPtr self, uint threadId, int contextSize, @@ -250,7 +250,7 @@ private HResult SetThreadContext( return HResult.E_NOTIMPL; } - private HResult Request( + private int Request( IntPtr self, uint reqCode, uint inBufferSize, @@ -265,7 +265,7 @@ private HResult Request( #region ICLRDataTarget2 - private HResult AllocVirtual( + private int AllocVirtual( IntPtr self, ulong address, uint size, @@ -283,7 +283,7 @@ private HResult AllocVirtual( return HResult.S_OK; } - private HResult FreeVirtual( + private int FreeVirtual( IntPtr self, ulong address, uint size, @@ -325,7 +325,7 @@ private int VirtualUnwind( #region ICLRMetadataLocator - private HResult GetMetadata( + private int GetMetadata( IntPtr self, string fileName, uint imageTimestamp, @@ -344,7 +344,7 @@ private HResult GetMetadata( #region ICLRRuntimeLocator - private HResult GetRuntimeBase( + private int GetRuntimeBase( IntPtr self, out ulong address) { @@ -357,23 +357,23 @@ private HResult GetRuntimeBase( #region ICLRDataTarget delegates [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetMachineTypeDelegate( + private delegate int GetMachineTypeDelegate( [In] IntPtr self, [Out] out IMAGE_FILE_MACHINE machineType); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetPointerSizeDelegate( + private delegate int GetPointerSizeDelegate( [In] IntPtr self, [Out] out int pointerSize); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetImageBaseDelegate( + private delegate int GetImageBaseDelegate( [In] IntPtr self, [In][MarshalAs(UnmanagedType.LPWStr)] string imagePath, [Out] out ulong baseAddress); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ReadVirtualDelegate( + private delegate int ReadVirtualDelegate( [In] IntPtr self, [In] ulong address, [In] IntPtr buffer, @@ -381,7 +381,7 @@ private delegate HResult ReadVirtualDelegate( [Out] uint* bytesRead); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult WriteVirtualDelegate( + private delegate int WriteVirtualDelegate( [In] IntPtr self, [In] ulong address, [In] IntPtr buffer, @@ -389,26 +389,26 @@ private delegate HResult WriteVirtualDelegate( [Out] uint* bytesWritten); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetTLSValueDelegate( + private delegate int GetTLSValueDelegate( [In] IntPtr self, [In] uint threadId, [In] uint index, [Out] ulong* value); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult SetTLSValueDelegate( + private delegate int SetTLSValueDelegate( [In] IntPtr self, [In] uint threadId, [In] uint index, [In] ulong value); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetCurrentThreadIDDelegate( + private delegate int GetCurrentThreadIDDelegate( [In] IntPtr self, [Out] out uint threadId); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetThreadContextDelegate( + private delegate int GetThreadContextDelegate( [In] IntPtr self, [In] uint threadId, [In] uint contextFlags, @@ -416,14 +416,14 @@ private delegate HResult GetThreadContextDelegate( [Out] IntPtr context); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult SetThreadContextDelegate( + private delegate int SetThreadContextDelegate( [In] IntPtr self, [In] uint threadId, [In] int contextSize, [In] IntPtr context); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult RequestDelegate( + private delegate int RequestDelegate( [In] IntPtr self, [In] uint reqCode, [In] uint inBufferSize, @@ -436,7 +436,7 @@ private delegate HResult RequestDelegate( #region ICLRDataTarget2 delegates [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult AllocVirtualDelegate( + private delegate int AllocVirtualDelegate( [In] IntPtr self, [In] ulong address, [In] uint size, @@ -445,7 +445,7 @@ private delegate HResult AllocVirtualDelegate( [Out] ulong* buffer); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult FreeVirtualDelegate( + private delegate int FreeVirtualDelegate( [In] IntPtr self, [In] ulong address, [In] uint size, @@ -467,7 +467,7 @@ private delegate int VirtualUnwindDelegate( #region ICLRMetadataLocator delegate [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetMetadataDelegate( + private delegate int GetMetadataDelegate( [In] IntPtr self, [In][MarshalAs(UnmanagedType.LPWStr)] string fileName, [In] uint imageTimestamp, @@ -484,7 +484,7 @@ [In] [MarshalAs(UnmanagedType.LPArray, SizeConst = 16)] byte[] mvid, #region ICLRRuntimeLocator delegate [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetRuntimeBaseDelegate( + private delegate int GetRuntimeBaseDelegate( [In] IntPtr self, [Out] out ulong address); diff --git a/src/SOS/SOS.Hosting/HostWrapper.cs b/src/SOS/SOS.Hosting/HostWrapper.cs index e1fb16bb27..5b9a2c17de 100644 --- a/src/SOS/SOS.Hosting/HostWrapper.cs +++ b/src/SOS/SOS.Hosting/HostWrapper.cs @@ -48,7 +48,7 @@ public HostWrapper(IHost host, Func getTarget) /// /// target wrapper address returned /// S_OK - private HResult GetCurrentTarget(IntPtr self, out IntPtr targetWrapper) + private int GetCurrentTarget(IntPtr self, out IntPtr targetWrapper) { TargetWrapper wrapper = _getTarget(); if (wrapper == null) @@ -70,13 +70,13 @@ private delegate HostType GetHostTypeDelegate( [In] IntPtr self); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - internal delegate HResult GetServiceDelegate( + internal delegate int GetServiceDelegate( [In] IntPtr self, [In] in Guid guid, [Out] out IntPtr ptr); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetCurrentTargetDelegate( + private delegate int GetCurrentTargetDelegate( [In] IntPtr self, [Out] out IntPtr target); diff --git a/src/SOS/SOS.Hosting/ServiceWrapper.cs b/src/SOS/SOS.Hosting/ServiceWrapper.cs index 7dbf7dc016..43ac85e9a6 100644 --- a/src/SOS/SOS.Hosting/ServiceWrapper.cs +++ b/src/SOS/SOS.Hosting/ServiceWrapper.cs @@ -87,7 +87,7 @@ public COMCallableIUnknown GetServiceWrapper(in Guid serviceId) /// guid of the service /// pointer to return service instance /// S_OK or E_NOINTERFACE - public HResult GetService(IntPtr self, in Guid guid, out IntPtr ptr) + public int GetService(IntPtr self, in Guid guid, out IntPtr ptr) { ptr = IntPtr.Zero; diff --git a/src/SOS/SOS.Hosting/TargetWrapper.cs b/src/SOS/SOS.Hosting/TargetWrapper.cs index e20be17d98..6a5531814f 100644 --- a/src/SOS/SOS.Hosting/TargetWrapper.cs +++ b/src/SOS/SOS.Hosting/TargetWrapper.cs @@ -82,7 +82,7 @@ private string GetTempDirectory( return _target.GetTempDirectory(); } - private HResult GetRuntime( + private int GetRuntime( IntPtr self, IntPtr* ppRuntime) { @@ -120,7 +120,7 @@ private delegate string GetTempDirectoryDelegate( [In] IntPtr self); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult GetRuntimeDelegate( + private delegate int GetRuntimeDelegate( [In] IntPtr self, [Out] IntPtr* ppRuntime);