UPDATED 2012-12-15: Patch was in
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2775&group_id=5358Some related discussion in
Re: Splitting debugger in two - specific debugger and common GUIHi, all.
I'm thinking to save the breakpoints in debuggergdb plugin. (I don't think I have the ability to do the whole job, just plan to do this ....
)
After reading the related source code, I think the best time to "load the breakpoints from a project" is in:
void DebuggerGDB::OnProjectLoadingHook(cbProject* project, TiXmlElement* elem, bool loading)
I think both "breakpoints" list and "watch variables list" can be automatically saved to hard disk, and loaded when a project opened.
Also, we can take the source code from "browsetracker.cpp" as a reference (BrowseTracker plugin).
// ----------------------------------------------------------------------------
void ProjectData::LoadLayout()
// ----------------------------------------------------------------------------
{
// Load a layout file for this project
#if defined(LOGGING)
LOGIT( _T("ProjectData::LoadLayout()for[%s]"),m_ProjectFilename.c_str() );
#endif
if (m_ProjectFilename.IsEmpty())
return ;
wxFileName fname(m_ProjectFilename);
fname.SetExt(_T("bmarks"));
BrowseTrackerLayout layout( m_pCBProject );
layout.Open(fname.GetFullPath(), m_FileBrowse_MarksArchive, m_FileBook_MarksArchive);
m_bLayoutLoaded = true;
}
// ----------------------------------------------------------------------------
void ProjectData::SaveLayout()
// ----------------------------------------------------------------------------
{
// Write a layout file for this project
#if defined(LOGGING)
LOGIT( _T("ProjectData::SAVELayout()") );
#endif
if (m_ProjectFilename.IsEmpty())
return ;
wxFileName fname(m_ProjectFilename);
fname.SetExt(_T("bmarks"));
BrowseTrackerLayout layout( m_pCBProject );
////DumpBrowse_Marks(wxT("BookMarks"));
////DumpBrowse_Marks(wxT("BrowseMarks"));
layout.Save(fname.GetFullPath(), m_FileBrowse_MarksArchive, m_FileBook_MarksArchive);
//// *Testing* See if cbEditor is actually there
//EditorBase* eb = m_EditorBaseArray[1];
//cbEditor* cbed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(eb);
//cbStyledTextCtrl* control = cbed->GetControl();
//#if defined(LOGGING)
//LOGIT( _T("eb[%p]cbed[%p]control[%p]"), eb, cbed, control );
//#endif
//// *Testing* Check against our array
//eb = m_EditorBaseArray[1];
//cbed = m_cbEditorArray[1];
//control = m_cbSTCArray[1];
//#if defined(LOGGING)
//LOGIT( _T("eb[%p]cbed[%p]control[%p]"), eb, cbed, control );
//#endif
}
But I can't determine which Event is good for loading breakpoints.
// -- Project events
// EVT_PROJECT_OPEN( BrowseTracker::OnProjectOpened)
Manager::Get()->RegisterEventSink(cbEVT_PROJECT_OPEN, new cbEventFunctor<BrowseTracker, CodeBlocksEvent>(this, &BrowseTracker::OnProjectOpened));
// EVT_PROJECT_CLOSE( BrowseTracker::OnProjectOpened)
Manager::Get()->RegisterEventSink(cbEVT_PROJECT_CLOSE, new cbEventFunctor<BrowseTracker, CodeBlocksEvent>(this, &BrowseTracker::OnProjectClosing));
// EVT_PROJECT_ACTIVATE( BrowseTracker::OnProjectActivated)
Manager::Get()->RegisterEventSink(cbEVT_PROJECT_ACTIVATE, new cbEventFunctor<BrowseTracker, CodeBlocksEvent>(this, &BrowseTracker::OnProjectActivatedEvent));
// hook to project loading procedure
// This hook only occurs if the project has an "extension" xml entry
ProjectLoaderHooks::HookFunctorBase* myProjhook = new ProjectLoaderHooks::HookFunctor<BrowseTracker>(this, &BrowseTracker::OnProjectLoadingHook);
m_ProjectHookId = ProjectLoaderHooks::RegisterHook(myProjhook);
EVT_PROJECT_ACTIVATE?
EVT_PROJECT_OPEN?
Any Comments?
Thanks!