Skip to content

Commit

Permalink
Use source generated COM marshalling for DIA interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
lordmilko committed Nov 15, 2023
1 parent 7057b34 commit 4b49d17
Show file tree
Hide file tree
Showing 83 changed files with 2,237 additions and 1,484 deletions.
1 change: 1 addition & 0 deletions ClrDebug/Extensions/Marshalling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Runtime.InteropServices.Marshalling;
#endif
using System.Runtime.InteropServices;
using ClrDebug.TypeLib;
using static ClrDebug.Extensions;

//Facilities for enabling COM generated marshalling in .NET 8.0+ builds of ClrDebug
Expand Down
12 changes: 6 additions & 6 deletions ClrDebug/Managed/DIA/DiaAddressMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public bool AddressMapEnabled
public HRESULT TryGetAddressMapEnabled(out bool pRetVal)
{
/*HRESULT get_addressMapEnabled(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_addressMapEnabled(out pRetVal);
}

Expand All @@ -77,7 +77,7 @@ public HRESULT TryGetAddressMapEnabled(out bool pRetVal)
public HRESULT TryPutAddressMapEnabled(bool newVal)
{
/*HRESULT put_addressMapEnabled(
[In] bool NewVal);*/
[In, MarshalAs(UnmanagedType.Bool)] bool NewVal);*/
return Raw.put_addressMapEnabled(newVal);
}

Expand Down Expand Up @@ -116,7 +116,7 @@ public bool RelativeVirtualAddressEnabled
public HRESULT TryGetRelativeVirtualAddressEnabled(out bool pRetVal)
{
/*HRESULT get_relativeVirtualAddressEnabled(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_relativeVirtualAddressEnabled(out pRetVal);
}

Expand All @@ -134,7 +134,7 @@ public HRESULT TryGetRelativeVirtualAddressEnabled(out bool pRetVal)
public HRESULT TryPutRelativeVirtualAddressEnabled(bool newVal)
{
/*HRESULT put_relativeVirtualAddressEnabled(
[In] bool NewVal);*/
[In, MarshalAs(UnmanagedType.Bool)] bool NewVal);*/
return Raw.put_relativeVirtualAddressEnabled(newVal);
}

Expand Down Expand Up @@ -238,7 +238,7 @@ public HRESULT TrySetImageHeaders(int cbData, byte[] pbData, bool originalHeader
/*HRESULT set_imageHeaders(
[In] int cbData,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 0)] byte[] pbData,
[In] bool originalHeaders);*/
[In, MarshalAs(UnmanagedType.Bool)] bool originalHeaders);*/
return Raw.set_imageHeaders(cbData, pbData, originalHeaders);
}

Expand Down Expand Up @@ -282,7 +282,7 @@ public HRESULT TrySetAddressMap(int cData, DiaAddressMapEntry[] pData, bool imag
/*HRESULT set_addressMap(
[In] int cData,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] DiaAddressMapEntry[] pData,
[In] bool imageToSymbols);*/
[In, MarshalAs(UnmanagedType.Bool)] bool imageToSymbols);*/
return Raw.set_addressMap(cData, pData, imageToSymbols);
}

Expand Down
2 changes: 1 addition & 1 deletion ClrDebug/Managed/DIA/DiaEnumDebugStreams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public DiaEnumDebugStreamData Item(object index)
public HRESULT TryItem(object index, out DiaEnumDebugStreamData streamResult)
{
/*HRESULT Item(
[MarshalAs(UnmanagedType.Struct), In] object index,
[In, MarshalAs(UnmanagedType.Struct)] object index,
[Out, MarshalAs(UnmanagedType.Interface)] out IDiaEnumDebugStreamData stream);*/
IDiaEnumDebugStreamData stream;
HRESULT hr = Raw.Item(index, out stream);
Expand Down
10 changes: 5 additions & 5 deletions ClrDebug/Managed/DIA/DiaEnumSymbolsByAddr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public DiaSymbol SymbolByAddrEx(bool fPromoteBlockSym, int isect, int offset)
public HRESULT TrySymbolByAddrEx(bool fPromoteBlockSym, int isect, int offset, out DiaSymbol ppSymbolResult)
{
/*HRESULT symbolByAddrEx(
[In] bool fPromoteBlockSym,
[In, MarshalAs(UnmanagedType.Bool)] bool fPromoteBlockSym,
[In] int isect,
[In] int offset,
[Out, MarshalAs(UnmanagedType.Interface)] out IDiaSymbol ppSymbol);*/
Expand Down Expand Up @@ -313,7 +313,7 @@ public DiaSymbol SymbolByRVAEx(bool fPromoteBlockSym, int relativeVirtualAddress
public HRESULT TrySymbolByRVAEx(bool fPromoteBlockSym, int relativeVirtualAddress, out DiaSymbol ppSymbolResult)
{
/*HRESULT symbolByRVAEx(
[In] bool fPromoteBlockSym,
[In, MarshalAs(UnmanagedType.Bool)] bool fPromoteBlockSym,
[In] int relativeVirtualAddress,
[Out, MarshalAs(UnmanagedType.Interface)] out IDiaSymbol ppSymbol);*/
IDiaSymbol ppSymbol;
Expand Down Expand Up @@ -341,7 +341,7 @@ public DiaSymbol SymbolByVAEx(bool fPromoteBlockSym, long virtualAddress)
public HRESULT TrySymbolByVAEx(bool fPromoteBlockSym, long virtualAddress, out DiaSymbol ppSymbolResult)
{
/*HRESULT symbolByVAEx(
[In] bool fPromoteBlockSym,
[In, MarshalAs(UnmanagedType.Bool)] bool fPromoteBlockSym,
[In] long virtualAddress,
[Out, MarshalAs(UnmanagedType.Interface)] out IDiaSymbol ppSymbol);*/
IDiaSymbol ppSymbol;
Expand Down Expand Up @@ -369,7 +369,7 @@ public NextExResult NextEx(bool fPromoteBlockSym, int celt)
public HRESULT TryNextEx(bool fPromoteBlockSym, int celt, out NextExResult result)
{
/*HRESULT NextEx(
[In] bool fPromoteBlockSym,
[In, MarshalAs(UnmanagedType.Bool)] bool fPromoteBlockSym,
[In] int celt,
[Out, MarshalAs(UnmanagedType.Interface)] out IDiaSymbol rgelt,
[Out] out int pceltFetched);*/
Expand Down Expand Up @@ -399,7 +399,7 @@ public PrevExResult PrevEx(bool fPromoteBlockSym, int celt)
public HRESULT TryPrevEx(bool fPromoteBlockSym, int celt, out PrevExResult result)
{
/*HRESULT PrevEx(
[In] bool fPromoteBlockSym,
[In, MarshalAs(UnmanagedType.Bool)] bool fPromoteBlockSym,
[In] int celt,
[Out, MarshalAs(UnmanagedType.Interface)] out IDiaSymbol rgelt,
[Out] out int pceltFetched);*/
Expand Down
2 changes: 1 addition & 1 deletion ClrDebug/Managed/DIA/DiaEnumTables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public DiaTable Item(object index)
public HRESULT TryItem(object index, out DiaTable tableResult)
{
/*HRESULT Item(
[MarshalAs(UnmanagedType.Struct), In] object index,
[In, MarshalAs(UnmanagedType.Struct)] object index,
[Out, MarshalAs(UnmanagedType.Interface)] out IDiaTable table);*/
IDiaTable table;
HRESULT hr = Raw.Item(index, out table);
Expand Down
8 changes: 4 additions & 4 deletions ClrDebug/Managed/DIA/DiaFrameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ public bool SystemExceptionHandling
public HRESULT TryGetSystemExceptionHandling(out bool pRetVal)
{
/*HRESULT get_systemExceptionHandling(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_systemExceptionHandling(out pRetVal);
}

Expand Down Expand Up @@ -429,7 +429,7 @@ public bool CplusplusExceptionHandling
public HRESULT TryGetCplusplusExceptionHandling(out bool pRetVal)
{
/*HRESULT get_cplusplusExceptionHandling(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_cplusplusExceptionHandling(out pRetVal);
}

Expand Down Expand Up @@ -462,7 +462,7 @@ public bool FunctionStart
public HRESULT TryGetFunctionStart(out bool pRetVal)
{
/*HRESULT get_functionStart(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_functionStart(out pRetVal);
}

Expand Down Expand Up @@ -496,7 +496,7 @@ public bool AllocatesBasePointer
public HRESULT TryGetAllocatesBasePointer(out bool pRetVal)
{
/*HRESULT get_allocatesBasePointer(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_allocatesBasePointer(out pRetVal);
}

Expand Down
2 changes: 1 addition & 1 deletion ClrDebug/Managed/DIA/DiaInputAssemblyFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public bool PdbAvailableAtILMerge
public HRESULT TryGetPdbAvailableAtILMerge(out bool pRetVal)
{
/*HRESULT get_pdbAvailableAtILMerge(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_pdbAvailableAtILMerge(out pRetVal);
}

Expand Down
2 changes: 1 addition & 1 deletion ClrDebug/Managed/DIA/DiaLineNumber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public bool Statement
public HRESULT TryGetStatement(out bool pRetVal)
{
/*HRESULT get_statement(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_statement(out pRetVal);
}

Expand Down
2 changes: 1 addition & 1 deletion ClrDebug/Managed/DIA/DiaPropertyStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public HRESULT TryReadBOOL(int id, out bool pValue)
{
/*HRESULT ReadBOOL(
[In] int id,
[Out] out bool pValue);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pValue);*/
return Raw.ReadBOOL(id, out pValue);
}

Expand Down
26 changes: 13 additions & 13 deletions ClrDebug/Managed/DIA/DiaSectionContrib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public bool NotPaged
public HRESULT TryGetNotPaged(out bool pRetVal)
{
/*HRESULT get_notPaged(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_notPaged(out pRetVal);
}

Expand Down Expand Up @@ -252,7 +252,7 @@ public bool Code
public HRESULT TryGetCode(out bool pRetVal)
{
/*HRESULT get_code(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_code(out pRetVal);
}

Expand Down Expand Up @@ -281,7 +281,7 @@ public bool InitializedData
public HRESULT TryGetInitializedData(out bool pRetVal)
{
/*HRESULT get_initializedData(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_initializedData(out pRetVal);
}

Expand Down Expand Up @@ -310,7 +310,7 @@ public bool UninitializedData
public HRESULT TryGetUninitializedData(out bool pRetVal)
{
/*HRESULT get_uninitializedData(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_uninitializedData(out pRetVal);
}

Expand Down Expand Up @@ -339,7 +339,7 @@ public bool Remove
public HRESULT TryGetRemove(out bool pRetVal)
{
/*HRESULT get_remove(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_remove(out pRetVal);
}

Expand Down Expand Up @@ -371,7 +371,7 @@ public bool Comdat
public HRESULT TryGetComdat(out bool pRetVal)
{
/*HRESULT get_comdat(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_comdat(out pRetVal);
}

Expand Down Expand Up @@ -400,7 +400,7 @@ public bool Discardable
public HRESULT TryGetDiscardable(out bool pRetVal)
{
/*HRESULT get_discardable(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_discardable(out pRetVal);
}

Expand Down Expand Up @@ -429,7 +429,7 @@ public bool NotCached
public HRESULT TryGetNotCached(out bool pRetVal)
{
/*HRESULT get_notCached(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_notCached(out pRetVal);
}

Expand Down Expand Up @@ -458,7 +458,7 @@ public bool Share
public HRESULT TryGetShare(out bool pRetVal)
{
/*HRESULT get_share(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_share(out pRetVal);
}

Expand Down Expand Up @@ -487,7 +487,7 @@ public bool Execute
public HRESULT TryGetExecute(out bool pRetVal)
{
/*HRESULT get_execute(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_execute(out pRetVal);
}

Expand Down Expand Up @@ -516,7 +516,7 @@ public bool Read
public HRESULT TryGetRead(out bool pRetVal)
{
/*HRESULT get_read(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_read(out pRetVal);
}

Expand Down Expand Up @@ -545,7 +545,7 @@ public bool Write
public HRESULT TryGetWrite(out bool pRetVal)
{
/*HRESULT get_write(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_write(out pRetVal);
}

Expand Down Expand Up @@ -665,7 +665,7 @@ public bool Code16bit
public HRESULT TryGetCode16bit(out bool pRetVal)
{
/*HRESULT get_code16bit(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_code16bit(out pRetVal);
}

Expand Down
6 changes: 3 additions & 3 deletions ClrDebug/Managed/DIA/DiaSegment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public bool Read
public HRESULT TryGetRead(out bool pRetVal)
{
/*HRESULT get_read(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_read(out pRetVal);
}

Expand Down Expand Up @@ -159,7 +159,7 @@ public bool Write
public HRESULT TryGetWrite(out bool pRetVal)
{
/*HRESULT get_write(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_write(out pRetVal);
}

Expand Down Expand Up @@ -188,7 +188,7 @@ public bool Execute
public HRESULT TryGetExecute(out bool pRetVal)
{
/*HRESULT get_execute(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_execute(out pRetVal);
}

Expand Down
8 changes: 4 additions & 4 deletions ClrDebug/Managed/DIA/DiaStackFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public bool SystemExceptionHandling
public HRESULT TryGetSystemExceptionHandling(out bool pRetVal)
{
/*HRESULT get_systemExceptionHandling(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_systemExceptionHandling(out pRetVal);
}

Expand Down Expand Up @@ -340,7 +340,7 @@ public bool CplusplusExceptionHandling
public HRESULT TryGetCplusplusExceptionHandling(out bool pRetVal)
{
/*HRESULT get_cplusplusExceptionHandling(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_cplusplusExceptionHandling(out pRetVal);
}

Expand Down Expand Up @@ -369,7 +369,7 @@ public bool FunctionStart
public HRESULT TryGetFunctionStart(out bool pRetVal)
{
/*HRESULT get_functionStart(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_functionStart(out pRetVal);
}

Expand Down Expand Up @@ -398,7 +398,7 @@ public bool AllocatesBasePointer
public HRESULT TryGetAllocatesBasePointer(out bool pRetVal)
{
/*HRESULT get_allocatesBasePointer(
[Out] out bool pRetVal);*/
[Out, MarshalAs(UnmanagedType.Bool)] out bool pRetVal);*/
return Raw.get_allocatesBasePointer(out pRetVal);
}

Expand Down
Loading

0 comments on commit 4b49d17

Please sign in to comment.