| 216 | } |
| 217 | |
| 218 | DbgModule* DebugTarget::SetupDyn(const StringImpl& filePath, DataStream* stream, intptr imageBase) |
| 219 | { |
| 220 | BP_ZONE("DebugTarget::SetupDyn"); |
| 221 | |
| 222 | //AutoDbgTime dbgTime("DebugTarget::SetupDyn " + filePath); |
| 223 | |
| 224 | DbgModule* dwarf = new COFF(this); |
| 225 | dwarf->mFilePath = filePath; |
| 226 | dwarf->mImageBase = (intptr)imageBase; |
| 227 | if (!dwarf->ReadCOFF(stream, DbgModuleKind_Module)) |
| 228 | { |
| 229 | //mDebugger->OutputMessage(StrFormat("Debugger failed to read binary: %s", fileName.c_str())); |
| 230 | delete dwarf; |
| 231 | return NULL; |
| 232 | } |
| 233 | AddDbgModule(dwarf); |
| 234 | |
| 235 | dwarf->mDisplayName = GetFileName(filePath); |
| 236 | dwarf->mOrigImageData = new DbgModuleMemoryCache(dwarf->mImageBase, dwarf->mImageSize); |
| 237 | CheckTargetBinary(dwarf); |
| 238 | |
| 239 | /*dbgModule->mOrigImageData = new uint8[dbgModule->mImageSize]; |
| 240 | memset(dbgModule->mOrigImageData, 0xCC, dbgModule->mImageSize); |
| 241 | for (auto& section : dbgModule->mSections) |
| 242 | { |
| 243 | bool couldRead = mDebugger->ReadMemory((intptr)imageBase + section.mAddrStart, section.mAddrLength, dbgModule->mOrigImageData + section.mAddrStart); |
| 244 | BF_ASSERT(couldRead); |
| 245 | } |
| 246 | dbgModule->GotImageData();*/ |
| 247 | return dwarf; |
| 248 | } |
| 249 | |
| 250 | String DebugTarget::UnloadDyn(addr_target imageBase) |
| 251 | { |