#23353 - Gene Ostrowski - Sat Jul 10, 2004 9:14 am
Has anyone run into an odd bug where your variables are getting tromped on unexpectedly when watching them through the GDB debugger?
In my scenario, I have declared some variables in my .cpp file:
s16 var1;
s16 var2;
Then, somewhere in the code is:
var1=10;
var2=20;
If I set up watches on these two variables, put a breakpoint at the var1=10 line and step through the code, as soon as it writes a value to var1, BOTH values change to garbage. I even tried separating them in memory so they are not contiguous and still see garbage:
[Watch screen may show]
var1 = 54223462
var2 = -213334563
In my case, I've even tried explicitly declaring the variables in both EWRAM and IWRAM, and the problem happens wherever I place the variables-- if I initialize them or not. It does not appear that they are in an illegal memory locations (out of bounds), because on the watch window, if I watch the address of the variable, it shows...
&var1 = 0x02010990
... or something that is well within bounds of the memory area in question.
I thought I might be overrunning memory, since I've been working on the source for this project for some time, when suddenly the issue appeared. However, as a test I commented out a good chunk of variable declarations to ensure that I "freed up" much more than I added with my new code.
Anybody ever run into this kind of error before, and how did you fix it?
I'm pulling my hair out!
_________________
------------------
Gene Ostrowski
In my scenario, I have declared some variables in my .cpp file:
s16 var1;
s16 var2;
Then, somewhere in the code is:
var1=10;
var2=20;
If I set up watches on these two variables, put a breakpoint at the var1=10 line and step through the code, as soon as it writes a value to var1, BOTH values change to garbage. I even tried separating them in memory so they are not contiguous and still see garbage:
[Watch screen may show]
var1 = 54223462
var2 = -213334563
In my case, I've even tried explicitly declaring the variables in both EWRAM and IWRAM, and the problem happens wherever I place the variables-- if I initialize them or not. It does not appear that they are in an illegal memory locations (out of bounds), because on the watch window, if I watch the address of the variable, it shows...
&var1 = 0x02010990
... or something that is well within bounds of the memory area in question.
I thought I might be overrunning memory, since I've been working on the source for this project for some time, when suddenly the issue appeared. However, as a test I commented out a good chunk of variable declarations to ensure that I "freed up" much more than I added with my new code.
Anybody ever run into this kind of error before, and how did you fix it?
I'm pulling my hair out!
_________________
------------------
Gene Ostrowski