This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

watchpoints


I'm trying to understand the test 'watch triggered on a.x' from
gdb.c++/annota2.exp, which fails reliably for me and for tests in
Michael Chastain's test suite.

The test involves annotating a watchpoint.  It sets a watchpoint, then
does a 'next' through an instruction which should modify the object in
question, and then looks for output indicating that the watchpoint has
triggered.  The lines in question are:

  a.x = 0;
  a.x = 1;
  a.y = 2;

  printf ("a.x is %d\n", a.x);

The watch is on a.x; we set it on the 'a.x = 1' line.

The problem is, the watchpoint doesn't trigger; if I run it manually,
I find that I have to do 'next' twice for the output to trigger, so it
doesn't trigger until we reach the 'printf' line.  This has nothing to
do with annotation; and, in fact, if I watch an integer variable in a
C program, I get the same behavior.

So what's going on here?  I don't use watchpoints myself often enough
to know what to expect: it seems to me reasonable that the watchpoint
should trigger after one 'next', and that it's a bug that it doesn't
do so.  (And I've looked at the assembly code, and I don't think the
compiler is outputting misleading debugging info.)  But, before filing
a PR, I wanted to check with other people to make sure I'm not
misunderstanding the situation.

Does this test pass for other people?  It seems to fail quite reliably
on i686-pc-linux-gnu, with a whole host of compiler versions, since at
least GDB 5.2.1; does it pass on other platforms?

David Carlton
carlton@math.stanford.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]