| 148 | } |
| 149 | |
| 150 | DbgModule* DebugTarget::Init(const StringImpl& launchPath, const StringImpl& targetPath, intptr imageBase) |
| 151 | { |
| 152 | BP_ZONE("DebugTarget::Init"); |
| 153 | |
| 154 | AutoDbgTime dbgTime("DebugTarget::Init Launch:" + launchPath + " Target:" + targetPath); |
| 155 | |
| 156 | mTargetPath = targetPath; |
| 157 | FileStream fileStream; |
| 158 | fileStream.mFP = _wfopen(UTF8Decode(launchPath).c_str(), L"rb"); |
| 159 | if (fileStream.mFP == NULL) |
| 160 | { |
| 161 | mDebugger->OutputMessage(StrFormat("Debugger failed to open binary: %s\n", launchPath.c_str())); |
| 162 | return NULL; |
| 163 | } |
| 164 | |
| 165 | DbgModule* dwarf = new COFF(this); |
| 166 | mLaunchBinary = dwarf; |
| 167 | dwarf->mDisplayName = GetFileName(launchPath); |
| 168 | dwarf->mFilePath = launchPath; |
| 169 | dwarf->mImageBase = (intptr)imageBase; |
| 170 | if (!dwarf->ReadCOFF(&fileStream, DbgModuleKind_Module)) |
| 171 | { |
| 172 | mDebugger->OutputMessage(StrFormat("Debugger failed to read binary: %s\n", launchPath.c_str())); |
| 173 | delete dwarf; |
| 174 | return NULL; |
| 175 | } |
| 176 | CheckTargetBinary(dwarf); |
| 177 | |
| 178 | AddDbgModule(dwarf); |
| 179 | return dwarf; |
| 180 | } |
| 181 | |
| 182 | void DebugTarget::CreateEmptyTarget() |
| 183 | { |
nothing calls this directly
no test coverage detected