https://bugs.kde.org/show_bug.cgi?id=376595

--- Comment #18 from Aetf <7437...@gmail.com> ---
Created attachment 104154
  --> https://bugs.kde.org/attachment.cgi?id=104154&action=edit
GDB outputs when watchpoint goes out of scope

Yes, kdevelop uses plain variable name when adding watch points for member
variables. This however should work because gdb will delete all invalid
watchpoints when the execution left valid scope.

I've created a minimal test program to trigger this problem:

struct testStruct {
    int a; int b;
    void bar() {
        a = a + 1;
    }
};

int main() {
    testStruct ts;
    ts.a = ts.b = 0;
    ts.bar();
    ts.b++;
    return 0;
}

After compile and load it in gdb, this is what I got:

1. break at line 4
2. watch a
3. continue and gdb stopped after a = a + 1 because of watchpoint hit
4. continue again and gdb stopped at some random point after leaving
testStruct::bar() with the following output

Error evaluating expression for watchpoint 2
current stack frame does not contain a variable named `this'
Watchpoint 2 deleted.

5. continue and the program exits normally.

If I use watch this.a instead, the outcome is almost the same with the only
difference being the warning from gdb:

Watchpoint 3 deleted because the program has left the block in
which its expression is valid.

I've attached the full output from gdb. The point here is that gdb should be
able to delete invalid watchpoint gracefully regardless it was set as
"this.<varname>" or "<varname>". And it shouldn't produce malformed output in
its machine interface which kdevelop uses.

That being said, I'm using a newer version of gdb than yours, so probably the
behavior changed. Ian, are you getting the same behavior using my test program?

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to