summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSaeHie Park <saehie.park@gmail.com>2016-12-06 18:22:30 +0900
committerJan Vorlicek <janvorli@microsoft.com>2016-12-06 10:22:30 +0100
commite3da0c0b895790d2b0dc94e2ca69b66f9d4476e2 (patch)
tree0f231a01b027244ec0c5d5dff1da3e59db4d7078 /src
parent7baf52ee8d079fd41a306fcc3a195199f50f85d3 (diff)
downloadcoreclr-e3da0c0b895790d2b0dc94e2ca69b66f9d4476e2.tar.gz
coreclr-e3da0c0b895790d2b0dc94e2ca69b66f9d4476e2.tar.bz2
coreclr-e3da0c0b895790d2b0dc94e2ca69b66f9d4476e2.zip
[x86/Linux] Fix Dacp structure size mismatch (#8377)
Fix compile error for x86/Linux - add __attribute__((__ms_struct__)) as "MSLAYOUT" for those structures - Fix "Dacp structs cannot be modified due to backwards compatibility" error
Diffstat (limited to 'src')
-rw-r--r--src/debug/inc/common.h24
-rw-r--r--src/inc/dacprivate.h113
2 files changed, 69 insertions, 68 deletions
diff --git a/src/debug/inc/common.h b/src/debug/inc/common.h
index 77fe27a4b3..3bbf0a6f08 100644
--- a/src/debug/inc/common.h
+++ b/src/debug/inc/common.h
@@ -295,29 +295,7 @@ inline CORDB_ADDRESS ALIGN_ADDRESS( CORDB_ADDRESS val, CORDB_ADDRESS alignment )
return result;
}
-//
-// Whenever a structure is marshalled between different platforms, we need to ensure the
-// layout is the same in both cases. We tell GCC to use the MSVC-style packing with
-// the following attribute. The main thing this appears to control is whether
-// 8-byte values are aligned at 4-bytes (GCC default) or 8-bytes (MSVC default).
-// This attribute affects only the immediate struct it is applied to, you must also apply
-// it to any nested structs if you want their layout affected as well. You also must
-// apply this to unions embedded in other structures, since it can influence the starting
-// alignment.
-//
-// Note that there doesn't appear to be any disadvantage to applying this a little
-// more agressively than necessary, so we generally use it on all classes / structures
-// defined in a file that defines marshalled data types (eg. DacDbiStructures.h)
-// The -mms-bitfields compiler option also does this for the whole file, but we don't
-// want to go changing the layout of, for example, structures defined in OS header files
-// so we explicitly opt-in with this attribute.
-//
-#ifdef __GNUC__
-#define MSLAYOUT __attribute__((__ms_struct__))
-#else
-#define MSLAYOUT
-#endif
-
+#include "dacprivate.h" // for MSLAYOUT
#include "dumpcommon.h"
#endif //DEBUGGER_COMMON_H
diff --git a/src/inc/dacprivate.h b/src/inc/dacprivate.h
index 5a09abe113..0db4affcfc 100644
--- a/src/inc/dacprivate.h
+++ b/src/inc/dacprivate.h
@@ -20,6 +20,29 @@
#include <msodw.h>
#endif // FEATURE_PAL
+//
+// Whenever a structure is marshalled between different platforms, we need to ensure the
+// layout is the same in both cases. We tell GCC to use the MSVC-style packing with
+// the following attribute. The main thing this appears to control is whether
+// 8-byte values are aligned at 4-bytes (GCC default) or 8-bytes (MSVC default).
+// This attribute affects only the immediate struct it is applied to, you must also apply
+// it to any nested structs if you want their layout affected as well. You also must
+// apply this to unions embedded in other structures, since it can influence the starting
+// alignment.
+//
+// Note that there doesn't appear to be any disadvantage to applying this a little
+// more agressively than necessary, so we generally use it on all classes / structures
+// defined in a file that defines marshalled data types (eg. DacDbiStructures.h)
+// The -mms-bitfields compiler option also does this for the whole file, but we don't
+// want to go changing the layout of, for example, structures defined in OS header files
+// so we explicitly opt-in with this attribute.
+//
+#ifdef __GNUC__
+#define MSLAYOUT __attribute__((__ms_struct__))
+#else
+#define MSLAYOUT
+#endif
+
//----------------------------------------------------------------------------
//
// Utility class to allow for zero initialization of our Dacp- structs.
@@ -58,7 +81,7 @@ enum
};
enum DacpObjectType { OBJ_STRING=0,OBJ_FREE,OBJ_OBJECT,OBJ_ARRAY,OBJ_OTHER };
-struct DacpObjectData : ZeroInit<DacpObjectData>
+struct MSLAYOUT DacpObjectData : ZeroInit<DacpObjectData>
{
CLRDATA_ADDRESS MethodTable;
DacpObjectType ObjectType;
@@ -81,7 +104,7 @@ struct DacpObjectData : ZeroInit<DacpObjectData>
}
};
-struct DacpExceptionObjectData : ZeroInit<DacpExceptionObjectData>
+struct MSLAYOUT DacpExceptionObjectData : ZeroInit<DacpExceptionObjectData>
{
CLRDATA_ADDRESS Message;
CLRDATA_ADDRESS InnerException;
@@ -105,7 +128,7 @@ struct DacpExceptionObjectData : ZeroInit<DacpExceptionObjectData>
}
};
-struct DacpUsefulGlobalsData : ZeroInit<DacpUsefulGlobalsData>
+struct MSLAYOUT DacpUsefulGlobalsData : ZeroInit<DacpUsefulGlobalsData>
{
CLRDATA_ADDRESS ArrayMethodTable;
CLRDATA_ADDRESS StringMethodTable;
@@ -114,7 +137,7 @@ struct DacpUsefulGlobalsData : ZeroInit<DacpUsefulGlobalsData>
CLRDATA_ADDRESS FreeMethodTable;
};
-struct DacpFieldDescData : ZeroInit<DacpFieldDescData>
+struct MSLAYOUT DacpFieldDescData : ZeroInit<DacpFieldDescData>
{
CorElementType Type;
CorElementType sigType; // ELEMENT_TYPE_XXX from signature. We need this to disply pretty name for String in minidump's case
@@ -137,7 +160,7 @@ struct DacpFieldDescData : ZeroInit<DacpFieldDescData>
}
};
-struct DacpMethodTableFieldData : ZeroInit<DacpMethodTableFieldData>
+struct MSLAYOUT DacpMethodTableFieldData : ZeroInit<DacpMethodTableFieldData>
{
WORD wNumInstanceFields;
WORD wNumStaticFields;
@@ -154,7 +177,7 @@ struct DacpMethodTableFieldData : ZeroInit<DacpMethodTableFieldData>
}
};
-struct DacpMethodTableTransparencyData : ZeroInit<DacpMethodTableTransparencyData>
+struct MSLAYOUT DacpMethodTableTransparencyData : ZeroInit<DacpMethodTableTransparencyData>
{
BOOL bHasCriticalTransparentInfo;
BOOL bIsCritical;
@@ -166,7 +189,7 @@ struct DacpMethodTableTransparencyData : ZeroInit<DacpMethodTableTransparencyDat
}
};
-struct DacpDomainLocalModuleData : ZeroInit<DacpDomainLocalModuleData>
+struct MSLAYOUT DacpDomainLocalModuleData : ZeroInit<DacpDomainLocalModuleData>
{
// These two parameters are used as input params when calling the
// no-argument form of Request below.
@@ -186,7 +209,7 @@ struct DacpDomainLocalModuleData : ZeroInit<DacpDomainLocalModuleData>
};
-struct DacpThreadLocalModuleData : ZeroInit<DacpThreadLocalModuleData>
+struct MSLAYOUT DacpThreadLocalModuleData : ZeroInit<DacpThreadLocalModuleData>
{
// These two parameters are used as input params when calling the
// no-argument form of Request below.
@@ -200,7 +223,7 @@ struct DacpThreadLocalModuleData : ZeroInit<DacpThreadLocalModuleData>
};
-struct DacpModuleData : ZeroInit<DacpModuleData>
+struct MSLAYOUT DacpModuleData : ZeroInit<DacpModuleData>
{
CLRDATA_ADDRESS Address;
CLRDATA_ADDRESS File; // A PEFile addr
@@ -243,7 +266,7 @@ private:
void operator=(const DacpModuleData&);
};
-struct DacpMethodTableData : ZeroInit<DacpMethodTableData>
+struct MSLAYOUT DacpMethodTableData : ZeroInit<DacpMethodTableData>
{
BOOL bIsFree; // everything else is NULL if this is true.
CLRDATA_ADDRESS Module;
@@ -260,7 +283,7 @@ struct DacpMethodTableData : ZeroInit<DacpMethodTableData>
BOOL bIsShared; // flags & enum_flag_DomainNeutral
BOOL bIsDynamic;
BOOL bContainsPointers;
-
+
HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
{
return sos->GetMethodTableData(addr, this);
@@ -279,7 +302,7 @@ struct DacpMethodTableData : ZeroInit<DacpMethodTableData>
#define CLRSECURITYHOSTED 0x80
#define CLRHOSTED 0x80000000
-struct DacpThreadStoreData : ZeroInit<DacpThreadStoreData>
+struct MSLAYOUT DacpThreadStoreData : ZeroInit<DacpThreadStoreData>
{
LONG threadCount;
LONG unstartedThreadCount;
@@ -290,14 +313,14 @@ struct DacpThreadStoreData : ZeroInit<DacpThreadStoreData>
CLRDATA_ADDRESS finalizerThread;
CLRDATA_ADDRESS gcThread;
DWORD fHostConfig; // Uses hosting flags defined above
-
+
HRESULT Request(ISOSDacInterface *sos)
{
return sos->GetThreadStoreData(this);
}
};
-struct DacpAppDomainStoreData : ZeroInit<DacpAppDomainStoreData>
+struct MSLAYOUT DacpAppDomainStoreData : ZeroInit<DacpAppDomainStoreData>
{
CLRDATA_ADDRESS sharedDomain;
CLRDATA_ADDRESS systemDomain;
@@ -309,14 +332,14 @@ struct DacpAppDomainStoreData : ZeroInit<DacpAppDomainStoreData>
}
};
-struct DacpCOMInterfacePointerData : ZeroInit<DacpCOMInterfacePointerData>
+struct MSLAYOUT DacpCOMInterfacePointerData : ZeroInit<DacpCOMInterfacePointerData>
{
CLRDATA_ADDRESS methodTable;
CLRDATA_ADDRESS interfacePtr;
CLRDATA_ADDRESS comContext;
};
-struct DacpRCWData : ZeroInit<DacpRCWData>
+struct MSLAYOUT DacpRCWData : ZeroInit<DacpRCWData>
{
CLRDATA_ADDRESS identityPointer;
CLRDATA_ADDRESS unknownPointer;
@@ -355,7 +378,7 @@ struct DacpRCWData : ZeroInit<DacpRCWData>
}
};
-struct DacpCCWData : ZeroInit<DacpCCWData>
+struct MSLAYOUT DacpCCWData : ZeroInit<DacpCCWData>
{
CLRDATA_ADDRESS outerIUnknown;
CLRDATA_ADDRESS managedObject;
@@ -397,7 +420,7 @@ enum DacpAppDomainDataStage {
// Information about a BaseDomain (AppDomain, SharedDomain or SystemDomain).
// For types other than AppDomain, some fields (like dwID, DomainLocalBlock, etc.) will be 0/null.
-struct DacpAppDomainData : ZeroInit<DacpAppDomainData>
+struct MSLAYOUT DacpAppDomainData : ZeroInit<DacpAppDomainData>
{
// The pointer to the BaseDomain (not necessarily an AppDomain).
// It's useful to keep this around in the structure
@@ -420,7 +443,7 @@ struct DacpAppDomainData : ZeroInit<DacpAppDomainData>
}
};
-struct DacpAssemblyData : ZeroInit<DacpAssemblyData>
+struct MSLAYOUT DacpAssemblyData : ZeroInit<DacpAssemblyData>
{
CLRDATA_ADDRESS AssemblyPtr; //useful to have
CLRDATA_ADDRESS ClassLoader;
@@ -445,7 +468,7 @@ struct DacpAssemblyData : ZeroInit<DacpAssemblyData>
};
-struct DacpThreadData : ZeroInit<DacpThreadData>
+struct MSLAYOUT DacpThreadData : ZeroInit<DacpThreadData>
{
DWORD corThreadId;
DWORD osThreadId;
@@ -470,7 +493,7 @@ struct DacpThreadData : ZeroInit<DacpThreadData>
};
-struct DacpReJitData : ZeroInit<DacpReJitData>
+struct MSLAYOUT DacpReJitData : ZeroInit<DacpReJitData>
{
enum Flags
{
@@ -485,7 +508,7 @@ struct DacpReJitData : ZeroInit<DacpReJitData>
CLRDATA_ADDRESS NativeCodeAddr;
};
-struct DacpMethodDescData : ZeroInit<DacpMethodDescData>
+struct MSLAYOUT DacpMethodDescData : ZeroInit<DacpMethodDescData>
{
BOOL bHasNativeCode;
BOOL bIsDynamic;
@@ -529,7 +552,7 @@ struct DacpMethodDescData : ZeroInit<DacpMethodDescData>
}
};
-struct DacpMethodDescTransparencyData : ZeroInit<DacpMethodDescTransparencyData>
+struct MSLAYOUT DacpMethodDescTransparencyData : ZeroInit<DacpMethodDescTransparencyData>
{
BOOL bHasCriticalTransparentInfo;
BOOL bIsCritical;
@@ -544,7 +567,7 @@ struct DacpMethodDescTransparencyData : ZeroInit<DacpMethodDescTransparencyData>
// for JITType
enum JITTypes {TYPE_UNKNOWN=0,TYPE_JIT,TYPE_PJIT};
-struct DacpCodeHeaderData : ZeroInit<DacpCodeHeaderData>
+struct MSLAYOUT DacpCodeHeaderData : ZeroInit<DacpCodeHeaderData>
{
CLRDATA_ADDRESS GCInfo;
JITTypes JITType;
@@ -561,7 +584,7 @@ struct DacpCodeHeaderData : ZeroInit<DacpCodeHeaderData>
}
};
-struct DacpWorkRequestData : ZeroInit<DacpWorkRequestData>
+struct MSLAYOUT DacpWorkRequestData : ZeroInit<DacpWorkRequestData>
{
CLRDATA_ADDRESS Function;
CLRDATA_ADDRESS Context;
@@ -573,7 +596,7 @@ struct DacpWorkRequestData : ZeroInit<DacpWorkRequestData>
}
};
-struct DacpHillClimbingLogEntry : ZeroInit<DacpHillClimbingLogEntry>
+struct MSLAYOUT DacpHillClimbingLogEntry : ZeroInit<DacpHillClimbingLogEntry>
{
DWORD TickCount;
int Transition;
@@ -589,7 +612,7 @@ struct DacpHillClimbingLogEntry : ZeroInit<DacpHillClimbingLogEntry>
// Used for CLR versions >= 4.0
-struct DacpThreadpoolData : ZeroInit<DacpThreadpoolData>
+struct MSLAYOUT DacpThreadpoolData : ZeroInit<DacpThreadpoolData>
{
LONG cpuUtilization;
int NumIdleWorkerThreads;
@@ -623,7 +646,7 @@ struct DacpThreadpoolData : ZeroInit<DacpThreadpoolData>
}
};
-struct DacpGenerationData : ZeroInit<DacpGenerationData>
+struct MSLAYOUT DacpGenerationData : ZeroInit<DacpGenerationData>
{
CLRDATA_ADDRESS start_segment;
CLRDATA_ADDRESS allocation_start;
@@ -636,18 +659,18 @@ struct DacpGenerationData : ZeroInit<DacpGenerationData>
#define DAC_NUMBERGENERATIONS 4
-struct DacpAllocData : ZeroInit<DacpAllocData>
+struct MSLAYOUT DacpAllocData : ZeroInit<DacpAllocData>
{
CLRDATA_ADDRESS allocBytes;
CLRDATA_ADDRESS allocBytesLoh;
};
-struct DacpGenerationAllocData : ZeroInit<DacpGenerationAllocData>
+struct MSLAYOUT DacpGenerationAllocData : ZeroInit<DacpGenerationAllocData>
{
DacpAllocData allocData[DAC_NUMBERGENERATIONS];
};
-struct DacpGcHeapDetails : ZeroInit<DacpGcHeapDetails>
+struct MSLAYOUT DacpGcHeapDetails : ZeroInit<DacpGcHeapDetails>
{
CLRDATA_ADDRESS heapAddr; // Only filled in in server mode, otherwise NULL
CLRDATA_ADDRESS alloc_allocated;
@@ -681,7 +704,7 @@ struct DacpGcHeapDetails : ZeroInit<DacpGcHeapDetails>
}
};
-struct DacpGcHeapData
+struct MSLAYOUT DacpGcHeapData
: ZeroInit<DacpGcHeapData>
{
BOOL bServerMode;
@@ -695,7 +718,7 @@ struct DacpGcHeapData
}
};
-struct DacpHeapSegmentData
+struct MSLAYOUT DacpHeapSegmentData
: ZeroInit<DacpHeapSegmentData>
{
CLRDATA_ADDRESS segmentAddr;
@@ -730,7 +753,7 @@ struct DacpHeapSegmentData
}
};
-struct DacpOomData : ZeroInit<DacpOomData>
+struct MSLAYOUT DacpOomData : ZeroInit<DacpOomData>
{
int reason;
ULONG64 alloc_size;
@@ -761,7 +784,7 @@ struct DacpOomData : ZeroInit<DacpOomData>
#define MAX_GC_MECHANISM_BITS_COUNT 2
// This is from ndp\clr\src\vm\common.h
#define MAX_GLOBAL_GC_MECHANISMS_COUNT 6
-struct DacpGCInterestingInfoData : ZeroInit<DacpGCInterestingInfoData>
+struct MSLAYOUT DacpGCInterestingInfoData : ZeroInit<DacpGCInterestingInfoData>
{
size_t interestingDataPoints[NUM_GC_DATA_POINTS];
size_t compactReasons[MAX_COMPACT_REASONS_COUNT];
@@ -808,7 +831,7 @@ struct DacpGCInterestingInfoData : ZeroInit<DacpGCInterestingInfoData>
}
};
-struct DacpGcHeapAnalyzeData
+struct MSLAYOUT DacpGcHeapAnalyzeData
: ZeroInit<DacpGcHeapAnalyzeData>
{
CLRDATA_ADDRESS heapAddr; // Only filled in in server mode, otherwise NULL
@@ -836,7 +859,7 @@ struct DacpGcHeapAnalyzeData
#define SYNCBLOCKDATA_COMFLAGS_RCW 2
#define SYNCBLOCKDATA_COMFLAGS_CF 4
-struct DacpSyncBlockData : ZeroInit<DacpSyncBlockData>
+struct MSLAYOUT DacpSyncBlockData : ZeroInit<DacpSyncBlockData>
{
CLRDATA_ADDRESS Object;
BOOL bFree; // if set, no other fields are useful
@@ -863,7 +886,7 @@ struct DacpSyncBlockData : ZeroInit<DacpSyncBlockData>
}
};
-struct DacpSyncBlockCleanupData : ZeroInit<DacpSyncBlockCleanupData>
+struct MSLAYOUT DacpSyncBlockCleanupData : ZeroInit<DacpSyncBlockCleanupData>
{
CLRDATA_ADDRESS SyncBlockPointer;
@@ -883,7 +906,7 @@ struct DacpSyncBlockCleanupData : ZeroInit<DacpSyncBlockCleanupData>
enum EHClauseType {EHFault, EHFinally, EHFilter, EHTyped, EHUnknown};
-struct DACEHInfo : ZeroInit<DACEHInfo>
+struct MSLAYOUT DACEHInfo : ZeroInit<DACEHInfo>
{
EHClauseType clauseType;
CLRDATA_ADDRESS tryStartOffset;
@@ -898,7 +921,7 @@ struct DACEHInfo : ZeroInit<DACEHInfo>
mdToken tokCatch; // the type token of the TYPED clause type
};
-struct DacpGetModuleAddress : ZeroInit<DacpGetModuleAddress>
+struct MSLAYOUT DacpGetModuleAddress : ZeroInit<DacpGetModuleAddress>
{
CLRDATA_ADDRESS ModulePtr;
HRESULT Request(IXCLRDataModule* pDataModule)
@@ -907,7 +930,7 @@ struct DacpGetModuleAddress : ZeroInit<DacpGetModuleAddress>
}
};
-struct DacpGetModuleData : ZeroInit<DacpGetModuleData>
+struct MSLAYOUT DacpGetModuleData : ZeroInit<DacpGetModuleData>
{
BOOL IsDynamic;
BOOL IsInMemory;
@@ -924,7 +947,7 @@ struct DacpGetModuleData : ZeroInit<DacpGetModuleData>
}
};
-struct DacpFrameData : ZeroInit<DacpFrameData>
+struct MSLAYOUT DacpFrameData : ZeroInit<DacpFrameData>
{
CLRDATA_ADDRESS frameAddr;
@@ -937,7 +960,7 @@ struct DacpFrameData : ZeroInit<DacpFrameData>
}
};
-struct DacpJitManagerInfo : ZeroInit<DacpJitManagerInfo>
+struct MSLAYOUT DacpJitManagerInfo : ZeroInit<DacpJitManagerInfo>
{
CLRDATA_ADDRESS managerAddr;
DWORD codeType; // for union below
@@ -946,14 +969,14 @@ struct DacpJitManagerInfo : ZeroInit<DacpJitManagerInfo>
enum CodeHeapType {CODEHEAP_LOADER=0,CODEHEAP_HOST,CODEHEAP_UNKNOWN};
-struct DacpJitCodeHeapInfo : ZeroInit<DacpJitCodeHeapInfo>
+struct MSLAYOUT DacpJitCodeHeapInfo : ZeroInit<DacpJitCodeHeapInfo>
{
DWORD codeHeapType; // for union below
union
{
CLRDATA_ADDRESS LoaderHeap; // if CODEHEAP_LOADER
- struct
+ struct MSLAYOUT
{
CLRDATA_ADDRESS baseAddr; // if CODEHEAP_HOST
CLRDATA_ADDRESS currentAddr;