示例#1
0
void CodeLiteLLDBApp::DeleteBreakpoints(const LLDBCommand& command)
{
    CHECK_DEBUG_SESSION_RUNNING();

    const LLDBBreakpoint::Vec_t& bps = command.GetBreakpoints();
    if(bps.empty()) {
        return;
    }

    wxPrintf("codelite-lldb: DeleteBreakpoints called\n");
    if(m_target.GetProcess().GetState() == lldb::eStateStopped) {
        wxPrintf("codelite-lldb: DeleteBreakpoints: process state is Stopped - will apply them now\n");
        for(size_t i = 0; i < bps.size(); ++i) {
            LLDBBreakpoint::Ptr_t breakpoint = bps.at(i);
            wxPrintf("codelite-lldb: deleting breakpoint: %s\n", breakpoint->ToString());
            if(breakpoint->IsApplied()) {
                lldb::SBBreakpoint lldbBreakpoint = m_target.FindBreakpointByID(breakpoint->GetId());
                if(lldbBreakpoint.IsValid()) {
                    lldbBreakpoint.ClearAllBreakpointSites();
                    m_target.BreakpointDelete(lldbBreakpoint.GetID());
                }
            }
        }
        NotifyBreakpointsUpdated();

    } else {
        wxPrintf("codelite-lldb: DeleteBreakpoints: process is Busy - will interrupt it\n");
        m_interruptReason = kInterruptReasonDeleteBreakpoint;
        m_target.GetProcess().SendAsyncInterrupt();
    }
}
示例#2
0
void CodeLiteLLDBApp::ApplyBreakpoints(const LLDBCommand& command)
{
    wxPrintf("codelite-lldb: ApplyBreakpoints called\n");
    if ( m_target.GetProcess().GetState() == lldb::eStateStopped ) {
        wxPrintf("codelite-lldb: ApplyBreakpoints: process state is stopped - will apply them now\n");
        // we can apply the breakpoints
        // Apply all breakpoints with an-invalid breakpoint ID
        LLDBBreakpoint::Vec_t breakpoints = command.GetBreakpoints();
        while( !breakpoints.empty() ) {
            LLDBBreakpoint::Ptr_t breakPoint = breakpoints.at(0);
            if ( !breakPoint->IsApplied() ) {
                switch( breakPoint->GetType() ) {
                case LLDBBreakpoint::kFunction: {
                    wxPrintf("codelite-lldb: creating breakpoint by name: %s\n", breakPoint->GetName());
                    m_target.BreakpointCreateByName(breakPoint->GetName().mb_str().data(), NULL);
                    break;
                }
                case LLDBBreakpoint::kFileLine: {
                    wxPrintf("codelite-lldb: creating breakpoint by location: %s,%d\n", breakPoint->GetFilename(), breakPoint->GetLineNumber());
                    m_target.BreakpointCreateByLocation(breakPoint->GetFilename().mb_str().data(), breakPoint->GetLineNumber());
                    break;
                }
                }
            }
            breakpoints.erase(breakpoints.begin());
        }
        NotifyBreakpointsUpdated();

    } else {
        wxPrintf("codelite-lldb: ApplyBreakpoints: process state is _NOT_ Stopped - interrupting process\n");
        // interrupt the process
        m_interruptReason = kInterruptReasonApplyBreakpoints;
        m_target.GetProcess().SendAsyncInterrupt();
    }
}