I am using this with P&E multilink, and MC9S08JM32 controller.
How can I watch a variable in real time?
eg. I have a function xyz() in source file abc.c, and I want to watch how a variable volatile Bool myVar changes in real time.
I used the debugger Component -> Open -> Data but only the global variables are viewable. I do not know how to view the local variables within each function.
Solved! Go to Solution.
Hello,
the debugger can read from the memory while the target is running (using BDM background cycles). This works only for memory (with an address), but not for CPU core registers.
So with global memory you are ok.
But local variables are on the stack, and the address of it is not always the same. Even more: the scope of the function might not be 'alive', so the debugger cannot read that variable, so this won't work for local variables.
What you can do is: make the variable a 'static local':
void foo(void) {
static int myStaticLocal;
...
}
and that way it will be in global memory, so you can watch it (but: it won't bee reentrant).
If you think your variable is always at a certain address on the stack (what usually is not the case), then you simply could watch that address on the stack too (e.g. in the memory view).
Hope this helps,
Erich
Hello,
the debugger can read from the memory while the target is running (using BDM background cycles). This works only for memory (with an address), but not for CPU core registers.
So with global memory you are ok.
But local variables are on the stack, and the address of it is not always the same. Even more: the scope of the function might not be 'alive', so the debugger cannot read that variable, so this won't work for local variables.
What you can do is: make the variable a 'static local':
void foo(void) {
static int myStaticLocal;
...
}
and that way it will be in global memory, so you can watch it (but: it won't bee reentrant).
If you think your variable is always at a certain address on the stack (what usually is not the case), then you simply could watch that address on the stack too (e.g. in the memory view).
Hope this helps,
Erich