Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have to set up remote debugging for a multi threaded application running on a

ID: 658910 • Letter: I

Question

I have to set up remote debugging for a multi threaded application running on a embedded device. C++ is the language.

I've gotten so far and got the remote debugging working for a simple application, but when applying the same procedures on the multi threaded giant just don't work (the application starts behaving unpredictably when built with debug). There was no stopping of the execution (no breakpoints), just a continuous standard run, just with debug symbols.

What would cause a failure in debug mode in this environment? (once again, no breakpoints in debug mode, just continuous running)

Explanation / Answer

Not really enough information to go on, but anyway...

First and foremost, properly written and bug-free code does not fail when build in debug mode. The likelihood is that you have uncovered bugs you didn't know where there.

Generically, across all kinds of applications, the commonest reason for a debug build failing is the difference in memory layout (triggering an otherwise silent bug). Different initialisation values (debug code often fills unused space with strange bit patterns) or different spacing or placement will all do it. A less common reason is the different level of optimisation.

Specifically, for multi-threaded applications, the commonest reason is timing. Debug code runs slower and either exposes or covers up race conditions.

Bottom line: you've got bugs to fix. Be thankful that debug mode has exposed them for you.