This article is part of a ‘mini series’ about hidden gems, tips and tricks around Eclipse.
The topic of this one is how to accelerate the start of the debugger.
I’m probably a ‘classic’ developer, using the ‘edit – compile – debug’ cycle. The thing is that by default in Eclipse, when I press ‘debug’ it does a ‘compile’ again. That’s fine for the developer who just wants to do a ‘edit – debug’, but again this is not me.
In my case that extra ‘compile’ even if nothing needs to be compiled can take multiple seconds especially on the larger projects I’m working on. The reason is that the ‘build’ kicks off the make process and this goes through all the make files and checks for changes which needs time.
But it is not only that 216ms shown above: the hole process can take several seconds. So saving these seconds multiple times a day really can make a difference.
Luckily there is a setting to avoid this: It is under Window > Preferences > Run/Debug > Launching, disable the ‘Build (if required) before launching‘:
Of course: make sure you have done a ‘compile’ before the ‘debug’, otherwise you won’t debug what you have as sources in the project. With great power comes great responsibility ;-).
Happy Debugging 🙂
Links
- Eclipse Gems, Tips & Tricks: Importing Projects
- Eclipse Gems, Tips & Tricks: Close and Open Projects
- Eclipse Gems, Tips & Tricks: Text Block Selection
- Eclipse Gems, Tips & Tricks: Project Filter
- Eclipse Gems, Tips & Tricks: Black Theme
- Eclipse Gems, Tips & Tricks: Faster Debugger Start
- Eclipse Gems, Tips & Tricks: RT(F)M
- Eclipse Gems, Tips &Tricks: Show in System Explorer
- Eclipse Gems, Tips & Tricks: Open Declaration
- Eclipse Gems, Tips & Tricks: Code Completion
- Eclipse Gems, Tips & Tricks: Highlight Usage and Definition
- Eclipse Gems, Tips & Tricks: Block Comments
- Eclipse Gems, Tips & Tricks: Working Sets
Erich,
Can I say that it’s *really* dangerous to depend on Eclipse (or any automated system) to determine when a build is necessary? I’ve experienced cases where Eclipse (including CW and MCUXpresso variants as well as C/C++ and Java versions) have missed including changes because they weren’t saved by the developer as well as cases that that were changed, saved and then reverted back to the original or a previous version that are passed to the compiler.
I make it a rule to make sure all source tabs are saved (not marked with “*”), do a “Clean” and then “Build Project” followed by “Debug” – yes it takes a few extra seconds but that saves minutes trying to figure out why the code isn’t working as I expect it to.
myke
LikeLike
There’s been a few times when MCUXpresso has lost track of my project files, ending up with the code and variable definitions being out of sync – horrifying bugs till I eventually work it out!
Happily it’s very rare, but maybe that’s worse since it takes longer to think of the possibility.
LikeLike
I consider not saving files as ‘user error’. Eclipse has the default setting to ‘save files before build’ which I never would disable except for very good reasons.
And I trust the build system: A clean is what I do whenever I import files/projects. Because the build system depends on file dates, the only problems I have seeing is with wrong file time stamps e.g. if they were copied/moved from a different system (e.g. from Linux to a Windows host and the time zone was not right). Having said that: no (build) system is perfect, nor is the human. What helps for sure is to have a understanding how the system works.
LikeLike
Pingback: Eclipse Gems, Tips & Tricks: Black Theme | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Project Filter | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Text Block Selection | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: RT(F)M | MCU on Eclipse
Pingback: Eclipse Gems, Tips &Tricks: Show in System Explorer | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Open Declaration | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Code Completion | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Highlight Usage and Definition | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Block Comments | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Working Sets | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Close and Open Projects | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Importing Projects | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Code Folding | MCU on Eclipse
Better is to setup duplicate debug configurations without the “auto build” option, so you can choose between them on the fly.
Currently I’m using Simplicity Studio v4. I’m not sure what versions of Eclipse/CDT it is based on.
Right click project –> Debug As –> Debug Configurations…
Right click the debug config, choose “Duplicate”. Rename it in the “Name” field on the right (I usually add a ” – RERUN” suffix), and select “Disable auto build” as shown above.
When multiple debug configurations exist for the same executable, it will prompt you to choose which to use upon starting the debugger. I use the one with auto build by default, and the one without when I know I just built it and want to reload the same thing. (It’s especially useful for troubleshooting halt issues that break the debugger reset.)
LikeLike
Hi Brendan,
this is indeed another good approach, thanks for sharing!
LikeLike