Simulator executes different line than indicated

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

I'm running AVR Studio 4.11 (build 401, no service pack 2 installed). Today it started to indicate it was on a differnt line than the line it executes in single-step mode. I'm writing in Imagecraft C and the yellow arrow in the simulator sometimes is on the correct line and sometimes is 1 - 3 lines behind the line that will next be executed. Sometimes the arrow even points to a comment line or a function declaration, which it's not supposed to. I've tried restarting (both AVR Studio and my PC), but to no avail. I've been using AVR Studio for about 3 years and this is the first time I've seen this behavior. Any ideas about what's going on, and how to stop it? Not knowing which line is going to be executed basically renders the simulator useless. Thanks.

Karl

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

Normally when this happens it's because the source code has been modified after the executable is built. Try recompiling and see if that helps.

Tore

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

Thanks for the reply, Tore. AVR Studio detects when I recompile in the middle of a simulation and asks, "Objectfile has changed, reload?" I click, "Yes," and the simulation restarts, with the same behavior. Naturally, it's not doing it at the moment and I have no idea what I did to make it stop, but it would be nice to find out for the future.

Karl

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

EEPROM segment in debug information also could cause that problem!
There is a difference handling structured variables in debug information between ICCAVR V6 and V7 compiler.

Michael

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

Thanks, Michael. Is there a fix?

Karl

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

I think this is a case where the compiler optimises the code, so there isn't a 1:1 relationship between the
original source code and the assembled output.

Randy

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

rstahlhu wrote:
I think this is a case where the compiler optimises the code, so there isn't a 1:1 relationship between the original source code and the assembled output.

That was my first impression. I've seen this happen with optimized code. However, I've never seen the arrow point to a comment line.

Karl, can you build with compiler optimization turned off and try it again?

Don