bool Pdb::Create(One<Host> local, const String& exefile, const String& cmdline) { STARTUPINFO si; ZeroMemory(&si, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = 0; String cl; if(exefile.Find(' ') >= 0) cl << '\"' << exefile << '\"'; else cl << exefile; if(!IsNull(cmdline)) cl << ' ' << cmdline; Buffer<char> cmd(cl.GetLength() + 1); memcpy(cmd, cl, cl.GetLength() + 1); PROCESS_INFORMATION pi; ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); Buffer<char> env(local->GetEnvironment().GetCount() + 1); memcpy(env, ~local->GetEnvironment(), local->GetEnvironment().GetCount() + 1); bool h = CreateProcess(exefile, cmd, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE|DEBUG_ONLY_THIS_PROCESS|DEBUG_PROCESS, ~env, NULL, &si, &pi); if(!h) { Exclamation("Error creating process&[* " + DeQtf(exefile) + "]&" + "Windows error: " + DeQtf(GetLastErrorMessage())); return false; } hProcess = pi.hProcess; CloseHandle(pi.hThread); IdeSetBottom(*this); IdeSetRight(disas); LoadFromGlobal(*this, CONFIGNAME); if(!SymInitialize(hProcess, 0, FALSE)) { Error(); return false; } SymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_UNDNAME|SYMOPT_NO_UNQUALIFIED_LOADS); lock = 0; stop = false; refreshmodules = true; terminated = false; running = true; RunToException(); // Sync(); return true; }
virtual String GetEnvironment() { return host->GetEnvironment(); }