LLDBBreakpoint::Vec_t LLDBConnector::GetUnappliedBreakpoints() { LLDBBreakpoint::Vec_t unappliedBreakpoints; for(size_t i = 0; i < m_breakpoints.size(); ++i) { if(!m_breakpoints.at(i)->IsApplied()) { unappliedBreakpoints.push_back(m_breakpoints.at(i)); } } return unappliedBreakpoints; }
void CodeLiteLLDBApp::NotifyBreakpointsUpdated() { LLDBBreakpoint::Vec_t breakpoints; int num = m_target.GetNumBreakpoints(); wxPrintf("codelite-lldb: Calling NotifyBreakpointsUpdated(). Got %d breakpoints\n", num); for(int i=0; i<num; ++i) { lldb::SBBreakpoint bp = m_target.GetBreakpointAtIndex(i); if ( bp.IsValid() && bp.GetNumResolvedLocations() ) { // Add the parent breakpoint LLDBBreakpoint::Ptr_t mainBreakpoint( new LLDBBreakpoint() ); mainBreakpoint->SetId( bp.GetID() ); if ( bp.GetNumLocations() > 1 ) { // add all the children locations to the main breakpoint for(size_t i=0; i<bp.GetNumLocations(); ++i) { lldb::SBBreakpointLocation loc = bp.GetLocationAtIndex(i); lldb::SBFileSpec fileLoc = loc.GetAddress().GetLineEntry().GetFileSpec(); wxFileName bpFile( fileLoc.GetDirectory(), fileLoc.GetFilename() ); // Create a breakpoint for this location LLDBBreakpoint::Ptr_t new_bp(new LLDBBreakpoint()); new_bp->SetType( LLDBBreakpoint::kLocation ); new_bp->SetFilename( bpFile.GetFullPath() ); new_bp->SetLineNumber( loc.GetAddress().GetLineEntry().GetLine() ); new_bp->SetName( loc.GetAddress().GetFunction().GetName() ); mainBreakpoint->GetChildren().push_back( new_bp ); } } else { lldb::SBBreakpointLocation loc = bp.GetLocationAtIndex(0); lldb::SBFileSpec fileLoc = loc.GetAddress().GetLineEntry().GetFileSpec(); wxFileName bpFile( fileLoc.GetDirectory(), fileLoc.GetFilename() ); mainBreakpoint->SetType( LLDBBreakpoint::kFileLine ); mainBreakpoint->SetName( loc.GetAddress().GetFunction().GetName() ); mainBreakpoint->SetFilename( bpFile.GetFullPath() ); mainBreakpoint->SetLineNumber( loc.GetAddress().GetLineEntry().GetLine() ); } breakpoints.push_back( mainBreakpoint ); } } LLDBReply reply; reply.SetReplyType( kReplyTypeBreakpointsUpdated ); reply.SetBreakpoints( breakpoints ); SendReply( reply ); }
LLDBBreakpoint::Vec_t LLDBBreakpoint::FromBreakpointInfoVector(const BreakpointInfo::Vec_t& breakpoints) { LLDBBreakpoint::Vec_t bps; for(size_t i=0; i<breakpoints.size(); ++i) { if ( breakpoints.at(i).bp_type == BP_type_break ) { LLDBBreakpoint::Ptr_t bp(new LLDBBreakpoint() ); const BreakpointInfo &gdbBp = breakpoints.at(i); bp->SetName( gdbBp.function_name ); bp->SetFilename( gdbBp.file ); bp->SetLineNumber( gdbBp.lineno ); bp->SetType( kFileLine ); bps.push_back( bp ); } } return bps; }
void LLDBConnector::InvalidateBreakpoints() { // mark all the breakpoints as "not-applied" (id=-1) LLDBBreakpoint::Vec_t updatedList; for(size_t i = 0; i < m_breakpoints.size(); ++i) { m_breakpoints.at(i)->Invalidate(); if(wxFileName::Exists(m_breakpoints.at(i)->GetFilename())) { updatedList.push_back(m_breakpoints.at(i)); } } // we keep only breakpoints with valid filename m_breakpoints.swap(updatedList); ClearBreakpointDeletionQueue(); CL_DEBUG("codelite: InvalidateBreakpoints called"); m_pendingDeletionBreakpoints.clear(); }