Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / frame-inlined-in-outer-frame.S
CommitLineData
88b9d363 1/* Copyright 2020-2022 Free Software Foundation, Inc.
22b9b4b0
SL
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 3 of the License, or
6 (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
15
16#include <asm/unistd.h>
17
18/* Define these for each architecture:
19
20 1) RETURN_ADDRESS_REGNO: The register number representing the return
21 address in the DWARF CFI. It can be easily be looked up using
22 `readelf --debug-dump=frames-interp` on an existing binary of that
23 architecture, where it says `ra=X`.
24
25 2) exit_0: a sequence of instruction to execute the exit syscall with
26 argument 0. */
27
28#if defined(__x86_64__)
29
30# define RETURN_ADDRESS_REGNO 16
31
32.macro exit_0
33 mov $__NR_exit, %rax
34 mov $0, %rdi
35 syscall
36.endm
37
38#elif defined(__i386__)
39
40# define RETURN_ADDRESS_REGNO 8
41
42.macro exit_0
43 mov $__NR_exit, %eax
44 mov $0, %ebx
45 int $0x80
46.endm
47
48#elif defined(__aarch64__)
49
50# define RETURN_ADDRESS_REGNO 30
51
52.macro exit_0
53 mov x0, #0
54 mov x8, #__NR_exit
55 svc #0
56.endm
57
58#elif defined(__arm__)
59
60# define RETURN_ADDRESS_REGNO 14
61
62.macro exit_0
63 ldr r7, =__NR_exit
64 ldr r0, =0
65 swi 0x0
66.endm
67
68#else
69# error "Unsupported architecture"
70#endif
71
72/* The following assembly program mimics this pseudo C program, where
73 everything has been inlined:
74
75 1 void bar(void) {
76 2 nop;
77 3 }
78 4
79 5 void foo(void) {
80 6 nop;
81 7 bar();
82 8 nop;
83 9 }
84 10
85 11 void _start(void) {
86 12 nop;
87 13 foo();
88 14 nop;
89 15 exit(0);
90 16 }
91*/
92
93.global _start
94_start:
95.cfi_startproc
96
97/* State that the return address for this frame is undefined. */
98.cfi_undefined RETURN_ADDRESS_REGNO
99
100.global __cu_low_pc
101__cu_low_pc:
102
103.global __start_low_pc
104__start_low_pc:
105 /* Line 12 */
106 nop
107
108.global __foo_low_pc
109__foo_low_pc:
110 /* Line 6 */
111 nop
112
113.global __bar_low_pc
114__bar_low_pc:
115 /* Line 2 */
116 nop
117
118.global __bar_high_pc
119__bar_high_pc:
120 /* Line 8 */
121 nop
122
123.global __foo_high_pc
124__foo_high_pc:
125 /* Line 14 */
126 nop
127
128 /* Line 15 */
129 exit_0
130
131.cfi_endproc
132
133.global __start_high_pc
134__start_high_pc:
135
136.global __cu_high_pc
137__cu_high_pc:
This page took 0.153014 seconds and 4 git commands to generate.