| OLD | NEW |
| 1 #include <stdio.h> | 1 #include <stdio.h> |
| 2 #include <unistd.h> | 2 #include <unistd.h> |
| 3 /* | 3 /* |
| 4 * Since using watchpoints can be very slow, we have to take some pains to | 4 * Since using watchpoints can be very slow, we have to take some pains to |
| 5 * ensure that we don't run too long with them enabled or we run the risk | 5 * ensure that we don't run too long with them enabled or we run the risk |
| 6 * of having the test timeout. To help avoid this, we insert some marker | 6 * of having the test timeout. To help avoid this, we insert some marker |
| 7 * functions in the execution stream so we can set breakpoints at known | 7 * functions in the execution stream so we can set breakpoints at known |
| 8 * locations, without worrying about invalidating line numbers by changing | 8 * locations, without worrying about invalidating line numbers by changing |
| 9 * this file. We use null bodied functions are markers since gdb does | 9 * this file. We use null bodied functions are markers since gdb does |
| 10 * not support breakpoints at labeled text points at this time. | 10 * not support breakpoints at labeled text points at this time. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 { | 35 { |
| 36 int val; | 36 int val; |
| 37 }; | 37 }; |
| 38 struct foo struct1, struct2, *ptr1, *ptr2; | 38 struct foo struct1, struct2, *ptr1, *ptr2; |
| 39 | 39 |
| 40 int doread = 0; | 40 int doread = 0; |
| 41 | 41 |
| 42 char *global_ptr; | 42 char *global_ptr; |
| 43 char **global_ptr_ptr; | 43 char **global_ptr_ptr; |
| 44 | 44 |
| 45 struct foo2 |
| 46 { |
| 47 int val[2]; |
| 48 }; |
| 49 struct foo2 foo2; |
| 50 |
| 51 struct foo4 |
| 52 { |
| 53 int val[4]; |
| 54 }; |
| 55 struct foo4 foo4; |
| 56 |
| 45 void marker1 () | 57 void marker1 () |
| 46 { | 58 { |
| 47 } | 59 } |
| 48 | 60 |
| 49 void marker2 () | 61 void marker2 () |
| 50 { | 62 { |
| 51 } | 63 } |
| 52 | 64 |
| 53 void marker4 () | 65 void marker4 () |
| 54 { | 66 { |
| 55 } | 67 } |
| 56 | 68 |
| 57 void marker5 () | 69 void marker5 () |
| 58 { | 70 { |
| 59 } | 71 } |
| 60 | 72 |
| 61 void marker6 () | 73 void marker6 () |
| 62 { | 74 { |
| 63 } | 75 } |
| 64 | 76 |
| 65 #ifdef PROTOTYPES | 77 #ifdef PROTOTYPES |
| 66 void recurser (int x) | 78 void recurser (int x) |
| 67 #else | 79 #else |
| 68 void recurser (x) int x; | 80 void recurser (x) int x; |
| 69 #endif | 81 #endif |
| 70 { | 82 { |
| 71 int local_x; | 83 int local_x = 0; |
| 72 | 84 |
| 73 if (x > 0) | 85 if (x > 0) |
| 74 recurser (x-1); | 86 recurser (x-1); |
| 75 local_x = x; | 87 local_x = x; |
| 76 } | 88 } |
| 77 | 89 |
| 78 void | 90 void |
| 79 func2 () | 91 func2 () |
| 80 { | 92 { |
| 81 int local_a; | 93 int local_a = 0; |
| 82 static int static_b; | 94 static int static_b; |
| 83 | 95 |
| 96 /* func2 breakpoint here */ |
| 84 ival5++; | 97 ival5++; |
| 85 local_a = ival5; | 98 local_a = ival5; |
| 86 static_b = local_a; | 99 static_b = local_a; |
| 87 } | 100 } |
| 88 | 101 |
| 89 void | 102 void |
| 90 func3 () | 103 func3 () |
| 91 { | 104 { |
| 92 int x; | 105 int x; |
| 93 int y; | 106 int y; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 func5 () | 143 func5 () |
| 131 { | 144 { |
| 132 int val = 0, val2 = 23; | 145 int val = 0, val2 = 23; |
| 133 int *x = &val; | 146 int *x = &val; |
| 134 | 147 |
| 135 /* func5 breakpoint here */ | 148 /* func5 breakpoint here */ |
| 136 x = &val2; | 149 x = &val2; |
| 137 val = 27; | 150 val = 27; |
| 138 } | 151 } |
| 139 | 152 |
| 153 void |
| 154 func6 (void) |
| 155 { |
| 156 /* func6 breakpoint here */ |
| 157 foo2.val[1] = 0; |
| 158 foo2.val[1] = 11; |
| 159 } |
| 160 |
| 161 void |
| 162 func7 (void) |
| 163 { |
| 164 /* func7 breakpoint here */ |
| 165 foo4.val[3] = 0; |
| 166 foo4.val[3] = 33; |
| 167 } |
| 168 |
| 140 int main () | 169 int main () |
| 141 { | 170 { |
| 142 #ifdef usestubs | |
| 143 set_debug_traps(); | |
| 144 breakpoint(); | |
| 145 #endif | |
| 146 struct1.val = 1; | 171 struct1.val = 1; |
| 147 struct2.val = 2; | 172 struct2.val = 2; |
| 148 ptr1 = &struct1; | 173 ptr1 = &struct1; |
| 149 ptr2 = &struct2; | 174 ptr2 = &struct2; |
| 150 marker1 (); | 175 marker1 (); |
| 151 func1 (); | 176 func1 (); |
| 152 for (count = 0; count < 4; count++) { | 177 for (count = 0; count < 4; count++) { |
| 153 ival1 = count; | 178 ival1 = count; |
| 154 ival3 = count; ival4 = count; | 179 ival3 = count; ival4 = count; |
| 155 } | 180 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 /* This invocation is used for watches of a static | 226 /* This invocation is used for watches of a static |
| 202 (non-stack-based) local variable. */ | 227 (non-stack-based) local variable. */ |
| 203 func2 (); | 228 func2 (); |
| 204 | 229 |
| 205 /* This invocation is used for watches of a local variable | 230 /* This invocation is used for watches of a local variable |
| 206 when recursion happens. | 231 when recursion happens. |
| 207 */ | 232 */ |
| 208 marker6 (); | 233 marker6 (); |
| 209 recurser (2); | 234 recurser (2); |
| 210 | 235 |
| 236 /* This invocation is used for watches of a local variable with explicitly |
| 237 specified scope when recursion happens. |
| 238 */ |
| 239 marker6 (); |
| 240 recurser (2); |
| 241 |
| 211 marker6 (); | 242 marker6 (); |
| 212 | 243 |
| 213 func3 (); | 244 func3 (); |
| 214 | 245 |
| 215 func4 (); | 246 func4 (); |
| 216 | 247 |
| 217 func5 (); | 248 func5 (); |
| 218 | 249 |
| 250 func6 (); |
| 251 |
| 252 func7 (); |
| 253 |
| 219 return 0; | 254 return 0; |
| 220 } | 255 } |
| OLD | NEW |