diff options
author | Kyungwoo Lee <kyulee@microsoft.com> | 2015-11-11 01:20:00 +0300 |
---|---|---|
committer | Kyungwoo Lee <kyulee@microsoft.com> | 2015-11-11 18:45:57 +0300 |
commit | b7c1ac4e50c26816f818956c7ac74cdc8336c7f0 (patch) | |
tree | 2016042a762b7c68a2eab337e591c2121dce34a4 /src/JitInterface | |
parent | 4e05afda01a1112fceea3f610bd4fe64d309939c (diff) |
Emit frame info
This supports for emitting frame info for Windows.
Basically pdata/xdata is constructed like C++ to allow call stack dumps.
EH table itself is not populated yet since EH model is not determined.
The native object writer part is under review -- https://github.com/dotnet/llilc/pull/933
Tested debugger now shows call stacks on the managed code that we emit in Windows.
Diffstat (limited to 'src/JitInterface')
-rw-r--r-- | src/JitInterface/src/CorInfoImpl.cs | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/JitInterface/src/CorInfoImpl.cs b/src/JitInterface/src/CorInfoImpl.cs index e095c9629..e293ef9f4 100644 --- a/src/JitInterface/src/CorInfoImpl.cs +++ b/src/JitInterface/src/CorInfoImpl.cs @@ -82,7 +82,9 @@ namespace Internal.JitInterface RODataAlignment = _roDataAlignment, ROData = _roData, - Relocs = (_relocs != null) ? _relocs.ToArray() : null + Relocs = (_relocs != null) ? _relocs.ToArray() : null, + + FrameInfos = _frameInfos }; } finally @@ -125,6 +127,10 @@ namespace Internal.JitInterface _roData = null; _relocs = null; + + _numFrameInfos = 0; + _usedFrameInfos = 0; + _frameInfos = null; } Dictionary<Object, IntPtr> _objectToHandle = new Dictionary<Object, IntPtr>(); @@ -1723,6 +1729,10 @@ namespace Internal.JitInterface int _roDataAlignment; byte[] _roData; + int _numFrameInfos; + int _usedFrameInfos; + FrameInfo[] _frameInfos; + void allocMem(IntPtr _this, uint hotCodeSize, uint coldCodeSize, uint roDataSize, uint xcptnsCount, CorJitAllocMemFlag flag, ref void* hotCodeBlock, ref void* coldCodeBlock, ref void* roDataBlock) { hotCodeBlock = (void *)GetPin(_code = new byte[hotCodeSize]); @@ -1747,15 +1757,31 @@ namespace Internal.JitInterface roDataBlock = (void*)GetPin(_roData = new byte[roDataSize]); } + + if (_numFrameInfos > 0) + { + _frameInfos = new FrameInfo[_numFrameInfos]; + } } void reserveUnwindInfo(IntPtr _this, [MarshalAs(UnmanagedType.Bool)]bool isFunclet, [MarshalAs(UnmanagedType.Bool)]bool isColdCode, uint unwindSize) { + _numFrameInfos++; } void allocUnwindInfo(IntPtr _this, byte* pHotCode, byte* pColdCode, uint startOffset, uint endOffset, uint unwindSize, byte* pUnwindBlock, CorJitFuncKind funcKind) { - // TODO: Unwind Info + FrameInfo frameInfo = new FrameInfo(); + frameInfo.StartOffset = (int)startOffset; + frameInfo.EndOffset = (int)endOffset; + frameInfo.BlobData = new byte[unwindSize]; + for (uint i = 0; i < unwindSize; i++) + { + frameInfo.BlobData[i] = pUnwindBlock[i]; + } + + Debug.Assert(_usedFrameInfos < _frameInfos.Length); + _frameInfos[_usedFrameInfos++] = frameInfo; } void* allocGCInfo(IntPtr _this, UIntPtr size) |