1 /* Copyright (C) 2010-2019 Free Software Foundation, Inc.
3 This file is part of GDB.
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 /* The original program corresponding to pieces.S.
19 This came from https://bugzilla.redhat.com/show_bug.cgi?id=589467
20 Note that it is not ever compiled, pieces.S is used instead.
21 However, it is used to extract breakpoint line numbers. */
23 struct A
{ int i
; int j
; };
24 struct B
{ int i
: 12; int j
: 12; int : 4; };
25 struct C
{ int i
; int j
; int q
; };
27 __attribute__((noinline
)) void
30 asm volatile ("" : : "r" (x
) : "memory");
33 __attribute__((noinline
)) int
36 struct A a
= { 4, k
+ 6 };
37 asm ("" : "+r" (a
.i
));
39 bar (a
.i
); /* { dg-final { gdb-test 20 "a.i" "4" } } */
40 bar (a
.j
); /* { dg-final { gdb-test 20 "a.j" "14" } } */
41 return a
.i
+ a
.j
; /* f1 breakpoint */
44 __attribute__((noinline
)) int
47 int a
[2] = { 4, k
+ 6 };
48 asm ("" : "+r" (a
[0]));
50 bar (a
[0]); /* { dg-final { gdb-test 31 "a\[0\]" "4" } } */
51 bar (a
[1]); /* { dg-final { gdb-test 31 "a\[1\]" "14" } } */
52 return a
[0] + a
[1]; /* f2 breakpoint */
55 __attribute__((noinline
)) int
58 struct B a
= { 4, k
+ 6 };
59 asm ("" : "+r" (a
.i
));
61 bar (a
.i
); /* { dg-final { gdb-test 42 "a.i" "4" } } */
62 bar (a
.j
); /* { dg-final { gdb-test 42 "a.j" "14" } } */
63 return a
.i
+ a
.j
; /* f3 breakpoint */
66 __attribute__((noinline
)) int
70 asm ("" : "+r" (a
[0]));
74 return a
[0] + a
[1]; /* f4 breakpoint */
77 __attribute__((noinline
)) int
80 struct A a
= { k
, k
};
81 asm ("" : "+r" (a
.i
));
85 return a
.i
+ a
.j
; /* f5 breakpoint */
88 __attribute__((noinline
)) int
92 struct C a
= { k
, k
, z
};
93 asm ("" : "+r" (a
.i
));
97 return a
.i
+ a
.j
; /* f6 breakpoint */
104 asm ("" : "=r" (k
) : "0" (7));