Debugger jumping randomly..

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi experts

This may be nothing, but I wanted peace of mind, so here's my question:

- When I debug my ATTiny44 code using the newest version of AVR Studio 4 / AVR Simulator, I experience some strange behavior of the debugger.
When exiting the initialization routine, the yellow pointer is supposed to jump from the init to the following while(1)-statement, but before it does that, it jumps to five other lines first. It doesn't seem to execute the lines it jumps to, but I'm still worried if this is a problem I should deal with.

Is this a problem? If so, what could I be doing wrong?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is expected behavior when debugging optimized code.

Recommendd reading: https://www.avrfreaks.net/index.p...

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you, Johan :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

that is all about compiler optimisation, for same kind of statements like using two for loop in your code. why to generate two seprate block of instruction, generate one block of instruction & jump there. this is very simple example.

Try debugging in disassembly ---- you will find it is as per expectation.

or try your hand on VOLATILE, it will force compiler to generate code. May be sometime exception you will find.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Try debugging in disassembly ---- you will find it is as per expectation.

or try your hand on VOLATILE, it will force compiler to generate code. May be sometime exception you will find.


That would appear to be pretty much a two paragraph summary of the article I wrote and Johan linked to above ;-)