CW 10 Debugger Target Not Following Compiler Build Target

Showing results for 
Search instead for 
Did you mean: 

CW 10 Debugger Target Not Following Compiler Build Target

Contributor II

Posting this in case anyone else has this problem.


I have several build targets (DEBUG, RELEASE, etc). When launching the debugger, it would always build and load the DEBUG target. Changing the target name (e.g. to DEVELOPMENT) didn't help, the debugger would still launch the same configuration. After many hours of reading documentation, searching the forums... I deleted the DEBUG build target. This caused things to work as expected: the build target selected in the C/C++ perspective is the target that gets launched in the debugger. I then added the DEBUG configuration back and things are still working as expected.


It would be nice to know the root cause, but at least it is working now.

Labels (1)
0 Kudos
5 Replies

Senior Contributor V

Dear Rathead,


I find the Eclipse set-up is rather confusing.  The following is a brief summary of my understanding:

  • Each project can have multiple Build Configurations for example Debug & Release
  • Each project can have multiple Launch configurations (used as Debug Configuations or Run Configurations). Each launch configuration references a Build configuration.
  • In version 10.1 there are also Remote Target Configurations. These can be referenced by Launch configurations and can be shared between more than one.  They determine the target (device) and connection (e.g. USBDM, OSBDM etc)

When you create a project using the CWV10 wizard it will set up (at a minimum) one Build configurations (same name as Device) and a Launch configation.  If you select multiple connections you will end up with more.


When you click on the debug or run icons you are using a particular Launch configuration.  This is what decides which build and connection is to be used.  Changing the active Build Configuration in the C/C++ perspective does not affect the build used for the launch.

By default the most recent launch associated with the currently selected project will be used (I think).  In your case this was the lauch configuration referencing the debug build.


You can create multiple launch configurations to reference different build configurations.  By default, when created, they will reference the currently active build configuration.  This may be changed by modifying the Application referenced on the Main page of the Launch Configuation.  The Search Project button is the easiest way of doing this.


I believe the above is consistent with the description of what you found was happening.  When you deleted the Debug build the lauch configuration referencing it became invalid and so the next valid one was used.  Recreating debug configuration would not now affect the lauch being used (I think!).


Was this an imported project (from earlier version  of Codewarrior) ?  Judging by the fact that you had Debug & Release targets this would seem likely.  The default setup doesn't appear to create them.


I hope the above is useful.



0 Kudos

Contributor II

pgo -


Thank you for your detailed reply. Like you, I find the Eclipse set up confusing, to say the least. I've seen references to launch configurations but cannot seem to see any way to relate a build configuration to a launch configuration. Launch configurations look to me to be more of a debugger set-up than a stand-alone something that gets referenced by debug and run. I'll admit I probably am confused.


Again, as I related above and without understanding the root cause, after deleting restoring the debug build target I can now successfully debug **any** target. It wasn't a matter of toggling between RELEASE and DEBUG -- I have several other build targets as well. I just select what I want in the C/C++ perspective and voila! - I can launch the debugger with that same build.


What doesn't work however, is the little triangles to the left of my source files that indicate which files are part of the build. Sometimes they are accurate, sometimes not. Another mystery...


Thanks again for your reply. You may very well be correct about what's going on, but I seem to be unable to get there  following your procedure.



0 Kudos

Contributor I

Thanks RatHead, I was about to pull my hair out trying to understand what I was doing wrong. 


Pgo (or anybody familiar with the new Eclipse-based IDE), can you explain exactly how I am supposed to fix this issue by "modifying the Application referenced on the Main page of the Launch Configuation."  I mean exactly which menu items to follow and which field to edit. 


If I open the "Run"->"Run Configurations" or "Run"->"Debug Configurations" menu items, I get a screen that allows me to select the launch configuration to edit, and on the "Main" tab of that screen, there is a field called "Application" that points to the binary I wish to debug, but even when I had that pointing to a binary built only by one configuration, the debugger would always change the build configuration to the one it was originally used with. 


Is having multiple build targets each with their own debug settings not something that we were expected to do with Eclipse?  It certainly doesn't seem like this was tested in a very thorough manner before product release.  I do like the new functionality in the debug views, and the general configurability of the Eclipse platform, but I would have expected something a bit more polished and intuitive (I know, "intuitive" and embedded development aren't supposed to go together, but it's 2011 already!).

0 Kudos

Specialist III



    In fact the Launch Configuration is linked with a project and an executable file.


    In order to be make it easier to associate a Launch configuration with a build configuration I would recommend

    to associate a different executable to your build configuration.

       - Open the Project Properties dialog (Select Project > Properties)

       - Go to C/C++ Build > Settings page.

       - Change to the Build Artifact tab

       - Change the Artifact name.


  Now to associate the new launch configuration with the executable generated by your  new build configuration:

      - Build the application

      - Select Run > Debug Configurations.

      - Select the launch configuration on the left hand side of the dialog.

      - Go to Main tab.

      - Make sure Project points to the correct project

      - Click on Search Project button next to the Application edit box.

      - You should see the name of the executable you have specified earlier. Select it and click OK.

     - Click on Apply to apply the changes.

     - Click on debug to start debugging of the specified executable.


Two additional notes;

     1- Make sure you have read/write access to the location of the .launch file.

     2- In order to start the launch configuration for a specific build configuration, use the  Debug Configurations dialog or

         click on the arrow next to the green bug tool bar icon to select a previously used launch config.

         If you just click on the green bug icon, you will start the last launch config you have used.




0 Kudos

Contributor I

Thanks CrasyCat, that seems to work, although the process seems far from straightforward. 

0 Kudos