Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Pecan on April 11, 2012, 07:56:50 PM

Title: Trunk executes wrong debugger
Post by: Pecan on April 11, 2012, 07:56:50 PM
In DebuggerManager::FindTargetsDebugger
If attempting to debug a gcc virtual target (say codeblocks All target)
and the default compiler is set to Visual C++, FindTargetsDebugger will set the debugger to CDB because the virtual target address is returned as 0x0.

Something like the following may work.


void DebuggerManager::FindTargetsDebugger()
   . . .
   if (project)
   {
       const wxString &targetName = project->GetActiveBuildTarget();
       if (project->BuildTargetValid(targetName))
           target = project->GetBuildTarget(targetName);
   }
   // The above fails to find actual target for virtual targets  //(pecan 2012/04/11)

   Compiler *compiler = nullptr;
   if (!target)
   {
       if (project)                                                             //(pecan 2012/04/11)
           compiler = CompilerFactory::GetCompiler(project->GetCompilerID());   //(pecan 2012/04/11)
       if (not compiler)                                                        //(pecan 2012/04/11)
       compiler = CompilerFactory::GetDefaultCompiler();
       if (!compiler)
 . . .



Would be better if we could find a way to identify the actual target.
But I couldn't find one.
Title: Re: Trunk executes wrong debugger
Post by: oBFusCATed on April 11, 2012, 08:18:51 PM
Quote from: Pecan on April 11, 2012, 07:56:50 PM
Would be better if we could find a way to identify the actual target.
But I couldn't find one.
Hm, as far as I know C::B ask you to choose the target at the start of the debugging session. What have you chosen in the Target select dialog?


p.s. using not instead of ! hurts my eyes pretty badly :)
Title: Re: Trunk executes wrong debugger
Post by: oBFusCATed on April 12, 2012, 09:34:59 AM
I've committed you patch (with little modifications), but I don't know how can we solve the real problem...