[RFA] Add test for use of "<block>::<variable>" syntax for locals in watch.

Paul Hilfinger Hilfinger@adacore.com
Mon Jan 9 07:26:00 GMT 2012


This patch augments watchpoint.c to check the BLOCK::VARIABLE syntax
in watched expressions when it refers to local variables (and also to
fix a small bug I found in the existing version of the file).
However, as things stand, the test is not particularly stringent,
since the relevant part is restricted to the hppa, sparc SunOS, and
m32r platforms.  I modified the restriction temporarily to check that
the test now works on i686 Linux, but did not make that a part of the
patch, since I think that someone who knows more about the reason for
the restriction ought to decide whether it is time to remove it.

First, fix a technical problem with the function recurser.  The test sets a
watch on local_x at a point where its value is technically undefined.  The
test is written assuming that the value is not initially 2, but nothing in the
C standard guarantees that.

Second, augment the existing test for variables in recursive calls to check an
equivalent expression that explicitly sets the scope of the local variable
being tracked.

Paul N. Hilfinger
(Hilfinger@adacore.com)


2012-01-07  Paul Hilfinger  <brobecker@adacore.com>

* gdb/testsuite/gdb.base/watchpoint.c (recurser): Initialize local_x.
  (main) Repeat recurser call.
* gdb/testsuite/gdb.base/watchpoint.exp: Check that 'watch recurser::local_x' is
  equivalent to 'local_x'.
---
 gdb/testsuite/gdb.base/watchpoint.c   |    8 +++++++-
 gdb/testsuite/gdb.base/watchpoint.exp |   14 ++++++++++++++
 2 files changed, 21 insertions(+), 1 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Add-test-for-use-of-block-variable-syntax-for-locals.patch
Type: text/x-patch
Size: 2598 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20120109/46933dc0/attachment.bin>


More information about the Gdb-patches mailing list