public IL2NativeMap[] GetILToNativeMapping() { UInt32 pcMap; m_code.GetILToNativeMapping(0, out pcMap, null); if (pcMap == 0) { return(new IL2NativeMap[0]); } var map = new COR_DEBUG_IL_TO_NATIVE_MAP[pcMap]; m_code.GetILToNativeMapping((uint)map.Length, out pcMap, map); var ret = new IL2NativeMap[map.Length]; for (int i = 0; i < map.Length; i++) { ret[i] = new IL2NativeMap((int)map[i].ilOffset, (int)map[i].nativeStartOffset, (int)map[i].nativeEndOffset ); } return(ret); }
public IL2NativeMap[] GetILToNativeMapping() { UInt32 pcMap; m_code.GetILToNativeMapping(0, out pcMap, null); if (pcMap == 0) return new IL2NativeMap[0]; var map = new COR_DEBUG_IL_TO_NATIVE_MAP[pcMap]; m_code.GetILToNativeMapping((uint) map.Length, out pcMap, map); var ret = new IL2NativeMap[map.Length]; for (int i = 0; i < map.Length; i++) { ret[i] = new IL2NativeMap((int) map[i].ilOffset, (int) map[i].nativeStartOffset, (int) map[i].nativeEndOffset ); } return ret; }
// Sort an IL to native map entry by IL offset. // Non-IL regions get ommitted. private static void SortMapByIL(IL2NativeMap[] map) { Array.Sort(map, delegate(IL2NativeMap x, IL2NativeMap y) { if (x.IlOffset < y.IlOffset) return -1; if (x.IlOffset == y.IlOffset) return 0; return 1; }); }
public Il2NativeIterator(RawWriter w, IL2NativeMap[] il2nativeMapping, byte[] code) { m_writer = w; m_il2nativeMapping = il2nativeMapping; if (m_il2nativeMapping == null) { // No native info, so don't display it. Put range just out of reach. m_il2NativeEndIl = (code.Length + 1); return; } m_CodeLength = code.Length; SortMapByIL(m_il2nativeMapping); // Skip past initial entries for prolog, epilogue, unmapped, etc. // Since we sorted by IL, all of those entries (which get negative IL offsets) will come first. while ((m_il2NativeCursor < m_il2nativeMapping.Length) && (m_il2nativeMapping[m_il2NativeCursor].IlOffset < 0)) { m_il2NativeCursor++; } CalculateNextEndOffset(); }