Author Topic: Virtual Targets and Debugger (and defines)  (Read 6121 times)

Offline White-Tiger

  • Multiple posting newcomer
  • *
  • Posts: 83
Virtual Targets and Debugger (and defines)
« on: October 03, 2014, 05:02:39 pm »
Hello there.. I've ran into a problem relating to virtual targets and debugging (actually also for defines known to code completion, but let's focus on debugger fist)

Basically I've got one project with 32bit and 64bit targets, each of them consists of a DLL target and the main program's target. For this reason I've setup virtual targets to compile the DLL and App together. A few days ago I've used different project files for 32bit and 64bit compiles, but now I've put them together and this is were the trouble starts..

If I select the virtual target for 32bit it builds and debugs fine, but the 64bit virtual target somehow tries to still use the 32bit debugger... which won't work of course. So it doesn't seem to be aware that the targets within the virtual target all use the same different compiler than the projects default... Basically Its always using the default compiler and not the one actually used.
Debugging a real target of course used the correct compiler/debugger... just the virtual target won't.

This is also true for defines... my code always looks like I'm compiling for 32bit (eg. __x86_64__ isn't defined) even though I've selected the 64bit virtual target... selecting any real 64bit target will work... So here is only the default compiler used as well and not the actual targets one..

Is there any kind of settings I'm missing or is this simply a bug?
Windoze 8.1 x86_64 16GiB RAM, wxWidgets-2.8x (latest,trunk), MinGW-builds (latest, posix-threads)
Code::Blocks (x86 , latest , selection length patch , build option fixes/additions , toggle comments)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Virtual Targets and Debugger (and defines)
« Reply #1 on: October 03, 2014, 05:37:02 pm »
Is there any kind of settings I'm missing or is this simply a bug?
I would think it a bug or configuration issue; whether it is a known bug, I have no idea.


Code::Blocks version and OS info will likely be needed.

If you do a virtual target of just the 64 bit targets, what compiler settings does it use?

Note: I have no plans to try to fix this problem because I am NOT a CB Dev and I do NOT use the CB debugger very much.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline White-Tiger

  • Multiple posting newcomer
  • *
  • Posts: 83
Re: Virtual Targets and Debugger (and defines)
« Reply #2 on: October 03, 2014, 05:56:56 pm »
[...]
If you do a virtual target of just the 64 bit targets, what compiler settings does it use?
[...]
What do you mean?
All I can say about it is, that it compiles fine^^ Just the debugger isn't correctly selected as well as defines within the editor (as used for “Interpret #if, #else, #endif to grey out inactive preprocessor-code”)
And like I said.. it uses the project's default compiler for virtual targets... which is currently set to 32bit.. if I were to set it to the 64bit compiler, my 32bit virtual targets wouldn't work...
Windoze 8.1 x86_64 16GiB RAM, wxWidgets-2.8x (latest,trunk), MinGW-builds (latest, posix-threads)
Code::Blocks (x86 , latest , selection length patch , build option fixes/additions , toggle comments)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Virtual Targets and Debugger (and defines)
« Reply #3 on: October 03, 2014, 08:30:45 pm »
What is the settng for Debug -> Active debuggers?
If it is "Target's default" can you try to change it to something a bit more specific like gdb-64bit config for your 64bit virtual target?
I hope you have separate debugger configs for 32 and 64bits!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline White-Tiger

  • Multiple posting newcomer
  • *
  • Posts: 83
Re: Virtual Targets and Debugger (and defines)
« Reply #4 on: October 04, 2014, 10:54:20 am »
if I choose the correct one there, it will of course work^^

This is also what I did after creating this thread because I don't want to change the projects default compiler... So I rather set the active debugger manually until this issue is resolved.

But yes, it was set to "Target's default" before.

P.S. it's cdb in my case :P Also msvc 2010 as compiler + copy for 64 bit... though it shouldn't matter. I basically like multilib toolchains and used that with GCC a lot... but since those are to dumb to debug 32 and 64bit (and msvc isn't really multilib anyway), even my current MinGW config uses distinct compilers + debuggers.
Though my GCC setup doesn't really work as well :P 64bit cc1plus crashes because it's not started correctly by code completion and my 32bit MinGW is in global path^^ Well that's another story :P
« Last Edit: October 04, 2014, 11:08:33 am by White-Tiger »
Windoze 8.1 x86_64 16GiB RAM, wxWidgets-2.8x (latest,trunk), MinGW-builds (latest, posix-threads)
Code::Blocks (x86 , latest , selection length patch , build option fixes/additions , toggle comments)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Virtual Targets and Debugger (and defines)
« Reply #5 on: October 04, 2014, 11:25:59 am »
Can you post minimal project that can be used for testing?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline White-Tiger

  • Multiple posting newcomer
  • *
  • Posts: 83
Re: Virtual Targets and Debugger (and defines)
« Reply #6 on: October 04, 2014, 12:07:55 pm »
Real targets:
debug = GCC
debug 2 = MSVC
Virtual targets:
vdebug = debug
vdebug 2 = debug 2

If you debug "vdebug" and select "debug" as target, it will debug using GDB and works fine.

If you debug "vdebug 2" and also select "debug 2" as target, it will still debug using GDB because GCC is the projects default compiler. Even though "debug 2" uses MSVC. If you what so ever debug "debug 2" directy, it'll use CDB correctly.

You can of course use 64bit GCC instead of MSVC for the "debug 2" target when "debug" uses 32bit GCC, doesn't matter which one.... I've simply chose GCC and MSVC because it makes the difference very clear. Also because I know you've guys got GCC... and I didn't know another compiler you've guys got.. Basically it doesn't matter... all that matters is that the 2nd target uses a different compiler which at least won't work with the same debugger as the first target / projects default compiler.

Also I didn't include a test case for different defines used by different compilers.. this would require more knowledge about your setup.. such as do you have 32bit and 64bit compilers, do you have MSVC, etc. But the defines used for a virtual target are also from the projects default compiler and not the compilers used by the actual targets. (and those defines are used for code completion / code highlighter. They always use the targets defines/compiler but not for virtual targets)
« Last Edit: October 04, 2014, 12:19:13 pm by White-Tiger »
Windoze 8.1 x86_64 16GiB RAM, wxWidgets-2.8x (latest,trunk), MinGW-builds (latest, posix-threads)
Code::Blocks (x86 , latest , selection length patch , build option fixes/additions , toggle comments)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Virtual Targets and Debugger (and defines)
« Reply #7 on: October 06, 2014, 02:54:39 am »
Confirmed, the fix will require quite a lot of changes so it might take a while to fix.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]