1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2013-2019 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 /* Note: 'volatile' is used to make sure the compiler doesn't fold /
19 optimize out the arithmetic that uses the variables. */
24 volatile int r
= a
* b
;
40 volatile double d1
= 1.0;
41 volatile double d2
= 2.0;
43 /* A macro that expands to a single source line that compiles to a
44 number of instructions, with no branches. */
45 #define LINE_WITH_MULTIPLE_INSTRUCTIONS \
48 a = b + c + d * e - a; \
51 LINE_WITH_MULTIPLE_INSTRUCTIONS
; /* location 1 */
53 /* A line of source code that compiles to a function call (jump or
54 branch), surrounded by instructions before and after. IOW, this
55 will generate approximately the following pseudo-instructions:
67 e
= 10 + func1 (a
+ b
, c
* d
); /* location 2 */
69 e
= 10 + func1 (a
+ b
, c
* d
);
71 /* Generate a single source line that includes a short loop. */
72 #define LINE_WITH_LOOP \
75 for (a = 0, e = 0; a < 15; a++) \
83 /* Generate a single source line that includes a time-consuming
84 loop. GDB breaks the loop early by clearing variable 'c'. */
85 #define LINE_WITH_TIME_CONSUMING_LOOP \
88 for (c = 1, a = 0; a < 65535 && c; a++) \
89 for (b = 0; b < 65535 && c; b++) \
96 LINE_WITH_TIME_CONSUMING_LOOP
;
98 /* Some multi-instruction lines for software watchpoint tests. */
99 LINE_WITH_MULTIPLE_INSTRUCTIONS
;
100 LINE_WITH_MULTIPLE_INSTRUCTIONS
; /* soft-watch */
101 LINE_WITH_MULTIPLE_INSTRUCTIONS
;