Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Some thoughts on doing breakpoints persistent
ollydbg:
UPDATED 2012-12-15: Patch was in https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2775&group_id=5358
Some related discussion in Re: Splitting debugger in two - specific debugger and common GUI
Hi, 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:
--- Code: ---void DebuggerGDB::OnProjectLoadingHook(cbProject* project, TiXmlElement* elem, bool loading)
--- End code ---
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).
--- Code: ---// ----------------------------------------------------------------------------
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
}
--- End code ---
But I can't determine which Event is good for loading breakpoints.
--- Code: ---// -- 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);
--- End code ---
EVT_PROJECT_ACTIVATE?
EVT_PROJECT_OPEN?
Any Comments?
Thanks!
MortenMacFly:
--- Quote from: ollydbg on June 16, 2009, 11:18:18 am ---I think both "breakpoints" list and "watch variables list" can be automatically saved to hard disk, and loaded when a project opened.
--- End quote ---
Notice that the watches can already be saved/loaded. You can have a look at how this is done...
Notice that this info should *not* be in a project file. This is developer-specific and not project specific. It mus be an external (addon) file or alike.
oBFusCATed:
Do we have such common file? Or everybody should save to his/her own file?
Visual studio for example uses project_name.user file for such thing?
We can do something similar and provide a common interface for it.
MortenMacFly:
--- Quote from: oBFusCATed on June 16, 2009, 12:43:43 pm ---We can do something similar and provide a common interface for it.
--- End quote ---
Probably a "layout" file would do. Similar like it's done with the project layout.
Jenna:
--- Quote from: MortenMacFly on June 16, 2009, 12:56:21 pm ---
--- Quote from: oBFusCATed on June 16, 2009, 12:43:43 pm ---We can do something similar and provide a common interface for it.
--- End quote ---
Probably a "layout" file would do. Similar like it's done with the project layout.
--- End quote ---
--- Quote from: MortenMacFly on June 16, 2009, 12:11:45 pm ---This is developer-specific and not project specific. It mus be an external (addon) file or alike.
--- End quote ---
That's the same for the layout-file we have at the moment and should probably be changed in a similar way we might do for watches/bp's.
Navigation
[0] Message Index
[#] Next page
Go to full version