Sometimes, I fill it takes several times to let the GDB load all the plugins, so I have complain there:
Is there a C::B command line option support loading a specific plugin (http://forums.codeblocks.org/index.php/topic,11744.msg79707.html#msg79707)
And the developers of C::B give me some ideas. Finally I totally agree with mariocup (http://forums.codeblocks.org/index.php?action=profile;u=3852)'s way. So, here is the configure file you can change.
<plugins>
<TRY_TO_ACTIVATE>
<str>
<![CDATA[]]>
</str>
</TRY_TO_ACTIVATE>
<INSTALL_GLOBALLY bool="1" />
<INSTALL_CONFIRMATION bool="1" />
<ASTYLEPLUGIN bool="0" />
<AUTOSAVE bool="0" />
<AUTOVERSIONING bool="0" />
<BROWSETRACKER bool="0" />
<BYOGAMES bool="0" />
<CB_KODERS bool="0" />
<CCCC bool="0" />
<CLASSWIZARD bool="0" />
<CODECOMPLETION bool="1" />
<CODESNIPPETS bool="0" />
<CODESTAT bool="0" />
<COMPILER bool="1" />
<COPYSTRINGS bool="0" />
<CPPCHECK bool="0" />
<DEBUGGER bool="0" />
<FILESEXTENSIONHANDLER bool="0" />
<DEVPAKUPDATER bool="0" />
<CBDRAGSCROLL bool="0" />
<ENVVARS bool="0" />
<EXPORTER bool="0" />
<HEADERFIXUP bool="0" />
<HEXEDITOR bool="0" />
<INCREMENTALSEARCH bool="0" />
<CBKEYBINDER bool="0" />
<LIB_FINDER bool="0" />
<MOUSESAP bool="0" />
<OPENFILESLIST bool="0" />
<PROFILER bool="0" />
<PROJECTSIMPORTER bool="0" />
<REGEXTESTBED bool="0" />
<SCRIPTEDWIZARD bool="0" />
<SYMTAB bool="0" />
<THREADSEARCH bool="0" />
<TODOLIST bool="0" />
<WXSMITH bool="0" />
<WXSMITHMIME bool="0" />
<WXSMITHAUI bool="0" />
<WXSMITHCONTRIBITEMS bool="0" />
<WINDOWSXPLOOKNFEEL bool="0" />
<CCPP_TEST_PLUGIN bool="0" />
<CSCOPE bool="0" />
<DOXYBLOCKS bool="0" />
<EDITORTWEAKS bool="0" />
<SPELLCHECKER bool="0" />
<HELPPLUGIN bool="0" />
</plugins>
set zero will let C::B do not load the plugin. For debugging CC, you need only enable several plugins.
Then you need to change the start argument of src target:
--debug-log --no-check-associations -ns -nd -p=debugCC
Then, you need to modify the "debugCC.conf" file.
BTW: debugCC.conf file can be somewhere in:
C:\Documents and Settings\YOUNAME\Application Data\codeblocks
For me, I run the portable C::B from:
E:\code\cb\cb_app (which as a "CbLauncher.exe" in this folder ).
Then the debugCC.conf file is located in:
E:\code\cb\cb_app\AppData\codeblocks
Happy debugging !!!!! :D
By the way, the related source code when loading a plug-in is in:
sdk\pluginmanager.cpp
void PluginManager::LoadAllPlugins()
{
// check if a plugin crashed the app last time
wxString probPlugin = Manager::Get()->GetConfigManager(_T("plugins"))->Read(_T("/try_to_activate"), wxEmptyString);
if (!probPlugin.IsEmpty())
{
wxString msg;
msg.Printf(_("Plugin \"%s\" failed to load last time Code::Blocks was executed.\n"
"Do you want to disable this plugin from loading?"), probPlugin.c_str());
if (cbMessageBox(msg, _("Warning"), wxICON_WARNING | wxYES_NO) == wxID_NO)
probPlugin = _T("");
}
PluginElement* elem = 0;
for (unsigned int i = 0; i < m_Plugins.GetCount(); ++i)
{
elem = m_Plugins[i];
cbPlugin* plug = elem->plugin;
if (!plug || plug->IsAttached())
continue;
// do not load it if the user has explicitly asked not to...
wxString baseKey;
baseKey << _T("/") << elem->info.name;
bool loadIt = Manager::Get()->GetConfigManager(_T("plugins"))->ReadBool(baseKey, true);
// if we have a problematic plugin, check if this is it
if (loadIt && !probPlugin.IsEmpty())
{
loadIt = elem->info.title != probPlugin;
// if this is the problematic plugin, don't load it
if (!loadIt)
Manager::Get()->GetConfigManager(_T("plugins"))->Write(baseKey, false);
}
if (loadIt)
{
Manager::Get()->GetConfigManager(_T("plugins"))->Write(_T("/try_to_activate"), elem->info.title);
Manager::Get()->GetLogManager()->Log(elem->info.name);
try
{
AttachPlugin(plug);
Manager::Get()->GetConfigManager(_T("plugins"))->Write(_T("/try_to_activate"), wxEmptyString, false);
}
catch (cbException& exception)
{
Manager::Get()->GetLogManager()->Log(_T("[failed]"));
exception.ShowErrorMessage(false);
wxString msg;
msg.Printf(_("Plugin \"%s\" failed to load...\n"
"Do you want to disable this plugin from loading next time?"), elem->info.title.c_str());
if (cbMessageBox(msg, _("Warning"), wxICON_WARNING | wxYES_NO) == wxID_YES)
Manager::Get()->GetConfigManager(_T("plugins"))->Write(baseKey, false);
}
}
}
Manager::Get()->GetConfigManager(_T("plugins"))->Write(_T("/try_to_activate"), wxEmptyString, false);
}
So, you can see how a plugin is loaded depend on the configure files.
Ok, I found that even I have "disable some plugins" by setting
But all the dlls will still be loaded. I have find that in the source file:
int PluginManager::ScanForPlugins(const wxString& path)
{
static const wxString PluginsMask = platform::windows ? _T("*.dll") : _T("*.so");
int count = 0;
if(!wxDirExists(path))
return count;
wxDir dir(path);
if (!dir.IsOpened())
return count;
bool batch = true; //Manager::IsBatchBuild(); //**********************I have force it to "true"
wxArrayString bbplugins;
if (batch)
{
ConfigManager *bbcfg = Manager::Get()->GetConfigManager(_T("plugins"));
bbplugins = bbcfg->ReadArrayString(_T("/batch_build_plugins"));
if (!bbplugins.GetCount())
{
// defaults
if(platform::windows)
bbplugins.Add(_T("compiler.dll"));
else
bbplugins.Add(_T("libcompiler.so"));
}
}
wxString filename;
wxString failed;
bool ok = dir.GetFirst(&filename, PluginsMask, wxDIR_FILES);
while (ok)
{
if (batch)
{
// for batch builds, we will load only those plugins that the
// user has set (default only compiler.dll)
bool matched = false;
for (size_t i = 0; i < bbplugins.GetCount(); ++i)
{
if (bbplugins[i] == filename)
{
matched = true;
break;
}
}
if (!matched)
{
ok = dir.GetNext(&filename);
continue;
}
}
// load manifest
m_pCurrentlyLoadingManifestDoc = 0;
if (ReadManifestFile(filename))
{
if (LoadPlugin(path + _T('/') + filename))
++count;
else
failed << _T('\n') << filename;
}
if (m_pCurrentlyLoadingManifestDoc)
{
delete m_pCurrentlyLoadingManifestDoc;
m_pCurrentlyLoadingManifestDoc = 0;
}
ok = dir.GetNext(&filename);
}
Manager::Get()->GetLogManager()->Log(F(_("Loaded %d plugins"), count));
if (!failed.IsEmpty())
{
InfoWindow::Display(_("Warning"),
_("One or more plugins were not loaded.\n"
"This usually happens when a plugin is built for\n"
"a different version of the Code::Blocks SDK.\n"
"Check the application log for more info.\n\n"
"List of failed plugins:\n") + failed,
15000, 3000);
}
return count;
}
I have force the "batch" value to "true", then in the debugCC.conf file, I add some options like:
<plugins>
<TRY_TO_ACTIVATE>
<str>
<![CDATA[]]>
</str>
</TRY_TO_ACTIVATE>
<BATCH_BUILD_PLUGINS>
<astr>
<s>
<![CDATA[codecompletion.dll]]>
</s>
<s>
<![CDATA[compiler.dll]]>
</s>
</astr>
</BATCH_BUILD_PLUGINS>
.....
Now, only these two plugins will be loaded. which make gdb loading much faster for debugging CC.
Note: This is method is only used to fast debug CC on windows. If you like to debug some single plugins, you can try the same way.
by using this way, GDB.exe is only eat about 95M(only load codecompletion and compiler plugin dll) memory compared with 250M(all the plugin dll were loaded). Cool!! :D