From 646f418ab58d1c74970b729cb880b2e3a7adfb1c Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Mon, 29 Aug 2022 18:39:27 -0700 Subject: [PATCH] Misc SOS fixes and cleanup. Use new EnumMemoryRegion flags. Update the clrdata.idl/clrdata.h/clrdata_i.cpp to the new DAC log message interface name. Change the name of the "enummemory" command to "enummem". Add memory region verify on the callback. Fix dumpobj/dumpruntimetypes with TypeDescs. Add memory usage stats to sosstatus. Fix issue https://github.com/dotnet/diagnostics/issues/3187. dotnet-dump analyze causes an Exception when console width is 0. Fix issue https://github.com/dotnet/diagnostics/issues/3120. Increase (remove) max heap segment. Finish https://github.com/dotnet/diagnostics/issues/3101. SOS should stop using HResult as a PInvoke return. --- .../Host/StatusCommand.cs | 3 + .../ConsoleService.cs | 5 +- src/SOS/SOS.Extensions/HostServices.cs | 26 +++--- src/SOS/SOS.Hosting/Commands/SOSCommand.cs | 1 + src/SOS/Strike/eeheap.cpp | 15 +-- src/SOS/Strike/sos.def | 2 +- src/SOS/Strike/sos_unixexports.src | 2 +- src/SOS/Strike/strike.cpp | 91 ++++++++++++++----- src/SOS/Strike/util.cpp | 2 +- src/SOS/Strike/util.h | 4 - src/Tools/dotnet-dump/Commands/SOSCommand.cs | 2 +- src/shared/inc/clrdata.idl | 2 +- src/shared/pal/prebuilt/idl/clrdata_i.cpp | 5 +- src/shared/pal/prebuilt/inc/clrdata.h | 52 ++++++----- src/tests/DbgShim.UnitTests/DbgShimAPI.cs | 34 +++---- src/tests/DbgShim.UnitTests/ICLRDebugging.cs | 2 +- src/tests/DbgShim.UnitTests/ICorDebug.cs | 12 +-- .../DbgShim.UnitTests/ICorDebugController.cs | 16 ++-- .../LibraryProviderWrapper.cs | 16 ++-- .../ManagedCallbackWrapper.cs | 68 +++++++------- .../TestDbgEng.cs | 2 +- 21 files changed, 199 insertions(+), 163 deletions(-) diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/Host/StatusCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/Host/StatusCommand.cs index 5edce2a823..6f11b8b035 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/Host/StatusCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/Host/StatusCommand.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using Microsoft.Diagnostics.DebugServices; +using System; namespace Microsoft.Diagnostics.ExtensionCommands { @@ -27,6 +28,8 @@ public override void Invoke() { Write(Target.ToString()); Write(SymbolService.ToString()); + long memoryUsage = GC.GetTotalMemory(forceFullCollection: true); + WriteLine($"GC memory usage: {memoryUsage:##,#} bytes"); } } } diff --git a/src/Microsoft.Diagnostics.Repl/ConsoleService.cs b/src/Microsoft.Diagnostics.Repl/ConsoleService.cs index fa4687baea..27bd1b4223 100644 --- a/src/Microsoft.Diagnostics.Repl/ConsoleService.cs +++ b/src/Microsoft.Diagnostics.Repl/ConsoleService.cs @@ -268,8 +268,9 @@ private void ClearLine() return; } - if (m_clearLine == null || m_clearLine.Length != Console.WindowWidth) { - m_clearLine = "\r" + new string(' ', Console.WindowWidth - 1); + int width = Console.WindowWidth; + if (m_clearLine == null || width != m_clearLine.Length) { + m_clearLine = "\r" + (width > 0 ? new string(' ', width - 1) : ""); } Console.Write(m_clearLine); diff --git a/src/SOS/SOS.Extensions/HostServices.cs b/src/SOS/SOS.Extensions/HostServices.cs index 91308b8945..f83d94b6d6 100644 --- a/src/SOS/SOS.Extensions/HostServices.cs +++ b/src/SOS/SOS.Extensions/HostServices.cs @@ -30,7 +30,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; } @@ -178,7 +178,7 @@ public void DestroyTarget(ITarget target) #region IHostServices - private HResult GetHost( + private int GetHost( IntPtr self, out IntPtr host) { @@ -187,7 +187,7 @@ private HResult GetHost( return HResult.S_OK; } - private HResult RegisterDebuggerServices( + private int RegisterDebuggerServices( IntPtr self, IntPtr iunk) { @@ -258,7 +258,7 @@ private HResult RegisterDebuggerServices( return HResult.S_OK; } - private HResult CreateTarget( + private int CreateTarget( IntPtr self) { Trace.TraceInformation("HostServices.CreateTarget"); @@ -280,7 +280,7 @@ private HResult CreateTarget( return HResult.S_OK; } - private HResult UpdateTarget( + private int UpdateTarget( IntPtr self, uint processId) { @@ -324,7 +324,7 @@ private void DestroyTarget( } } - private HResult DispatchCommand( + private int DispatchCommand( IntPtr self, string commandName, string commandArguments) @@ -358,7 +358,7 @@ private HResult DispatchCommand( return HResult.E_FAIL; } - private HResult DisplayHelp( + private int DisplayHelp( IntPtr self, string commandName) { @@ -411,21 +411,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); @@ -438,13 +438,13 @@ 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 commandName, [In, MarshalAs(UnmanagedType.LPStr)] string commandArguments); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult DisplayHelpDelegate( + private delegate int DisplayHelpDelegate( [In] IntPtr self, [In, MarshalAs(UnmanagedType.LPStr)] string commandName); diff --git a/src/SOS/SOS.Hosting/Commands/SOSCommand.cs b/src/SOS/SOS.Hosting/Commands/SOSCommand.cs index d4e5f38570..2d011c4804 100644 --- a/src/SOS/SOS.Hosting/Commands/SOSCommand.cs +++ b/src/SOS/SOS.Hosting/Commands/SOSCommand.cs @@ -36,6 +36,7 @@ namespace SOS.Hosting [Command(Name = "eeheap", DefaultOptions = "EEHeap", Help = "Displays info about process memory consumed by internal runtime data structures.")] [Command(Name = "eeversion", DefaultOptions = "EEVersion", Help = "Displays information about the runtime version.")] [Command(Name = "ehinfo", DefaultOptions = "EHInfo", Help = "Displays the exception handling blocks in a jitted method.")] + [Command(Name = "enummem", DefaultOptions = "enummem", Help = "ICLRDataEnumMemoryRegions.EnumMemoryRegions test command.")] [Command(Name = "finalizequeue", DefaultOptions = "FinalizeQueue", Help = "Displays all objects registered for finalization.")] [Command(Name = "findappdomain", DefaultOptions = "FindAppDomain", Help = "Attempts to resolve the AppDomain of a GC object.")] [Command(Name = "gchandles", DefaultOptions = "GCHandles", Help = "Provides statistics about GCHandles in the process.")] diff --git a/src/SOS/Strike/eeheap.cpp b/src/SOS/Strike/eeheap.cpp index 53a7d62621..2eb5d99319 100644 --- a/src/SOS/Strike/eeheap.cpp +++ b/src/SOS/Strike/eeheap.cpp @@ -518,7 +518,7 @@ void GCPrintSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_allocated_si dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration()].start_segment; total_allocated_size = 0; total_committed_size = 0; - // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments + while (dwAddrSeg != (DWORD_PTR)heap.generation_table[0].start_segment) { if (IsInterrupt()) @@ -567,7 +567,6 @@ void GCPrintLargeHeapSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_all dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration()+1].start_segment; // total_size = 0; - // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments while (dwAddrSeg != NULL) { if (IsInterrupt()) @@ -598,7 +597,6 @@ void GCPrintPinnedHeapSegmentInfo(const GCHeapDetails &heap, DWORD_PTR &total_al DacpHeapSegmentData segment; dwAddrSeg = (DWORD_PTR)heap.generation_table[GetMaxGeneration() + 2].start_segment; - // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments while (dwAddrSeg != NULL) { if (IsInterrupt()) @@ -689,7 +687,6 @@ BOOL GCObjInSegment(TADDR taddrObj, const GCHeapDetails &heap, { taddrSeg = (TADDR)heap.generation_table[gen_num].start_segment; - // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments while (taddrSeg != NULL) { if (IsInterrupt()) @@ -715,7 +712,7 @@ BOOL GCObjInSegment(TADDR taddrObj, const GCHeapDetails &heap, else { taddrSeg = (TADDR)heap.generation_table[GetMaxGeneration()].start_segment; - // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments + while (taddrSeg != (TADDR)heap.generation_table[0].start_segment) { if (IsInterrupt()) @@ -765,7 +762,6 @@ BOOL GCObjInLargeSegment(TADDR taddrObj, const GCHeapDetails &heap, TADDR_SEGINF DacpHeapSegmentData dacpSeg; taddrSeg = (TADDR)heap.generation_table[GetMaxGeneration()+1].start_segment; - // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments while (taddrSeg != NULL) { if (IsInterrupt()) @@ -798,7 +794,6 @@ BOOL GCObjInPinnedObjectSegment(TADDR taddrObj, const GCHeapDetails &heap, TADDR DacpHeapSegmentData dacpSeg; taddrSeg = (TADDR)heap.generation_table[GetMaxGeneration() + 2].start_segment; - // the loop below will terminate, because we retrieved at most nMaxHeapSegmentCount segments while (taddrSeg != NULL) { if (IsInterrupt()) @@ -1921,12 +1916,6 @@ BOOL GCHeapSnapshot::AddSegments(const GCHeapDetails& details) ExtOut("Error requesting heap segment %p\n", SOS_PTR(AddrSeg)); return FALSE; } - if (n++ > nMaxHeapSegmentCount && !details.has_regions) // that would be insane - { - ExtOut("More than %d heap segments, there must be an error\n", nMaxHeapSegmentCount); - return FALSE; - } - // add the new segment to the array of segments. This will expand the array if necessary if (!m_segments.AddSegment(&segment)) { diff --git a/src/SOS/Strike/sos.def b/src/SOS/Strike/sos.def index 6dec87fd17..0e9876503f 100644 --- a/src/SOS/Strike/sos.def +++ b/src/SOS/Strike/sos.def @@ -74,7 +74,7 @@ EXPORTS EHInfo ehinfo=EHInfo Ehinfo=EHInfo - enummemory + enummem ext sos=ext FinalizeQueue diff --git a/src/SOS/Strike/sos_unixexports.src b/src/SOS/Strike/sos_unixexports.src index 9ac9f71d9a..95b267029e 100644 --- a/src/SOS/Strike/sos_unixexports.src +++ b/src/SOS/Strike/sos_unixexports.src @@ -30,7 +30,7 @@ EEHeap EEVersion EEStack EHInfo -enummemory +enummem FinalizeQueue FindAppDomain FindRoots diff --git a/src/SOS/Strike/strike.cpp b/src/SOS/Strike/strike.cpp index efd0124967..03d0ef1a9a 100644 --- a/src/SOS/Strike/strike.cpp +++ b/src/SOS/Strike/strike.cpp @@ -1455,11 +1455,19 @@ void PrintRuntimeTypeInfo(TADDR p_rtObject, const DacpObjectData & rtObjectData) if (iOffset > 0) { TADDR mtPtr; - if (SUCCEEDED(GetMTOfObject(p_rtObject + iOffset, &mtPtr))) + if (MOVE(mtPtr, p_rtObject + iOffset) == S_OK) { - sos::MethodTable mt = mtPtr; - ExtOut("Type Name: %S\n", mt.GetName()); - DMLOut("Type MT: %s\n", DMLMethodTable(mtPtr)); + // Check if TypeDesc + if ((mtPtr & 2) != 0) + { + ExtOut("TypeDesc: %p\n", mtPtr & ~2); + } + else + { + sos::MethodTable mt = mtPtr; + ExtOut("Type Name: %S\n", mt.GetName()); + DMLOut("Type MT: %s\n", DMLMethodTable(mtPtr)); + } } } } @@ -3912,24 +3920,34 @@ void PrintRuntimeTypes(DWORD_PTR objAddr,size_t Size,DWORD_PTR methodTable,LPVOI { DMLOut(DMLObject(objAddr)); - CLRDATA_ADDRESS appDomain = GetAppDomainForMT(mtPtr); - if (appDomain != NULL) + // Check if TypeDesc + if ((mtPtr & 2) != 0) { - if (appDomain == pArgs->adstore.sharedDomain) - ExtOut(" %" POINTERSIZE "s", "Shared"); - - else if (appDomain == pArgs->adstore.systemDomain) - ExtOut(" %" POINTERSIZE "s", "System"); - else - DMLOut(" %s", DMLDomain(appDomain)); + ExtOut(" %p\n", mtPtr & ~2); } else { - ExtOut(" %" POINTERSIZE "s", "?"); - } + CLRDATA_ADDRESS appDomain = GetAppDomainForMT(mtPtr); + if (appDomain != NULL) + { + if (appDomain == pArgs->adstore.sharedDomain) + ExtOut(" %" POINTERSIZE "s", "Shared"); + + else if (appDomain == pArgs->adstore.systemDomain) + ExtOut(" %" POINTERSIZE "s", "System"); + else + DMLOut(" %s", DMLDomain(appDomain)); + } + else + { + ExtOut(" %" POINTERSIZE "s", "?"); + } - NameForMT_s(mtPtr, g_mdName, mdNameLen); - DMLOut(" %s %S\n", DMLMethodTable(mtPtr), g_mdName); + if (NameForMT_s(mtPtr, g_mdName, mdNameLen)) + { + DMLOut(" %s %S\n", DMLMethodTable(mtPtr), g_mdName); + } + } } } } @@ -15711,16 +15729,18 @@ DECLARE_API(StopOnCatch) return S_OK; } -class EnumMemoryCallback : public ICLRDataEnumMemoryRegionsCallback, ICLRDataEnumMemoryRegionsLoggingCallback +class EnumMemoryCallback : public ICLRDataEnumMemoryRegionsCallback, ICLRDataLoggingCallback { private: LONG m_ref; bool m_log; + bool m_valid; public: - EnumMemoryCallback(bool log) : + EnumMemoryCallback(bool log, bool valid) : m_ref(1), - m_log(log) + m_log(log), + m_valid(valid) { } @@ -15739,9 +15759,9 @@ class EnumMemoryCallback : public ICLRDataEnumMemoryRegionsCallback, ICLRDataEnu AddRef(); return S_OK; } - else if (InterfaceId == IID_ICLRDataEnumMemoryRegionsLoggingCallback) + else if (InterfaceId == IID_ICLRDataLoggingCallback) { - *Interface = (ICLRDataEnumMemoryRegionsLoggingCallback*)this; + *Interface = (ICLRDataLoggingCallback*)this; AddRef(); return S_OK; } @@ -15776,6 +15796,25 @@ class EnumMemoryCallback : public ICLRDataEnumMemoryRegionsCallback, ICLRDataEnu { ExtOut("%016llx %08x\n", address, size); } + if (m_valid) + { + uint64_t start = address; + uint64_t numberPages = (size + DT_OS_PAGE_SIZE - 1) / DT_OS_PAGE_SIZE; + for (size_t p = 0; p < numberPages; p++, start += DT_OS_PAGE_SIZE) + { + BYTE buffer[1]; + ULONG read; + if (FAILED(g_ExtData->ReadVirtual(start, buffer, 1, &read))) + { + ExtOut("Invalid: %016llx %08x start %016llx\n", address, size, start); + break; + } + } + } + if (IsInterrupt()) + { + return COR_E_OPERATIONCANCELED; + } return S_OK; } @@ -15783,11 +15822,15 @@ class EnumMemoryCallback : public ICLRDataEnumMemoryRegionsCallback, ICLRDataEnu /* [in] */ LPCSTR message) { ExtOut("%s", message); + if (IsInterrupt()) + { + return COR_E_OPERATIONCANCELED; + } return S_OK; } }; -DECLARE_API(enummemory) +DECLARE_API(enummem) { INIT_API(); @@ -15795,7 +15838,7 @@ DECLARE_API(enummemory) Status = g_clrData->QueryInterface(__uuidof(ICLRDataEnumMemoryRegions), (void**)&enumMemoryRegions); if (SUCCEEDED(Status)) { - ToRelease callback = new EnumMemoryCallback(false); + ToRelease callback = new EnumMemoryCallback(false, true); ULONG32 minidumpType = (MiniDumpWithPrivateReadWriteMemory | MiniDumpWithDataSegs | diff --git a/src/SOS/Strike/util.cpp b/src/SOS/Strike/util.cpp index 37b3f73ab4..3c55c64420 100644 --- a/src/SOS/Strike/util.cpp +++ b/src/SOS/Strike/util.cpp @@ -4406,7 +4406,7 @@ HRESULT GetMTOfObject(TADDR obj, TADDR *mt) // Read the MethodTable and if we succeed, get rid of the mark bits. HRESULT hr = rvCache->Read(obj, mt, sizeof(TADDR), NULL); if (SUCCEEDED(hr)) - *mt &= ~3; + *mt &= ~sos::Object::METHODTABLE_PTR_LOW_BITMASK; return hr; } diff --git a/src/SOS/Strike/util.h b/src/SOS/Strike/util.h index b8af171e80..f4183780a6 100644 --- a/src/SOS/Strike/util.h +++ b/src/SOS/Strike/util.h @@ -123,15 +123,11 @@ class MethodTable; #define HNDTYPE_SIZEDREF (8) #define HNDTYPE_WEAK_WINRT (9) -// Anything above this we consider abnormal and stop processing heap information -const int nMaxHeapSegmentCount = 1000; - class BaseObject { MethodTable *m_pMethTab; }; - const BYTE gElementTypeInfo[] = { #define TYPEINFO(e,ns,c,s,g,ia,ip,if,im,gv) s, #include "cortypeinfo.h" diff --git a/src/Tools/dotnet-dump/Commands/SOSCommand.cs b/src/Tools/dotnet-dump/Commands/SOSCommand.cs index 4d3a2f4a8f..31e86ce941 100644 --- a/src/Tools/dotnet-dump/Commands/SOSCommand.cs +++ b/src/Tools/dotnet-dump/Commands/SOSCommand.cs @@ -10,7 +10,7 @@ namespace Microsoft.Diagnostics.Tools.Dump { - [Command(Name = "sos", Aliases = new string[] { "ext" }, Help = "Run SOS command", Flags = CommandFlags.Global | CommandFlags.Manual)] + [Command(Name = "sos", Aliases = new string[] { "ext" }, Help = "Run a SOS command.", Flags = CommandFlags.Global | CommandFlags.Manual)] public class SOSCommand : CommandBase { private readonly CommandService _commandService; diff --git a/src/shared/inc/clrdata.idl b/src/shared/inc/clrdata.idl index 4252dc6409..2663a7b057 100644 --- a/src/shared/inc/clrdata.idl +++ b/src/shared/inc/clrdata.idl @@ -296,7 +296,7 @@ interface ICLRDataEnumMemoryRegionsCallback2 : ICLRDataEnumMemoryRegionsCallback local, uuid(F315248D-8B79-49DB-B184-37426559F703) ] -interface ICLRDataEnumMemoryRegionsLoggingCallback : IUnknown +interface ICLRDataLoggingCallback : IUnknown { HRESULT LogMessage( [in] LPCSTR message); diff --git a/src/shared/pal/prebuilt/idl/clrdata_i.cpp b/src/shared/pal/prebuilt/idl/clrdata_i.cpp index 872841a0d9..26d36c133b 100644 --- a/src/shared/pal/prebuilt/idl/clrdata_i.cpp +++ b/src/shared/pal/prebuilt/idl/clrdata_i.cpp @@ -1,4 +1,5 @@ - +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ @@ -86,7 +87,7 @@ MIDL_DEFINE_GUID(IID, IID_ICLRDataEnumMemoryRegionsCallback,0xBCDD6908,0xBA2D,0x MIDL_DEFINE_GUID(IID, IID_ICLRDataEnumMemoryRegionsCallback2,0x3721A26F,0x8B91,0x4D98,0xA3,0x88,0xDB,0x17,0xB3,0x56,0xFA,0xDB); -MIDL_DEFINE_GUID(IID, IID_ICLRDataEnumMemoryRegionsLoggingCallback,0xF315248D,0x8B79,0x49DB,0xB1,0x84,0x37,0x42,0x65,0x59,0xF7,0x03); +MIDL_DEFINE_GUID(IID, IID_ICLRDataLoggingCallback,0xF315248D,0x8B79,0x49DB,0xB1,0x84,0x37,0x42,0x65,0x59,0xF7,0x03); MIDL_DEFINE_GUID(IID, IID_ICLRDataEnumMemoryRegions,0x471c35b4,0x7c2f,0x4ef0,0xa9,0x45,0x00,0xf8,0xc3,0x80,0x56,0xf1); diff --git a/src/shared/pal/prebuilt/inc/clrdata.h b/src/shared/pal/prebuilt/inc/clrdata.h index 3999908b26..802c34a87b 100644 --- a/src/shared/pal/prebuilt/inc/clrdata.h +++ b/src/shared/pal/prebuilt/inc/clrdata.h @@ -1,4 +1,5 @@ - +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. /* this ALWAYS GENERATED file contains the definitions for the interfaces */ @@ -100,11 +101,11 @@ typedef interface ICLRDataEnumMemoryRegionsCallback2 ICLRDataEnumMemoryRegionsCa #endif /* __ICLRDataEnumMemoryRegionsCallback2_FWD_DEFINED__ */ -#ifndef __ICLRDataEnumMemoryRegionsLoggingCallback_FWD_DEFINED__ -#define __ICLRDataEnumMemoryRegionsLoggingCallback_FWD_DEFINED__ -typedef interface ICLRDataEnumMemoryRegionsLoggingCallback ICLRDataEnumMemoryRegionsLoggingCallback; +#ifndef __ICLRDataLoggingCallback_FWD_DEFINED__ +#define __ICLRDataLoggingCallback_FWD_DEFINED__ +typedef interface ICLRDataLoggingCallback ICLRDataLoggingCallback; -#endif /* __ICLRDataEnumMemoryRegionsLoggingCallback_FWD_DEFINED__ */ +#endif /* __ICLRDataLoggingCallback_FWD_DEFINED__ */ #ifndef __ICLRDataEnumMemoryRegions_FWD_DEFINED__ @@ -1205,19 +1206,19 @@ EXTERN_C const IID IID_ICLRDataEnumMemoryRegionsCallback2; #endif /* __ICLRDataEnumMemoryRegionsCallback2_INTERFACE_DEFINED__ */ -#ifndef __ICLRDataEnumMemoryRegionsLoggingCallback_INTERFACE_DEFINED__ -#define __ICLRDataEnumMemoryRegionsLoggingCallback_INTERFACE_DEFINED__ +#ifndef __ICLRDataLoggingCallback_INTERFACE_DEFINED__ +#define __ICLRDataLoggingCallback_INTERFACE_DEFINED__ -/* interface ICLRDataEnumMemoryRegionsLoggingCallback */ +/* interface ICLRDataLoggingCallback */ /* [uuid][local][object] */ -EXTERN_C const IID IID_ICLRDataEnumMemoryRegionsLoggingCallback; +EXTERN_C const IID IID_ICLRDataLoggingCallback; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("F315248D-8B79-49DB-B184-37426559F703") - ICLRDataEnumMemoryRegionsLoggingCallback : public IUnknown + ICLRDataLoggingCallback : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE LogMessage( @@ -1228,36 +1229,36 @@ EXTERN_C const IID IID_ICLRDataEnumMemoryRegionsLoggingCallback; #else /* C style interface */ - typedef struct ICLRDataEnumMemoryRegionsLoggingCallbackVtbl + typedef struct ICLRDataLoggingCallbackVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ICLRDataEnumMemoryRegionsLoggingCallback * This, + ICLRDataLoggingCallback * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( - ICLRDataEnumMemoryRegionsLoggingCallback * This); + ICLRDataLoggingCallback * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( - ICLRDataEnumMemoryRegionsLoggingCallback * This); + ICLRDataLoggingCallback * This); - DECLSPEC_XFGVIRT(ICLRDataEnumMemoryRegionsLoggingCallback, LogMessage) + DECLSPEC_XFGVIRT(ICLRDataLoggingCallback, LogMessage) HRESULT ( STDMETHODCALLTYPE *LogMessage )( - ICLRDataEnumMemoryRegionsLoggingCallback * This, + ICLRDataLoggingCallback * This, /* [in] */ LPCSTR message); END_INTERFACE - } ICLRDataEnumMemoryRegionsLoggingCallbackVtbl; + } ICLRDataLoggingCallbackVtbl; - interface ICLRDataEnumMemoryRegionsLoggingCallback + interface ICLRDataLoggingCallback { - CONST_VTBL struct ICLRDataEnumMemoryRegionsLoggingCallbackVtbl *lpVtbl; + CONST_VTBL struct ICLRDataLoggingCallbackVtbl *lpVtbl; }; @@ -1265,17 +1266,17 @@ EXTERN_C const IID IID_ICLRDataEnumMemoryRegionsLoggingCallback; #ifdef COBJMACROS -#define ICLRDataEnumMemoryRegionsLoggingCallback_QueryInterface(This,riid,ppvObject) \ +#define ICLRDataLoggingCallback_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) -#define ICLRDataEnumMemoryRegionsLoggingCallback_AddRef(This) \ +#define ICLRDataLoggingCallback_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) -#define ICLRDataEnumMemoryRegionsLoggingCallback_Release(This) \ +#define ICLRDataLoggingCallback_Release(This) \ ( (This)->lpVtbl -> Release(This) ) -#define ICLRDataEnumMemoryRegionsLoggingCallback_LogMessage(This,message) \ +#define ICLRDataLoggingCallback_LogMessage(This,message) \ ( (This)->lpVtbl -> LogMessage(This,message) ) #endif /* COBJMACROS */ @@ -1286,7 +1287,7 @@ EXTERN_C const IID IID_ICLRDataEnumMemoryRegionsLoggingCallback; -#endif /* __ICLRDataEnumMemoryRegionsLoggingCallback_INTERFACE_DEFINED__ */ +#endif /* __ICLRDataLoggingCallback_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_clrdata_0000_0008 */ @@ -1298,7 +1299,8 @@ enum CLRDataEnumMemoryFlags CLRDATA_ENUM_MEM_DEFAULT = 0, CLRDATA_ENUM_MEM_MINI = CLRDATA_ENUM_MEM_DEFAULT, CLRDATA_ENUM_MEM_HEAP = 0x1, - CLRDATA_ENUM_MEM_TRIAGE = 0x2 + CLRDATA_ENUM_MEM_TRIAGE = 0x2, + CLRDATA_ENUM_MEM_HEAP2 = 0x3 } CLRDataEnumMemoryFlags; diff --git a/src/tests/DbgShim.UnitTests/DbgShimAPI.cs b/src/tests/DbgShim.UnitTests/DbgShimAPI.cs index 30a1881176..1f648441e7 100644 --- a/src/tests/DbgShim.UnitTests/DbgShimAPI.cs +++ b/src/tests/DbgShim.UnitTests/DbgShimAPI.cs @@ -113,11 +113,11 @@ public static HResult RegisterForRuntimeStartup3(int pid, string applicationGrou return hr; } - private delegate void NativeRuntimeStartupCallbackDelegate(IntPtr cordbg, IntPtr parameter, HResult hresult); + private delegate void NativeRuntimeStartupCallbackDelegate(IntPtr cordbg, IntPtr parameter, int hresult); private static IntPtr RuntimeStartupCallback(object parameter, RuntimeStartupCallbackDelegate callback, out GCHandle nativeCallbackHandle, out IntPtr nativeParameter) { - NativeRuntimeStartupCallbackDelegate native = (IntPtr cordbg, IntPtr param, HResult hresult) => { + NativeRuntimeStartupCallbackDelegate native = (IntPtr cordbg, IntPtr param, int hresult) => { GCHandle gch = GCHandle.FromIntPtr(param); callback(ICorDebug.Create(cordbg), gch.Target, hresult); gch.Free(); @@ -260,7 +260,7 @@ private static T GetDelegateFunction(string functionName, bool optional = fal #region DbgShim pinvoke delegates [UnmanagedFunctionPointer(CallingConvention.StdCall, SetLastError = true)] - private delegate HResult CreateProcessForLaunchDelegate( + private delegate int CreateProcessForLaunchDelegate( [MarshalAs(UnmanagedType.LPWStr)] string lpCommandLine, [MarshalAs(UnmanagedType.Bool)] bool bSuspendProcess, IntPtr lpEnvironment, @@ -269,22 +269,22 @@ private delegate HResult CreateProcessForLaunchDelegate( out IntPtr suspendHandle); [UnmanagedFunctionPointer(CallingConvention.StdCall, SetLastError = true)] - private delegate HResult ResumeProcessDelegate( + private delegate int ResumeProcessDelegate( IntPtr handle); [UnmanagedFunctionPointer(CallingConvention.StdCall, SetLastError = true)] - private delegate HResult CloseResumeHandleDelegate( + private delegate int CloseResumeHandleDelegate( IntPtr handle); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HResult RegisterForRuntimeStartupDelegate( + private delegate int RegisterForRuntimeStartupDelegate( uint processId, IntPtr callback, IntPtr parameter, out IntPtr unregisterToken); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HResult RegisterForRuntimeStartupExDelegate( + private delegate int RegisterForRuntimeStartupExDelegate( uint processId, [MarshalAs(UnmanagedType.LPWStr)] string applicationGroupId, IntPtr callback, @@ -292,7 +292,7 @@ private delegate HResult RegisterForRuntimeStartupExDelegate( out IntPtr unregisterToken); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HResult RegisterForRuntimeStartup3Delegate( + private delegate int RegisterForRuntimeStartup3Delegate( uint processId, [MarshalAs(UnmanagedType.LPWStr)] string applicationGroupId, IntPtr libraryProvider, @@ -301,24 +301,24 @@ private delegate HResult RegisterForRuntimeStartup3Delegate( out IntPtr unregisterToken); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HResult UnregisterForRuntimeStartupDelegate( + private delegate int UnregisterForRuntimeStartupDelegate( IntPtr unregisterToken); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private unsafe delegate HResult EnumerateCLRsDelegate( + private unsafe delegate int EnumerateCLRsDelegate( int processId, out IntPtr* handleArray, out char** stringArray, out int arrayLength); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private unsafe delegate HResult CloseCLREnumerationDelegate( + private unsafe delegate int CloseCLREnumerationDelegate( IntPtr* handleArray, char** stringArray, int arrayLength); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private unsafe delegate HResult CreateVersionStringFromModuleDelegate( + private unsafe delegate int CreateVersionStringFromModuleDelegate( int processId, [MarshalAs(UnmanagedType.LPWStr)] string moduleName, char* versionString, @@ -326,25 +326,25 @@ private unsafe delegate HResult CreateVersionStringFromModuleDelegate( out int actualVersionStringLength); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private unsafe delegate HResult CreateDebuggingInterfaceFromVersionDelegate( + private unsafe delegate int CreateDebuggingInterfaceFromVersionDelegate( [MarshalAs(UnmanagedType.LPWStr)] string versionString, out IntPtr cordbg); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private unsafe delegate HResult CreateDebuggingInterfaceFromVersionExDelegate( + private unsafe delegate int CreateDebuggingInterfaceFromVersionExDelegate( int debuggerVersion, [MarshalAs(UnmanagedType.LPWStr)] string versionString, out IntPtr cordbg); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private unsafe delegate HResult CreateDebuggingInterfaceFromVersion2Delegate( + private unsafe delegate int CreateDebuggingInterfaceFromVersion2Delegate( int debuggerVersion, [MarshalAs(UnmanagedType.LPWStr)] string versionString, [MarshalAs(UnmanagedType.LPWStr)] string applicationGroupId, out IntPtr cordbg); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private unsafe delegate HResult CreateDebuggingInterfaceFromVersion3Delegate( + private unsafe delegate int CreateDebuggingInterfaceFromVersion3Delegate( int debuggerVersion, [MarshalAs(UnmanagedType.LPWStr)] string versionString, [MarshalAs(UnmanagedType.LPWStr)] string applicationGroupId, @@ -352,7 +352,7 @@ private unsafe delegate HResult CreateDebuggingInterfaceFromVersion3Delegate( out IntPtr cordbg); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private unsafe delegate HResult CLRCreateInstanceDelegate( + private unsafe delegate int CLRCreateInstanceDelegate( in Guid clrsid, in Guid riid, out IntPtr pInterface); diff --git a/src/tests/DbgShim.UnitTests/ICLRDebugging.cs b/src/tests/DbgShim.UnitTests/ICLRDebugging.cs index cd2ca5e87e..9d3b2b6d9a 100644 --- a/src/tests/DbgShim.UnitTests/ICLRDebugging.cs +++ b/src/tests/DbgShim.UnitTests/ICLRDebugging.cs @@ -51,7 +51,7 @@ public HResult OpenVirtualProcess( [StructLayout(LayoutKind.Sequential)] private readonly unsafe struct ICLRDebuggingVTable { - public readonly delegate* unmanaged[Stdcall] OpenVirtualProcess; + public readonly delegate* unmanaged[Stdcall] OpenVirtualProcess; } } } diff --git a/src/tests/DbgShim.UnitTests/ICorDebug.cs b/src/tests/DbgShim.UnitTests/ICorDebug.cs index 18a0fcfb41..5ba2627d95 100644 --- a/src/tests/DbgShim.UnitTests/ICorDebug.cs +++ b/src/tests/DbgShim.UnitTests/ICorDebug.cs @@ -35,12 +35,12 @@ private ICorDebug(IntPtr punk) [StructLayout(LayoutKind.Sequential)] private readonly unsafe struct ICorDebugVTable { - public readonly delegate* unmanaged[Stdcall] Initialize; - public readonly delegate* unmanaged[Stdcall] Terminate; - public readonly delegate* unmanaged[Stdcall] SetManangedHandler; - public readonly delegate* unmanaged[Stdcall] SetUnmanangedHandler; - public readonly delegate* unmanaged[Stdcall] CreateProcess; - public readonly delegate* unmanaged[Stdcall] DebugActiveProcess; + public readonly delegate* unmanaged[Stdcall] Initialize; + public readonly delegate* unmanaged[Stdcall] Terminate; + public readonly delegate* unmanaged[Stdcall] SetManangedHandler; + public readonly delegate* unmanaged[Stdcall] SetUnmanangedHandler; + public readonly delegate* unmanaged[Stdcall] CreateProcess; + public readonly delegate* unmanaged[Stdcall] DebugActiveProcess; } } } diff --git a/src/tests/DbgShim.UnitTests/ICorDebugController.cs b/src/tests/DbgShim.UnitTests/ICorDebugController.cs index 042b013bcf..aad6d994fe 100644 --- a/src/tests/DbgShim.UnitTests/ICorDebugController.cs +++ b/src/tests/DbgShim.UnitTests/ICorDebugController.cs @@ -35,14 +35,14 @@ private ICorDebugController(IntPtr punk) [StructLayout(LayoutKind.Sequential)] private readonly unsafe struct ICorDebugControllerVTable { - public readonly delegate* unmanaged[Stdcall] Stop; - public readonly delegate* unmanaged[Stdcall] Continue; - public readonly delegate* unmanaged[Stdcall] IsRunning_dummy; - public readonly delegate* unmanaged[Stdcall] HasQueuedCallbacks_dummy; - public readonly delegate* unmanaged[Stdcall] EnumerateThreads_dummy; - public readonly delegate* unmanaged[Stdcall] SetAllThreadsDebugState_dummy; - public readonly delegate* unmanaged[Stdcall] Detach; - public readonly delegate* unmanaged[Stdcall] Terminate; + public readonly delegate* unmanaged[Stdcall] Stop; + public readonly delegate* unmanaged[Stdcall] Continue; + public readonly delegate* unmanaged[Stdcall] IsRunning_dummy; + public readonly delegate* unmanaged[Stdcall] HasQueuedCallbacks_dummy; + public readonly delegate* unmanaged[Stdcall] EnumerateThreads_dummy; + public readonly delegate* unmanaged[Stdcall] SetAllThreadsDebugState_dummy; + public readonly delegate* unmanaged[Stdcall] Detach; + public readonly delegate* unmanaged[Stdcall] Terminate; } } } diff --git a/src/tests/DbgShim.UnitTests/LibraryProviderWrapper.cs b/src/tests/DbgShim.UnitTests/LibraryProviderWrapper.cs index 63929610cd..4d92f048b5 100644 --- a/src/tests/DbgShim.UnitTests/LibraryProviderWrapper.cs +++ b/src/tests/DbgShim.UnitTests/LibraryProviderWrapper.cs @@ -83,7 +83,7 @@ protected override void Destroy() Trace.TraceInformation("LibraryProviderWrapper.Destroy"); } - private HResult ProvideLibrary( + private int ProvideLibrary( IntPtr self, string fileName, uint timeStamp, @@ -134,7 +134,7 @@ private HResult ProvideLibrary( return HResult.E_INVALIDARG; } - private HResult ProvideLibrary2( + private int ProvideLibrary2( IntPtr self, string fileName, uint timeStamp, @@ -187,7 +187,7 @@ private HResult ProvideLibrary2( return HResult.E_INVALIDARG; } - private HResult ProvideWindowsLibrary( + private int ProvideWindowsLibrary( IntPtr self, string fileName, string runtimeModulePath, @@ -243,7 +243,7 @@ private HResult ProvideWindowsLibrary( return HResult.E_INVALIDARG; } - private HResult ProvideUnixLibrary( + private int ProvideUnixLibrary( IntPtr self, string fileName, string runtimeModulePath, @@ -469,7 +469,7 @@ private ISymbolService SymbolService #region ICLRDebuggingLibraryProvider* delegates [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ProvideLibraryDelegate( + private delegate int ProvideLibraryDelegate( [In] IntPtr self, [In, MarshalAs(UnmanagedType.LPWStr)] string fileName, [In] uint timeStamp, @@ -477,7 +477,7 @@ private delegate HResult ProvideLibraryDelegate( out IntPtr moduleHandle); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ProvideLibrary2Delegate( + private delegate int ProvideLibrary2Delegate( [In] IntPtr self, [In, MarshalAs(UnmanagedType.LPWStr)] string fileName, [In] uint timeStamp, @@ -485,7 +485,7 @@ private delegate HResult ProvideLibrary2Delegate( out IntPtr modulePath); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ProvideWindowsLibraryDelegate( + private delegate int ProvideWindowsLibraryDelegate( [In] IntPtr self, [In, MarshalAs(UnmanagedType.LPWStr)] string fileName, [In, MarshalAs(UnmanagedType.LPWStr)] string runtimeModulePath, @@ -495,7 +495,7 @@ private delegate HResult ProvideWindowsLibraryDelegate( out IntPtr modulePath); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ProvideUnixLibraryDelegate( + private delegate int ProvideUnixLibraryDelegate( [In] IntPtr self, [In, MarshalAs(UnmanagedType.LPWStr)] string fileName, [In, MarshalAs(UnmanagedType.LPWStr)] string runtimeModulePath, diff --git a/src/tests/DbgShim.UnitTests/ManagedCallbackWrapper.cs b/src/tests/DbgShim.UnitTests/ManagedCallbackWrapper.cs index 75e9094ac9..36c31dd309 100644 --- a/src/tests/DbgShim.UnitTests/ManagedCallbackWrapper.cs +++ b/src/tests/DbgShim.UnitTests/ManagedCallbackWrapper.cs @@ -83,110 +83,110 @@ private HResult WriteLine(string message) #region ICorDebugManagedCallback delegates [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult BreakpointDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pBreakpoint); + private delegate int BreakpointDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pBreakpoint); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult StepCompleteDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pStepper, [In] int reason); + private delegate int StepCompleteDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pStepper, [In] int reason); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult BreakDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread); + private delegate int BreakDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ExceptionDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] int unhandled); + private delegate int ExceptionDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] int unhandled); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult EvalCompleteDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pEval); + private delegate int EvalCompleteDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pEval); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult EvalExceptionDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pEval); + private delegate int EvalExceptionDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pEval); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult CreateProcessDelegate([In] IntPtr self, [In] IntPtr pProcess); + private delegate int CreateProcessDelegate([In] IntPtr self, [In] IntPtr pProcess); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ExitProcessDelegate([In] IntPtr self, [In] IntPtr pProcess); + private delegate int ExitProcessDelegate([In] IntPtr self, [In] IntPtr pProcess); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult CreateThreadDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr thread); + private delegate int CreateThreadDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr thread); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ExitThreadDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr thread); + private delegate int ExitThreadDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr thread); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult LoadModuleDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pModule); + private delegate int LoadModuleDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pModule); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult UnloadModuleDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pModule); + private delegate int UnloadModuleDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pModule); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult LoadClassDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr c); + private delegate int LoadClassDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr c); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult UnloadClassDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr c); + private delegate int UnloadClassDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr c); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult DebuggerErrorDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] HResult errorHR, [In] uint errorCode); + private delegate int DebuggerErrorDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] int errorHR, [In] uint errorCode); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult LogMessageDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] int lLevel, [In, MarshalAs(UnmanagedType.LPWStr)] string pLogSwitchName, [In, MarshalAs(UnmanagedType.LPWStr)] string pMessage); + private delegate int LogMessageDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] int lLevel, [In, MarshalAs(UnmanagedType.LPWStr)] string pLogSwitchName, [In, MarshalAs(UnmanagedType.LPWStr)] string pMessage); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult LogSwitchDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] int lLevel, [In] uint ulReason, [In, MarshalAs(UnmanagedType.LPWStr)] string pLogSwitchName, [In, MarshalAs(UnmanagedType.LPWStr)] string pParentName); + private delegate int LogSwitchDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] int lLevel, [In] uint ulReason, [In, MarshalAs(UnmanagedType.LPWStr)] string pLogSwitchName, [In, MarshalAs(UnmanagedType.LPWStr)] string pParentName); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult CreateAppDomainDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] IntPtr pAppDomain); + private delegate int CreateAppDomainDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] IntPtr pAppDomain); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ExitAppDomainDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] IntPtr pAppDomain); + private delegate int ExitAppDomainDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] IntPtr pAppDomain); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult LoadAssemblyDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pAssembly); + private delegate int LoadAssemblyDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pAssembly); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult UnloadAssemblyDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pAssembly); + private delegate int UnloadAssemblyDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pAssembly); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ControlCTrapDelegate([In] IntPtr self, [In] IntPtr pProcess); + private delegate int ControlCTrapDelegate([In] IntPtr self, [In] IntPtr pProcess); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult NameChangeDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread); + private delegate int NameChangeDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult UpdateModuleSymbolsDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pModule, [In] IntPtr pSymbolStream); + private delegate int UpdateModuleSymbolsDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pModule, [In] IntPtr pSymbolStream); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult EditAndContinueRemapDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pFunction, [In] int fAccurate); + private delegate int EditAndContinueRemapDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pFunction, [In] int fAccurate); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult BreakpointSetErrorDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pBreakpoint, [In] uint dwError); + private delegate int BreakpointSetErrorDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pBreakpoint, [In] uint dwError); #endregion #region ICorDebugManagedCallback2 delegates [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult FunctionRemapOpportunityDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pOldFunction, [In] IntPtr pNewFunction, [In] uint oldILOffset); + private delegate int FunctionRemapOpportunityDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pOldFunction, [In] IntPtr pNewFunction, [In] uint oldILOffset); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult CreateConnectionDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] uint dwConnectionId, [In] ref ushort pConnName); + private delegate int CreateConnectionDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] uint dwConnectionId, [In] ref ushort pConnName); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ChangeConnectionDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] uint dwConnectionId); + private delegate int ChangeConnectionDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] uint dwConnectionId); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult DestroyConnectionDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] uint dwConnectionId); + private delegate int DestroyConnectionDelegate([In] IntPtr self, [In] IntPtr pProcess, [In] uint dwConnectionId); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ExceptionDelegate2([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pFrame, [In] uint nOffset, [In] int dwEventType, [In] uint dwFlags); + private delegate int ExceptionDelegate2([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pFrame, [In] uint nOffset, [In] int dwEventType, [In] uint dwFlags); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult ExceptionUnwindDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] int dwEventType, [In] uint dwFlags); + private delegate int ExceptionUnwindDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] int dwEventType, [In] uint dwFlags); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult FunctionRemapCompleteDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pFunction); + private delegate int FunctionRemapCompleteDelegate([In] IntPtr self, [In] IntPtr pAppDomain, [In] IntPtr pThread, [In] IntPtr pFunction); [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult MDANotificationDelegate([In] IntPtr self, [In] IntPtr pController, [In] IntPtr pThread, [In] IntPtr pMDA); + private delegate int MDANotificationDelegate([In] IntPtr self, [In] IntPtr pController, [In] IntPtr pThread, [In] IntPtr pMDA); #endregion } diff --git a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/TestDbgEng.cs b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/TestDbgEng.cs index 5f71b60d7b..ae04090f2f 100644 --- a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/TestDbgEng.cs +++ b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/TestDbgEng.cs @@ -40,7 +40,7 @@ protected override ITarget GetTarget() class DbgEngController : IDebugOutputCallbacks { [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate HResult DebugCreateDelegate( + private delegate int DebugCreateDelegate( ref Guid interfaceId, [MarshalAs(UnmanagedType.IUnknown)] out object iinterface);