aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/watchpoint.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-06-28 16:06:02 +0000
committerJason Molenda <jmolenda@apple.com>1999-06-28 16:06:02 +0000
commit085dd6e638eca9d348100c8f0e8cae04e20d58a1 (patch)
tree1e740197cdfedb994222a003ea531ec2febaf173 /gdb/testsuite/gdb.base/watchpoint.c
parent303f629d619e7bf37b97c2af6f72aba488669044 (diff)
downloadgdb-085dd6e638eca9d348100c8f0e8cae04e20d58a1.zip
gdb-085dd6e638eca9d348100c8f0e8cae04e20d58a1.tar.gz
gdb-085dd6e638eca9d348100c8f0e8cae04e20d58a1.tar.bz2
import gdb-1999-06-28 snapshot
Diffstat (limited to 'gdb/testsuite/gdb.base/watchpoint.c')
-rw-r--r--gdb/testsuite/gdb.base/watchpoint.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c
index bd54f3e..14ccecd 100644
--- a/gdb/testsuite/gdb.base/watchpoint.c
+++ b/gdb/testsuite/gdb.base/watchpoint.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <unistd.h>
/*
* Since using watchpoints can be very slow, we have to take some pains to
* ensure that we don't run too long with them enabled or we run the risk
@@ -28,6 +29,7 @@ int ival1 = -1;
int ival2 = -1;
int ival3 = -1;
int ival4 = -1;
+int ival5 = -1;
char buf[10];
struct foo
{
@@ -53,9 +55,32 @@ void marker5 ()
{
}
+void marker6 ()
+{
+}
+
+#ifdef PROTOTYPES
+void recurser (int x)
+#else
+void recurser (x) int x;
+#endif
+{
+ int local_x;
+
+ if (x > 0)
+ recurser (x-1);
+ local_x = x;
+}
+
void
func2 ()
{
+ int local_a;
+ static int static_b;
+
+ ival5++;
+ local_a = ival5;
+ static_b = local_a;
}
int
@@ -120,5 +145,30 @@ int main ()
are not evaluating the watchpoint expression correctly. */
struct1.val = 5;
marker5 ();
+
+ /* We're going to watch locals of func2, to see that out-of-scope
+ watchpoints are detected and properly deleted.
+ */
+ marker6 ();
+
+ /* This invocation is used for watches of a single
+ local variable. */
+ func2 ();
+
+ /* This invocation is used for watches of an expression
+ involving a local variable. */
+ func2 ();
+
+ /* This invocation is used for watches of a static
+ (non-stack-based) local variable. */
+ func2 ();
+
+ /* This invocation is used for watches of a local variable
+ when recursion happens.
+ */
+ marker6 ();
+ recurser (2);
+
+ marker6 ();
return 0;
}