| 755 | } |
| 756 | |
| 757 | BF_EXPORT bool BF_CALLTYPE Debugger_OpenFile(const char* launchPath, const char* targetPath, const char* args, const char* workingDir, void* envBlockPtr, int envBlockSize, bool hotSwapEnabled, DbgOpenFileFlags openFileFlags) |
| 758 | { |
| 759 | BF_ASSERT(gDebugger == NULL); |
| 760 | |
| 761 | if (!FileExists(launchPath)) |
| 762 | { |
| 763 | gDebugManager->mOutMessages.push_back(StrFormat("error Unable to locate specified launch target '%s'", launchPath)); |
| 764 | return false; |
| 765 | } |
| 766 | |
| 767 | DebuggerResult debuggerResult = DebuggerResult_Ok; |
| 768 | if ((gDebugManager->mDebugger64 != NULL) && (gDebugManager->mDebugger64->CanOpen(launchPath, &debuggerResult))) |
| 769 | gDebugger = gDebugManager->mDebugger64; |
| 770 | else |
| 771 | gDebugger = gDebugManager->mDebugger32; |
| 772 | |
| 773 | if (gDebugger == NULL) |
| 774 | { |
| 775 | if (debuggerResult == DebuggerResult_WrongBitSize) |
| 776 | gDebugManager->mOutMessages.push_back(StrFormat("error The file 32-bit file '%s' cannot be debugged because 32-bit debugger has been disabled", launchPath)); |
| 777 | return false; |
| 778 | } |
| 779 | |
| 780 | Array<uint8> envBlock; |
| 781 | if (envBlockPtr != NULL) |
| 782 | { |
| 783 | if (envBlockSize != 0) |
| 784 | envBlock.Insert(0, (uint8*)envBlockPtr, envBlockSize); |
| 785 | } |
| 786 | |
| 787 | gDebugger->OpenFile(launchPath, targetPath, args, workingDir, envBlock, hotSwapEnabled, openFileFlags); |
| 788 | return true; |
| 789 | } |
| 790 | |
| 791 | BF_EXPORT bool BF_CALLTYPE Debugger_ComptimeAttach(void* bfCompiler) |
| 792 | { |