void LLDBConnector::DeleteAllBreakpoints() { if(!IsRunning()) { m_pendingDeletionBreakpoints.clear(); m_breakpoints.clear(); LLDBEvent event(wxEVT_LLDB_BREAKPOINTS_UPDATED); event.SetBreakpoints(GetAllBreakpoints()); ProcessEvent(event); return; } // mark all breakpoints for deletion CL_DEBUGS(wxString() << "codelite: DeleteAllBreakpoints called"); m_pendingDeletionBreakpoints.swap(m_breakpoints); if(!IsCanInteract()) { Interrupt(kInterruptReasonDeleteAllBreakpoints); } else { LLDBCommand command; command.SetCommandType(kCommandDeleteAllBreakpoints); SendCommand(command); m_pendingDeletionBreakpoints.clear(); } }
void LLDBConnector::SendInterperterCommand(const wxString& command) { LLDBCommand lldbCommand; lldbCommand.SetCommandType(kCommandInterperterCommand); lldbCommand.SetExpression(command); SendCommand(lldbCommand); }
void LLDBConnector::AddWatch(const wxString& watch) { LLDBCommand command; command.SetCommandType(kCommandAddWatch); command.SetExpression(watch); SendCommand(command); }
void LLDBConnector::Interrupt(eInterruptReason reason) { LLDBCommand command; command.SetCommandType(kCommandInterrupt); command.SetInterruptReason(reason); SendCommand(command); }
void LLDBConnector::DeleteWatch(int lldbId) { LLDBCommand command; command.SetCommandType(kCommandDeleteWatch); command.SetLldbId(lldbId); SendCommand(command); }
void LLDBConnector::RequestLocals() { if(IsCanInteract()) { LLDBCommand command; command.SetCommandType(kCommandGetLocals); SendCommand(command); } }
void LLDBConnector::NextInstruction() { if(IsCanInteract()) { LLDBCommand command; command.SetCommandType(kCommandNextInstruction); SendCommand(command); } }
void LLDBConnector::ShowCurrentFileLine() { if(IsCanInteract()) { LLDBCommand command; command.SetCommandType(kCommandCurrentFileLine); SendCommand(command); } }
void MainDialog::OnStart(wxCommandEvent& event) { LLDBCommand command; command.SetCommandType( kCommandStart ); command.SetExecutable( m_filePickerExe->GetPath() ); m_connector.SendCommand( command ); LogCommand( command ); }
void LLDBConnector::RequestVariableChildren(int lldbId) { if(IsCanInteract()) { LLDBCommand command; command.SetCommandType(kCommandExpandVariable); command.SetLldbId(lldbId); SendCommand(command); } }
void LLDBConnector::SelectThread(int threadID) { if(IsCanInteract()) { LLDBCommand command; command.SetCommandType(kCommandSelectThread); command.SetThreadId(threadID); SendCommand(command); } }
void LLDBConnector::EvaluateExpression(const wxString& expression) { if(IsCanInteract()) { LLDBCommand command; command.SetCommandType(kCommandEvalExpression); command.SetExpression(expression); SendCommand(command); } }
void LLDBConnector::SelectFrame(int frameID) { if(IsCanInteract()) { LLDBCommand command; command.SetCommandType(kCommandSelectFrame); command.SetFrameId(frameID); SendCommand(command); } }
void LLDBConnector::Stop() { if(IsAttachedToProcess()) { Detach(); } else { LLDBCommand command; command.SetCommandType(kCommandStop); SendCommand(command); } }
void MainDialog::OnLLDBStarted(LLDBEvent& e) { e.Skip(); m_textCtrlLog->AppendText(wxString() << "LLDB Started successfully\n"); LLDBCommand command; command.SetCommandType( kCommandRun ); command.SetCommandArguments( "" ); m_connector.SendCommand( command ); m_textCtrlLog->AppendText("Running...\n"); }
void LLDBConnector::Detach() { if(IsCanInteract()) { CL_DEBUG("Sending 'Detach' command"); LLDBCommand command; command.SetCommandType(kCommandDetach); SendCommand(command); } else { Interrupt(kInterruptReasonDetaching); } }
void LLDBConnector::Start(const LLDBCommand& runCommand) { LLDBCommand startCommand; startCommand.SetExecutable( runCommand.GetExecutable() ); startCommand.SetCommandType( kCommandStart ); SendCommand( startCommand ); // stash the runCommand for the future 'Run()' call m_runCommand.Clear(); m_runCommand = runCommand; m_runCommand.SetCommandType( kCommandRun ); }
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::ApplyBreakpoints() { if(!m_breakpoints.empty()) { if(IsCanInteract()) { LLDBCommand command; command.SetCommandType(kCommandApplyBreakpoints); command.SetBreakpoints(GetUnappliedBreakpoints()); SendCommand(command); m_breakpoints.clear(); } else { Interrupt(kInterruptReasonApplyBreakpoints); } } }
void LLDBConnector::DeleteBreakpoints() { if ( IsCanInteract() ) { CL_DEBUGS(wxString () << "codelite: deleting breakpoints (total of " << m_pendingDeletionBreakpoints.size() << " breakpoints)"); LLDBCommand command; command.SetCommandType( kCommandDeleteBreakpoint ); command.SetBreakpoints( m_pendingDeletionBreakpoints ); SendCommand( command ); CL_DEBUGS(wxString () << "codelite: DeleteBreakpoints celar pending deletionbreakpoints queue"); m_pendingDeletionBreakpoints.clear(); } else { CL_DEBUG("codelite: interrupting codelite-lldb for kInterruptReasonDeleteBreakpoint"); Interrupt( kInterruptReasonDeleteBreakpoint ); } }
void LLDBPlugin::OnDebugCoreFile(clDebugEvent& event) { if(event.GetDebuggerName() != LLDB_DEBUGGER_NAME) { event.Skip(); return; } #ifdef __WXMSW__ ::wxMessageBox( _("Debug core file with LLDB is not supported under Windows"), "CodeLite", wxOK | wxCENTER | wxICON_WARNING); return; #endif if(!DoInitializeDebugger(event, false)) { 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(); LLDBCommand startCommand; startCommand.FillEnvFromMemory(); startCommand.SetCommandType(kCommandDebugCoreFile); startCommand.SetExecutable(event.GetExecutableName()); startCommand.SetCorefile(event.GetCoreFile()); startCommand.SetWorkingDirectory(event.GetWorkingDirectory()); startCommand.SetRedirectTTY(m_terminalTTY); m_connector.OpenCoreFile(startCommand); } 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); }
void LLDBConnector::Continue() { LLDBCommand command; command.SetCommandType(kCommandContinue); SendCommand(command); }
void LLDBConnector::Next() { LLDBCommand command; command.SetCommandType(kCommandNext); SendCommand(command); }
void LLDBConnector::StepOut() { LLDBCommand command; command.SetCommandType(kCommandStepOut); SendCommand(command); }