void LLDBPlugin::OnDebugAttachToProcess(clDebugEvent& event) { if(event.GetDebuggerName() != LLDB_DEBUGGER_NAME) { event.Skip(); return; } #ifdef __WXMSW__ ::wxMessageBox( _("Attach to process with LLDB is not supported under Windows"), "CodeLite", wxOK | wxCENTER | wxICON_WARNING); return; #endif wxString terminalTitle; terminalTitle << "Console PID " << event.GetInt(); if(!DoInitializeDebugger(event, true, terminalTitle)) return; LLDBConnectReturnObject retObj; LLDBSettings settings; settings.Load(); if(m_connector.Connect(retObj, settings, 5)) { // Apply the environment EnvSetter env; // remove all breakpoints from previous session m_connector.DeleteAllBreakpoints(); LLDBSettings settings; settings.Load(); // Attach to the process LLDBCommand command; command.SetCommandType(kCommandAttachProcess); command.SetProcessID(event.GetInt()); command.SetSettings(settings); m_connector.AttachProcessWithPID(command); } else { // Failed to connect, notify and perform cleanup DoCleanup(); wxString message; message << _("Could not connect to codelite-lldb at '") << m_connector.GetConnectString() << "'"; ::wxMessageBox(message, "CodeLite", wxICON_ERROR | wxOK | wxCENTER); return; } }
void LLDBConnector::Start(const LLDBCommand& runCommand) { LLDBCommand startCommand; startCommand.SetExecutable(runCommand.GetExecutable()); startCommand.SetCommandType(kCommandStart); startCommand.SetWorkingDirectory(runCommand.GetWorkingDirectory()); // send the settings as well LLDBSettings settings; settings.Load(); startCommand.SetSettings(settings); SendCommand(startCommand); // stash the runCommand for the future 'Run()' call m_runCommand.Clear(); m_runCommand = runCommand; m_runCommand.SetCommandType(kCommandRun); }