Home/Support/Support Forum/Add watch expression bug in cooperative multitasking
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Add watch expression bug in cooperative multitasking

0 votes
I'm used RCM5600W Development kit, with DC 10.56.

I tried add watch expression in cooperative multitasking with press CTRL+W on buffer variable when debugging then I get message "buffer is out of scope/not declared." Its bug?

Part of code:
Code:
scofunc int handshake(unsigned char deviceId, unsigned char data) { unsigned char buffer[8]; sprintf (buffer, "%c%c%c%c%c%02X%c", STX, deviceId, SELECTING, _ZERO, _ZERO, data, ETX); }
asked May 27, 2015 in Rabbit Software by edha Community Contributor (71 points)

Please log in or register to answer this question.

1 Answer

+1 vote
 
Best answer
It's not really a bug.

Because buffer is a local stack based variable it is only in scope if you hit a breakpoint in that function and you cannot see it with a watch at any other time.

You could define it outside the function to make it non transient and set a watch on it then.

Regards,
Peter
answered May 28, 2015 by petermcs Veteran of the Digi Community (1,130 points)
selected May 28, 2015 by edha
Thank you sir. One question again, if the variables declared inside the cooperative multitask function(stack), automatically be static?
I've never used the cofunction/costate mechanism for multitasking with Dynamic C and have used uCOS || instead. Briefly looking at the manual, it seems the variables in a cofunction are similar but not identical to static variables with a storage class of instance. The main difference as far as I can see comes into play if the cofunction is an indexed one. I think the visibility on these for watch purposes is still only really within the given cofunction.

Regards,
Peter
...