How to create a watchpoint for a local variable in Eclipse CDT?

int global = 0;

int main() {
    int local = 0;
    local = 1;
    global = 1;
}

I can create a watchpoint for global with:

and then the program breaks whenever global is modified.

However, if I try this with local an error popup appears:

This operation is unavailable on the current selection. Please select or place the cursor on a field.

GDB allows that with the watch command, using hardware watchpoints.

I know that this can give weird results if the stack frame exits, but that is fine.

Eclipse 4.7.0, CDT 9.3, Ubuntu 16.04.

Related: Setting Memory Breakpoints in Eclipse

Upvotes: 5

Views: 2468

Answers (1)

Related Questions