Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

configure file to debug codecompletion plugin

(1/4) > >>

ollydbg:
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

And the developers of C::B give me some ideas. Finally I totally agree with mariocup's way. So, here is the configure file you can change.


--- Code: --- <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>

--- End code ---

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

ollydbg:
By the way, the related source code when loading a plug-in is in:

sdk\pluginmanager.cpp


--- Code: ---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);
}
--- End code ---

So, you can see how a plugin is loaded depend on the configure files.

ollydbg:
Ok, I found that even I have "disable some plugins" by setting

--- Code: ---<PLUGIN_NAME bool="0" />

--- End code ---

But all the dlls will still be loaded. I have find that in the source file:


--- Code: ---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;
}

--- End code ---

I have force the "batch" value to "true", then in the debugCC.conf file, I add some options like:


--- Code: --- <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>
.....

--- End code ---

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

ollydbg:
In the previous post in this thread, I have find some way to disable gdb.exe to load many debug symbol files. But even I do that, I found it is still need 90 seconds to start the new c::b in gdb.

So, I guess the problem is: I have a big file "codeblock.dll" in my E:\code\cb\cc_branch\src\devel, it is 40+M. So, gdb sucks on loading this file.  :wink:  Sometimes, I only need to "debug the Codecompletion plugin".

Here is another way I think we can do :

1, copy the  E:\code\cb\cc_branch\src\devel\share\CodeBlocks\plugins\codecompletion.dll to
                  E:\code\cb\cc_branch\src\output\share\CodeBlocks\plugins
   so that the debug information can be reserved.

2, select the "building target" to "code-completion"

3, and setting the host program to codeblocks.exe in output folder, see the screen shot below:



4, press the start debugging button, now, c::b is loading much faster(about 10 seconds), the side effect is we have only debug information in "codecompletion.dll".  :D

oBFusCATed:
On linux you can split the debugging info from the executable and the shared libraries.
I don't know if this is possible on windows, but you could try it.
Also your version of gdb is extremely slow, compared to the linux one, and 2x-5x time slower that the previous gdb.exe I've used on windows.

Navigation

[0] Message Index

[#] Next page

Go to full version