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(); } }
BreakpointInfo::Vec_t LLDBBreakpoint::ToBreakpointInfoVector(const LLDBBreakpoint::Vec_t& breakpoints) { BreakpointInfo::Vec_t bps; for(size_t i=0; i<breakpoints.size(); ++i) { LLDBBreakpoint::Ptr_t bp = breakpoints.at(i); BreakpointInfo gdbBp; gdbBp.Create(bp->GetFilename(), bp->GetLineNumber(), ++ s_internalGdbBpId); gdbBp.bp_type = BP_type_break; // dont add breakpoints to a non existent location bps.push_back( gdbBp ); } return bps; }
void LLDBConnector::AddBreakpoints(const LLDBBreakpoint::Vec_t& breakpoints) { for(size_t i = 0; i < breakpoints.size(); ++i) { AddBreakpoint(breakpoints.at(i), false); } }