Hi,
I'm using the Keil uVision V4.03q.
I wonder if there's any setting to be able to watch all variables during debugging? If I want to watch a function argument in a function it says: 'out of scope' so I have to define a static copy of that variable to be able to watch it
Optimization is set to minimum level.
Thanks
Henk
I wonder if there's any setting to be able to watch all variables during debugging?
You can already watch all existing variables. Which is the root of your problem, of course, since you're trying to watch things that don't exist when you try to see them.
Automatic variables and functions' actual arguments only exist while they're in scope. At all other time, they don't exist. The place where they existed (typically on the stack, or in overlaid memory regions) will be used to hold other data. That means those non-existing variables have no current value the debugger could possibly show you. If it tried, whatever those watches were to display would be utterly meaningless if you're lucky, totally misleading if you're not.
@Hans-Bernhard Broeker,
I think the OP is referring to an annoying situation that used to exist at all MDKs until and including 4.14 at which the program is stopped, and automatic variables that are clearly in scope sometimes fail to register, indicating an "out of scope" message or are displayed with the wrong value (verifiable by inspecting the registers/stack). I have not upgraded my working environment for a while so I don't know whether the issue was resolved (the OP is using an even older MDK).
The 'out of scope' problems are solved with MDK-4.23 using Cortex-M targets. For ARM7/9 targets, there is also a corrected version which will be part of the next MDK release by around mid of March.
If there are still 'out of scope' displays, then this shown by intention since the lifetime of a local variable may be restricted as specified by Elf/DWarf's location expressions - not necessarily 'what you mean is what you get'...