| 955 | |
| 956 | #if 1 |
| 957 | bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPURegisters* registers, addr_target* outReturnAddressLoc, bool& alreadyRolledBackPC) |
| 958 | { |
| 959 | addr_target pcAddress = registers->GetPC(); |
| 960 | |
| 961 | auto exceptionDirectoryEntry = mExceptionDirectoryMap.Get(findPC, DBG_MAX_LOOKBACK); |
| 962 | if ((exceptionDirectoryEntry != NULL) && (findPC >= exceptionDirectoryEntry->mAddress) && |
| 963 | (findPC < exceptionDirectoryEntry->mAddress + exceptionDirectoryEntry->mAddressLength)) |
| 964 | { |
| 965 | auto dbgModule = exceptionDirectoryEntry->mDbgModule; |
| 966 | //const uint8* data = dbgModule->mExceptionData + exceptionDirectoryEntry->mExceptionPos; |
| 967 | |
| 968 | uint32 exceptionPos = exceptionDirectoryEntry->mExceptionPos; |
| 969 | if (dbgModule->IsObjectFile()) |
| 970 | { |
| 971 | exceptionPos -= dbgModule->mImageBase - dbgModule->GetLinkedModule()->mImageBase; |
| 972 | } |
| 973 | while ((exceptionPos & 1) != 0) |
| 974 | { |
| 975 | // It's a reference to another entry -- directly reference the 'exceptionPos' from that other entry |
| 976 | dbgModule->mOrigImageData->Read(dbgModule->mImageBase + (exceptionPos & ~1) + 8, (uint8*)&exceptionPos, 4); |
| 977 | } |
| 978 | |
| 979 | struct EntryHeader |
| 980 | { |
| 981 | uint8 mVersion; |
| 982 | uint8 mPrologSize; |
| 983 | uint8 mNumUnwindCodes; |
| 984 | uint8 mFrameRegister; |
| 985 | }; |
| 986 | |
| 987 | EntryHeader entryHeader; |
| 988 | |
| 989 | dbgModule->mOrigImageData->Read(dbgModule->mImageBase + exceptionPos, (uint8*)&entryHeader, sizeof(EntryHeader)); |
| 990 | |
| 991 | uint8 version = entryHeader.mVersion; |
| 992 | uint8 flags = (version >> 3); |
| 993 | version &= 7; |
| 994 | |
| 995 | //TODO: Sometimes we get a 'version 2'. Not sure how to parse that yet. |
| 996 | //BF_ASSERT(version == 1); |
| 997 | |
| 998 | //uint8 prologSize = GET(uint8); |
| 999 | //uint8 numUnwindCodes = GET(uint8); |
| 1000 | |
| 1001 | int dataSize = entryHeader.mNumUnwindCodes * 2; |
| 1002 | |
| 1003 | if (flags & 4) // UNW_FLAG_CHAININFO |
| 1004 | { |
| 1005 | if ((entryHeader.mNumUnwindCodes % 2) == 1) |
| 1006 | dataSize += 2; // Align |
| 1007 | dataSize += sizeof(uint32)*3; |
| 1008 | } |
| 1009 | |
| 1010 | uint8 dataBuf[512]; |
| 1011 | dbgModule->mOrigImageData->Read(dbgModule->mImageBase + exceptionPos + sizeof(EntryHeader), dataBuf, dataSize); |
| 1012 | const uint8* data = dataBuf; |
| 1013 | |
| 1014 | if (flags & 1) // UNW_FLAG_EHANDLER |
nothing calls this directly
no test coverage detected