Local Variables shown as out of scope while debugging
Posted: Fri Jan 07, 2011 10:24 am
Hi everybody, I'm not sure if this is a CCS problem or an MPLab problem but I'm trying first here as I've had much better responses here.
I am using the PIC18F2620
CCS version 4.114
MPLab 8.60
MPLab ICD 2
I am debugging using the mplab ICD2 and mplab IDE. If my variables are declared as static I can see them without a problem. However if my variables are local they are listed as "Out of Scope" even if I am in the function that declares and uses them. I've been using this setup for some time with other projects and I Can't understand why this is suddenly happening on this new project.
Some digging discovered that others have had this problem with MPLab and C18 or C30 and fixed it by turning off optimization. I've tried that and it didn't help. I haven't been able to find CCS specific help. Any ideas? Thanks in advance!
bkamen
Joined: 07 Jan 2004 Posts: 1611 Location: Central Illinois, USA
Posted: Fri Jan 07, 2011 3:24 pm
I don't know -- it's ALWAYS been that way for me.
Using the WATCH window, you only get to see variables all the time that are global. (makes sense.)
For variables that are local to a function, that *are* out of scope when not in the function that uses them.
but they are still available to be ADDED to the WATCH window.. (that makes sense too).
I don't think I've ever seen different behavior than that.
Maybe I'm nuts. :D
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D
skoberlink
Joined: 27 May 2010 Posts: 52
Posted: Fri Jan 07, 2011 4:32 pm
Yeah I'm in the right scope when I'm having this problem. Also I can still view the locals in other projects (from their respective Watch windows of course). I did notice that some of them were visible from the main function that's in a different compilation unit.
Well for now I'll make do. Hope someone posts a solution tho...
hgida
Joined: 07 Jan 2011 Posts: 1
Posted: Fri Jan 07, 2011 4:34 pm
I'm having a similar problem...
I have the following declared in a header file:
Code:
typedef struct context {
unsigned int 8 state;
unsigned int 8 transition;
} context_t;
I do the following in main:
Code:
void main (void){
context_t x;
init (&x);
}
When I try to look at the individual variables of the struct in MPLAB (v.8.60) and CCS (v4.055) I just get zeros or "out of scope" for the variable x.
Is there anyway I can see the variables and their values?
In the Editor Properties and under the "Tooltips" tab there are some Mouseover options which I have selected:
Enable Variable Mouseover Values
Show Address in Mouseover
Mouseover Active on Debug
However, none of them seem to be working. Any ideas why?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum