示例#1
0
void XDebugManager::OnGotFocusFromXDebug(XDebugEvent& e)
{
    e.Skip();
    
    // Make sure codelite is "Raised"
    wxFrame* frame = EventNotifier::Get()->TopFrame();
    if ( frame->IsIconized() || !frame->IsShown() ) {
        frame->Raise();
    }
    
    CL_DEBUG("CodeLite: opening file %s:%d", e.GetFileName(), e.GetLineNumber()+1 ); // The user sees the line number from 1 (while scintilla counts them from 0)
    
    // Mark the debugger line / file
    IEditor *editor = m_plugin->GetManager()->FindEditor( e.GetFileName() );
    if ( !editor && wxFileName::Exists(e.GetFileName()) ) {
        // Try to open the editor
        if ( m_plugin->GetManager()->OpenFile(e.GetFileName(), "", e.GetLineNumber()) ) {
            editor = m_plugin->GetManager()->GetActiveEditor();
        }
    }
    
    if ( editor ) {
        m_plugin->GetManager()->SelectPage( editor->GetSTC() );
        SetDebuggerMarker( editor->GetSTC(), e.GetLineNumber() );
    }
    
    // Update the callstack/locals views
    DoRefreshDebuggerViews();
    
    // Re-apply any new breakpoints
    DoApplyBreakpoints();
}
void NodeJSDebugger::DoHighlightLine(const wxString& filename, int lineNo)
{
    IEditor* activeEditor = clGetManager()->OpenFile(filename, "", lineNo - 1);
    if(activeEditor) {
        SetDebuggerMarker(activeEditor, lineNo - 1);
    }
}
示例#3
0
void LLDBPlugin::OnLLDBStopped(LLDBEvent& event)
{
    event.Skip();
    CL_DEBUGS(wxString() << "CODELITE>> LLDB stopped at " << event.GetFileName() << ":" << event.GetLinenumber());
    m_connector.SetCanInteract(true);

    if(event.GetInterruptReason() == kInterruptReasonNone) {

        if(m_raisOnBpHit) { EventNotifier::Get()->TopFrame()->Raise(); }

        // Mark the debugger line / file
        IEditor* editor = m_mgr->FindEditor(event.GetFileName());
        if(!editor && wxFileName::Exists(event.GetFileName())) {
            // Try to open the editor
            editor = m_mgr->OpenFile(event.GetFileName(), "", event.GetLinenumber() - 1);
        }

        if(editor) {
            // select it first
            if(editor != m_mgr->GetActiveEditor()) {
                m_mgr->SelectPage(editor->GetCtrl());

            } else {
                // just make sure that the page has the focus
                editor->SetActive();
            }

            // clear the markers
            ClearDebuggerMarker();
            SetDebuggerMarker(editor->GetCtrl(), event.GetLinenumber() - 1);

        } else {
            ClearDebuggerMarker();
        }

        // request for local variables
        m_connector.RequestLocals();

        wxString message;
        if(!m_stopReasonPrompted && event.ShouldPromptStopReason(message)) {
            m_stopReasonPrompted = true; // show this message only once per debug session
            wxString msg;
            msg << "Program stopped\nStop reason: " << message;
            ::wxMessageBox(msg, "CodeLite", wxICON_ERROR | wxOK | wxCENTER);
        }

    } else if(event.GetInterruptReason() == kInterruptReasonApplyBreakpoints) {
        CL_DEBUG("Applying breakpoints and continue...");
        m_connector.ApplyBreakpoints();
        m_connector.Continue();

    } else if(event.GetInterruptReason() == kInterruptReasonDeleteAllBreakpoints) {
        CL_DEBUG("Deleting all breakpoints");
        m_connector.DeleteAllBreakpoints();
        m_connector.Continue();

    } else if(event.GetInterruptReason() == kInterruptReasonDeleteBreakpoint) {
        CL_DEBUG("Deleting all pending deletion breakpoints");
        m_connector.DeleteBreakpoints();
        m_connector.Continue();

    } else if(event.GetInterruptReason() == kInterruptReasonDetaching) {
        CL_DEBUG("Detaching from process");
        m_connector.Detach();
    }
}