We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
When I debug my application with DS-5, the debug indicator doesn't point to correct instructions sometimes or jumps back. Some variables show unavailable, or show value later after one or two instructions.
Are you sure that this is a fault in the debugger, or is it actually correctly reporting optimised code...?
I compile my code using angstrom on beagleboard, but use DS-5 debugger.
It is common for an optimizing compiler to perform a lot of code reorganizations that makes it harder to debug.
Many variables may be moved to registers.
Different variables may use the same registers depending on where you are in the code, making the variable going in/out of scope in ways not obvious from the source code.
Independent code lines may be reorganized. In some cases, lines in a loop may be moved outside the loop because they compute a constant value.
Loops without visible side effects may be removed.
Expressions may be splitted, allowing the compiler to keep the result of common subexpresions.
...
If you do want to debug optimized code, you should consider looking at the code in assembler, and be prepared for a lot of pain.
If you don't want to debug specific clock-by-clock behaviour, but instead look for traditional logic errors, you should reduce the optimization level before building the code.
Note that release testing must be performed with the same build settings as you will ship with. It's only when looking for logic goofs in your code that you may play with different optimization settings.
we saw same bug. is bug in optimization. switch off please.
No, I very much suspect that it is not!
It is not a bug in anything at all; it is perfectly normal behaviour for any debugger when working with any correctly optimised code!
The problem is not in the tools, but in the user's understanding (or lack thereof)
How do I turn off code optimization for debugging?
If you are using gcc, then -O0 will turn off optimizations. Here is a full list of gcc optimization options:
gcc.gnu.org/.../Optimize-Options.html
thanks, I see great improvement, but data struct variables are not updated often.