Exemplo n.º 1
0
void XDebugManager::OnToggleBreakpoint(clDebugEvent& e)
{
    if ( !PHPWorkspace::Get()->IsOpen() ) {
        e.Skip();
        return;
    }
    
    // User toggled a breakpoint
    IEditor* editor = m_plugin->GetManager()->GetActiveEditor();
    if ( editor && editor->GetFileName().GetFullPath() == e.GetFileName() ) {
        // Correct editor
        // add marker
        if ( m_breakpointsMgr.HasBreakpoint(e.GetFileName(), e.GetInt()) ) {
            
            XDebugBreakpoint bp;
            m_breakpointsMgr.GetBreakpoint(e.GetFileName(), e.GetInt(), bp);
            if ( bp.IsApplied() && m_readerThread ) {
                // Remove it from XDebug as well
                DoDeleteBreakpoint( bp.GetBreakpointId() );
                
            }
            m_breakpointsMgr.DeleteBreakpoint( e.GetFileName(), e.GetInt() );
            
        } else {
            m_breakpointsMgr.AddBreakpoint( e.GetFileName(), e.GetInt() );
            DoApplyBreakpoints();
            
        }
        DoRefreshBreakpointsMarkersForEditor( editor );
    }
}
Exemplo n.º 2
0
void NodeJSDebugger::OnToggleBreakpoint(clDebugEvent& event)
{
    event.Skip();
    if(NodeJSWorkspace::Get()->IsOpen()) {
        event.Skip(false);
        IEditor* editor = clGetManager()->GetActiveEditor();
        if(editor && (editor->GetFileName().GetFullPath() == event.GetFileName())) {
            // Correct editor
            // add marker
            NodeJSBreakpoint bp = m_bptManager.GetBreakpoint(event.GetFileName(), event.GetInt());
            if(bp.IsOk()) {
                if(bp.IsApplied() && IsConnected()) {
                    // Tell NodeJS to delete this breakpoint
                    DeleteBreakpoint(bp);
                }
                m_bptManager.DeleteBreakpoint(event.GetFileName(), event.GetInt());
            } else {
                // We have no breakpoint on this file/line (yet)
                m_bptManager.AddBreakpoint(event.GetFileName(), event.GetInt());
                bp = m_bptManager.GetBreakpoint(event.GetFileName(), event.GetInt());
                if(IsConnected()) {
                    SetBreakpoint(bp);
                }
            }

            // Update the UI
            m_bptManager.SetBreakpoints(editor);
            clDebugEvent event(wxEVT_NODEJS_DEBUGGER_UPDATE_BREAKPOINTS_VIEW);
            EventNotifier::Get()->AddPendingEvent(event);
        }
    }
}
Exemplo n.º 3
0
void LLDBPlugin::OnToggleBreakpoint(clDebugEvent& event)
{
    // Call Skip() here since we want codelite to manage the breakpoint as well ( in term of serialization in the
    // session file )
    CHECK_IS_LLDB_SESSION();

    // check to see if we are removing a breakpoint or adding one
    LLDBBreakpoint::Ptr_t bp(new LLDBBreakpoint(event.GetFileName(), event.GetInt()));
    IEditor* editor = m_mgr->GetActiveEditor();

    if(editor) {
        // get the marker type set on the line
        int markerType = editor->GetCtrl()->MarkerGet(bp->GetLineNumber() - 1);
        for(size_t type = smt_FIRST_BP_TYPE; type <= smt_LAST_BP_TYPE; ++type) {
            int markerMask = (1 << type);
            if(markerType & markerMask) {
                // removing a breakpoint. "DeleteBreakpoint" will handle the interactive/non-interactive mode
                // of the debugger
                m_connector.MarkBreakpointForDeletion(bp);
                m_connector.DeleteBreakpoints();
                return;
            }
        }

        // if we got here, its a new breakpoint, add it
        // Add the breakpoint to the list of breakpoints
        m_connector.AddBreakpoint(bp->GetFilename(), bp->GetLineNumber());

        // apply it. In case the debugger can not interact with, it will be interrupted and the interrupt reason
        // will be set to ApplyBreakpoints
        m_connector.ApplyBreakpoints();
    }
}
Exemplo n.º 4
0
void NodeJSDebugger::OnHighlightLine(clDebugEvent& event)
{
    event.Skip();
    int line = event.GetLineNumber();
    wxFileName file = event.GetFileName();

    ClearDebuggerMarker();
    if(file.Exists()) {
        CallAfter(&NodeJSDebugger::DoHighlightLine, file.GetFullPath(), line);

    } else {
        // Probably a node.js internal file
        wxFileName fn(clStandardPaths::Get().GetUserDataDir(), file.GetFullPath());
        fn.AppendDir("webtools");
        fn.AppendDir("tmp");
        if(fn.Exists()) {
            CallAfter(&NodeJSDebugger::DoHighlightLine, fn.GetFullPath(), line);
        } else {
            // Ask the file from nodejs
            GetCurrentFrameSource(file.GetFullPath(), line);
        }
    }
}