Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

FindTargetsDebugger bypassed on workspace load

(1/2) > >>

Pecan:
When a workspace is loaded and DebuggerManager::OnProjectActivated is called, FindTargetsDebugger is bypassed because of the statement

--- Code: ---void DebuggerManager::FindTargetsDebugger()
{
    if (Manager::Get()->GetProjectManager()->IsLoadingOrClosing())
        return;

--- End code ---

Thus, the correct debugger is not setup for the project, since IsLoadingOrClosing() is *always* true during OnProjectActivated for workspace loading. (At some point, CB code was changed to leave m_IsLoadingProject at true during OnProjectActivated to avoid a CC problem).

Adding

--- Code: ---+    Manager::Get()->RegisterEventSink(cbEVT_PROJECT_OPEN, new Event(this, &DebuggerManager::OnProjectActivated));

--- End code ---
solves the problem, since at that call, IsLoadingOrClosing() is false.


--- Code: ---Index: src/sdk/debuggermanager.cpp
===================================================================
--- src/sdk/debuggermanager.cpp (revision 8647)
+++ src/sdk/debuggermanager.cpp (working copy)
@@ -674,6 +674,7 @@
 {
     typedef cbEventFunctor<DebuggerManager, CodeBlocksEvent> Event;
     Manager::Get()->RegisterEventSink(cbEVT_PROJECT_ACTIVATE, new Event(this, &DebuggerManager::OnProjectActivated));
+    Manager::Get()->RegisterEventSink(cbEVT_PROJECT_OPEN, new Event(this, &DebuggerManager::OnProjectActivated));
     Manager::Get()->RegisterEventSink(cbEVT_BUILDTARGET_SELECTED, new Event(this, &DebuggerManager::OnTargetSelected));
     Manager::Get()->RegisterEventSink(cbEVT_SETTINGS_CHANGED, new Event(this, &DebuggerManager::OnSettingsChanged));
     Manager::Get()->RegisterEventSink(cbEVT_PLUGIN_LOADING_COMPLETE,

--- End code ---

svn build  rev 8647 (2012-12-09 23:28:42)   gcc 4.3.1 Windows/unicode - 32 bit

oBFusCATed:
What are the steps needed to reproduce this?

Pecan:

--- Quote from: oBFusCATed on December 18, 2012, 03:15:03 pm ---What are the steps needed to reproduce this?

--- End quote ---

Use a workspace with at least two projects.
Place a breakpoint at the first statement of FindTargetsDebugger.
(faster if you use asm("int3"); )

Load the workspace. Note that the rest of FindTargetsDebugger never gets executed.

oBFusCATed:

--- Quote from: oBFusCATed on December 18, 2012, 03:15:03 pm ---What are the steps needed to reproduce this?

--- End quote ---
OK, But what is the problem, uses the wrong configuration, when debugging?

Pecan:
Yes, of course. It uses the gdb/cdb debugger when it should have used the gdb/mi debugger.

Navigation

[0] Message Index

[#] Next page

Go to full version