buserror / simavr

simavr is a lean, mean and hackable AVR simulator for linux & OSX
GNU General Public License v3.0
1.56k stars 365 forks source link

Atmega8 CORE: *** Invalid read address PC=02b8 SP=0433 O=8081 Address 0493 out of ram (045f) #85

Closed ryba84 closed 9 years ago

ryba84 commented 10 years ago

When I'm debuging program on simavr with gdb it hangs with this error message: CORE: *\ Invalid read address PC=02b8 SP=0433 O=8081 Address 0493 out of ram (045f) avr_sadly_crashed The address on each run may be different. Program crashes when rand function is called, but not each time. I'm using simavr with options: -m atmega8 -g.

bsekisser commented 10 years ago

The information you gave will likely not be enough to truly know what is going on, a core crash indicates a problem in the code you are running. If this is code that runs fine on a real processor then that could indicate a problem with the emulation (but possibly not always)... If you believe the problem to be on the emulation side then to go further answering the questions below will help get things started and it should also be noted that having a test case is great if you can provide one and or our being able to test the code (source will likely help too) in question with information on how to reproduce the problem.

Are you using the latest simavr build? The core has gone through some updates/changes recently.

Have you used tailored compile flags for the simavr project? if so what were they.

Does the code in question run on a real avr?

Does the code in question run on a normal run without gdb?

Does the crash always occur in or after the same function just different address?

While not necessarily as important, knowing some other things that might help...

What OS are you running?

Compiler and version version?

dougszumski commented 9 years ago

I agree with bsekisser. At a guess it's probably a firmware bug. For example, you can generate an error like that by reading beyond the end of an array etc..

ryba84 commented 9 years ago

Sorry for my late response. You're right. This was bug in program. I've made union with struct to iterate thru struct members, and i messed up with types. Thanks.