Index: gdb/testsuite/gdb.base/watchpoint.c |
diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c |
index 9ef92539288795943659fe13f7ee59731920b021..e887f99aebbc244110a0329ef09391b9ae935b62 100644 |
--- a/gdb/testsuite/gdb.base/watchpoint.c |
+++ b/gdb/testsuite/gdb.base/watchpoint.c |
@@ -42,6 +42,18 @@ int doread = 0; |
char *global_ptr; |
char **global_ptr_ptr; |
+struct foo2 |
+{ |
+ int val[2]; |
+}; |
+struct foo2 foo2; |
+ |
+struct foo4 |
+{ |
+ int val[4]; |
+}; |
+struct foo4 foo4; |
+ |
void marker1 () |
{ |
} |
@@ -68,7 +80,7 @@ void recurser (int x) |
void recurser (x) int x; |
#endif |
{ |
- int local_x; |
+ int local_x = 0; |
if (x > 0) |
recurser (x-1); |
@@ -78,9 +90,10 @@ void recurser (x) int x; |
void |
func2 () |
{ |
- int local_a; |
+ int local_a = 0; |
static int static_b; |
+ /* func2 breakpoint here */ |
ival5++; |
local_a = ival5; |
static_b = local_a; |
@@ -137,12 +150,24 @@ func5 () |
val = 27; |
} |
+void |
+func6 (void) |
+{ |
+ /* func6 breakpoint here */ |
+ foo2.val[1] = 0; |
+ foo2.val[1] = 11; |
+} |
+ |
+void |
+func7 (void) |
+{ |
+ /* func7 breakpoint here */ |
+ foo4.val[3] = 0; |
+ foo4.val[3] = 33; |
+} |
+ |
int main () |
{ |
-#ifdef usestubs |
- set_debug_traps(); |
- breakpoint(); |
-#endif |
struct1.val = 1; |
struct2.val = 2; |
ptr1 = &struct1; |
@@ -208,6 +233,12 @@ int main () |
marker6 (); |
recurser (2); |
+ /* This invocation is used for watches of a local variable with explicitly |
+ specified scope when recursion happens. |
+ */ |
+ marker6 (); |
+ recurser (2); |
+ |
marker6 (); |
func3 (); |
@@ -216,5 +247,9 @@ int main () |
func5 (); |
+ func6 (); |
+ |
+ func7 (); |
+ |
return 0; |
} |