This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Debugger question. Step on variable operation

Hi

Why I can't step on all operation with variable? I can't put label on that lines. Only one stoppable line - last one (while). There is only one function in one file of project.

void main (void)
{
         int i;
        int su;

        i = 0;
        su = 0;

        i++;
        su =i+1;

  while (1) ;
}


Why?

Parents Reply Children
  • HI Christoph!

    Thanks a lot! You are right.

    On 5th level - avalible ONLY lines with "i" variable!
    On 4th level - all avalible.

    Can I debug application on 4th level, but in reliase set 8th level?

    "volatile" works too!

    You are very usefull.

  • Can I debug application on 4th level, but in reliase set 8th level?

    Usually, that's what you do. Or at least you make sure that the code is correct with the optimizations turned off, and then verify that code still behaves the same way with the optimizations turned on. Usually, that is the case ... sometimes it's not.

  • "Usually, that is the case ... sometimes it's not." (my emphasis)

    Hence the NASA maxim, "Debug what you fly; fly what you debugged"

    It is possible to debug optimised code - but it's harder work.

    However, if you don't understand what the optimiser's doing, how can you be sure that it'll still work...?

  • "Debug what you fly; fly what you debugged"
    It's very reasonable for NASA!

    But my application is not so complicated and critical. I just need to make application that works as fast as possible. And I can always decide if my application works right by user output on LCD screen.