Community
Participate
Working Groups
Adding watchpoints for local variables was available in CDT 2.1.1 via the "Add Watchpoint (C/C++)" but seems to be missing in CDT 3.0. Searching the newsgroup suggests that the only way of setting a watchpoint on a local varaible is to use the GDB command line. This seems to be a repeat of bug 84165, but I have not seen any discussion on why to drop the support on the development mailing list.
Speaking more generally we should allow to set a watchpoint on any expression that evaluates to address. But the reason why the "Add Watchpoint" feature is left out is because we currently can't catch the moment when the expression comes back to scope. So if you set a watchpoint on a local variable and it goes out of scope, the watchpoint seats in the Breakpoint view and will never be set on any session again.
I think the watchpoint will be tied to the address that the expression is resolved to. So even if the expression is out of scope, the watchpoint is still alive but will just give user false alarm. But that seems fine as user can tell it's false alarm from the watchpoint even message and can go ahead remove/disable that watchpoint. That's what we do in CodeWarrior debugger. What do you think ?