Update years in copyright notice for the GDB files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-prologue.c
CommitLineData
daab1251
CV
1/* Unwinder test program.
2
28e7fd62 3 Copyright (C) 2003-2013 Free Software Foundation, Inc.
daab1251
CV
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
daab1251 10 (at your option) any later version.
a9762ec7 11
daab1251
CV
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
a9762ec7 16
daab1251 17 You should have received a copy of the GNU General Public License
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
daab1251
CV
19
20#ifdef SYMBOL_PREFIX
21#define SYMBOL(str) SYMBOL_PREFIX #str
22#else
23#define SYMBOL(str) #str
24#endif
25
55ed7501 26void gdb1253 (void);
62104619 27void gdb1718 (void);
c945b932 28void gdb1338 (void);
a8958849 29void jump_at_beginning (void);
55ed7501
MK
30
31int
32main (void)
33{
b6702b23 34 standard ();
5eefc2b7
JB
35 stack_align_ecx ();
36 stack_align_edx ();
37 stack_align_eax ();
55ed7501 38 gdb1253 ();
62104619 39 gdb1718 ();
c945b932 40 gdb1338 ();
a8958849 41 jump_at_beginning ();
55ed7501
MK
42 return 0;
43}
44
b6702b23
MK
45/* A normal prologue. */
46
47asm(".text\n"
48 " .align 8\n"
49 SYMBOL (standard) ":\n"
50 " pushl %ebp\n"
51 " movl %esp, %ebp\n"
52 " pushl %edi\n"
53 " int $0x03\n"
54 " leave\n"
55 " ret\n");
56
c945b932 57/* Relevant part of the prologue from symtab/1253. */
55ed7501
MK
58
59asm(".text\n"
60 " .align 8\n"
daab1251 61 SYMBOL (gdb1253) ":\n"
55ed7501
MK
62 " pushl %ebp\n"
63 " xorl %ecx, %ecx\n"
64 " movl %esp, %ebp\n"
65 " pushl %edi\n"
66 " int $0x03\n"
67 " leave\n"
68 " ret\n");
c945b932 69
62104619
MK
70/* Relevant part of the prologue from backtrace/1718. */
71
72asm(".text\n"
73 " .align 8\n"
74 SYMBOL (gdb1718) ":\n"
75 " pushl %ebp\n"
76 " movl $0x11111111, %eax\n"
77 " movl %esp, %ebp\n"
78 " pushl %esi\n"
79 " movl $0x22222222, %esi\n"
80 " pushl %ebx\n"
81 " int $0x03\n"
82 " leave\n"
83 " ret\n");
84
c945b932
MK
85/* Relevant part of the prologue from backtrace/1338. */
86
87asm(".text\n"
88 " .align 8\n"
daab1251 89 SYMBOL (gdb1338) ":\n"
c945b932
MK
90 " pushl %edi\n"
91 " pushl %esi\n"
92 " pushl %ebx\n"
93 " int $0x03\n"
94 " popl %ebx\n"
95 " popl %esi\n"
96 " popl %edi\n"
97 " ret\n");
a8958849
MK
98
99/* The purpose of this function is to verify that, during prologue
100 skip, GDB does not follow a jump at the beginnning of the "real"
101 code. */
102
103asm(".text\n"
104 " .align 8\n"
daab1251 105 SYMBOL (jump_at_beginning) ":\n"
a8958849
MK
106 " pushl %ebp\n"
107 " movl %esp,%ebp\n"
108 " jmp .gdbjump\n"
109 " nop\n"
110 ".gdbjump:\n"
111 " movl %ebp,%esp\n"
112 " popl %ebp\n"
113 " ret\n");
31d8bdd2
MK
114
115asm(".text\n"
116 " .align 8\n"
5eefc2b7 117 SYMBOL (stack_align_ecx) ":\n"
31d8bdd2
MK
118 " leal 4(%esp), %ecx\n"
119 " andl $-16, %esp\n"
120 " pushl -4(%ecx)\n"
121 " pushl %ebp\n"
122 " movl %esp, %ebp\n"
123 " pushl %edi\n"
124 " pushl %ecx\n"
125 " int $0x03\n"
126 " popl %ecx\n"
127 " popl %edi\n"
128 " popl %ebp\n"
129 " leal -4(%ecx), %esp\n"
130 " ret\n");
5eefc2b7
JB
131
132asm(".text\n"
133 " .align 8\n"
134 SYMBOL (stack_align_edx) ":\n"
135 " leal 4(%esp), %edx\n"
136 " andl $-16, %esp\n"
137 " pushl -4(%edx)\n"
138 " pushl %ebp\n"
139 " movl %esp, %ebp\n"
140 " pushl %edi\n"
141 " pushl %ecx\n"
142 " int $0x03\n"
143 " popl %ecx\n"
144 " popl %edi\n"
145 " popl %ebp\n"
146 " leal -4(%edx), %esp\n"
147 " ret\n");
148
149asm(".text\n"
150 " .align 8\n"
151 SYMBOL (stack_align_eax) ":\n"
152 " leal 4(%esp), %eax\n"
153 " andl $-16, %esp\n"
154 " pushl -4(%eax)\n"
155 " pushl %ebp\n"
156 " movl %esp, %ebp\n"
157 " pushl %edi\n"
158 " pushl %ecx\n"
159 " int $0x03\n"
160 " popl %ecx\n"
161 " popl %edi\n"
162 " popl %ebp\n"
163 " leal -4(%eax), %esp\n"
164 " ret\n");
165
This page took 1.014378 seconds and 4 git commands to generate.