]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/i386-prologue.c
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-prologue.c
CommitLineData
daab1251
CV
1/* Unwinder test program.
2
6aba47ca 3 Copyright (C) 2003, 2004, 2006, 2007 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
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
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.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22#ifdef SYMBOL_PREFIX
23#define SYMBOL(str) SYMBOL_PREFIX #str
24#else
25#define SYMBOL(str) #str
26#endif
27
55ed7501 28void gdb1253 (void);
62104619 29void gdb1718 (void);
c945b932 30void gdb1338 (void);
a8958849 31void jump_at_beginning (void);
55ed7501
MK
32
33int
34main (void)
35{
b6702b23 36 standard ();
5eefc2b7
JB
37 stack_align_ecx ();
38 stack_align_edx ();
39 stack_align_eax ();
55ed7501 40 gdb1253 ();
62104619 41 gdb1718 ();
c945b932 42 gdb1338 ();
a8958849 43 jump_at_beginning ();
55ed7501
MK
44 return 0;
45}
46
b6702b23
MK
47/* A normal prologue. */
48
49asm(".text\n"
50 " .align 8\n"
51 SYMBOL (standard) ":\n"
52 " pushl %ebp\n"
53 " movl %esp, %ebp\n"
54 " pushl %edi\n"
55 " int $0x03\n"
56 " leave\n"
57 " ret\n");
58
c945b932 59/* Relevant part of the prologue from symtab/1253. */
55ed7501
MK
60
61asm(".text\n"
62 " .align 8\n"
daab1251 63 SYMBOL (gdb1253) ":\n"
55ed7501
MK
64 " pushl %ebp\n"
65 " xorl %ecx, %ecx\n"
66 " movl %esp, %ebp\n"
67 " pushl %edi\n"
68 " int $0x03\n"
69 " leave\n"
70 " ret\n");
c945b932 71
62104619
MK
72/* Relevant part of the prologue from backtrace/1718. */
73
74asm(".text\n"
75 " .align 8\n"
76 SYMBOL (gdb1718) ":\n"
77 " pushl %ebp\n"
78 " movl $0x11111111, %eax\n"
79 " movl %esp, %ebp\n"
80 " pushl %esi\n"
81 " movl $0x22222222, %esi\n"
82 " pushl %ebx\n"
83 " int $0x03\n"
84 " leave\n"
85 " ret\n");
86
c945b932
MK
87/* Relevant part of the prologue from backtrace/1338. */
88
89asm(".text\n"
90 " .align 8\n"
daab1251 91 SYMBOL (gdb1338) ":\n"
c945b932
MK
92 " pushl %edi\n"
93 " pushl %esi\n"
94 " pushl %ebx\n"
95 " int $0x03\n"
96 " popl %ebx\n"
97 " popl %esi\n"
98 " popl %edi\n"
99 " ret\n");
a8958849
MK
100
101/* The purpose of this function is to verify that, during prologue
102 skip, GDB does not follow a jump at the beginnning of the "real"
103 code. */
104
105asm(".text\n"
106 " .align 8\n"
daab1251 107 SYMBOL (jump_at_beginning) ":\n"
a8958849
MK
108 " pushl %ebp\n"
109 " movl %esp,%ebp\n"
110 " jmp .gdbjump\n"
111 " nop\n"
112 ".gdbjump:\n"
113 " movl %ebp,%esp\n"
114 " popl %ebp\n"
115 " ret\n");
31d8bdd2
MK
116
117asm(".text\n"
118 " .align 8\n"
5eefc2b7 119 SYMBOL (stack_align_ecx) ":\n"
31d8bdd2
MK
120 " leal 4(%esp), %ecx\n"
121 " andl $-16, %esp\n"
122 " pushl -4(%ecx)\n"
123 " pushl %ebp\n"
124 " movl %esp, %ebp\n"
125 " pushl %edi\n"
126 " pushl %ecx\n"
127 " int $0x03\n"
128 " popl %ecx\n"
129 " popl %edi\n"
130 " popl %ebp\n"
131 " leal -4(%ecx), %esp\n"
132 " ret\n");
5eefc2b7
JB
133
134asm(".text\n"
135 " .align 8\n"
136 SYMBOL (stack_align_edx) ":\n"
137 " leal 4(%esp), %edx\n"
138 " andl $-16, %esp\n"
139 " pushl -4(%edx)\n"
140 " pushl %ebp\n"
141 " movl %esp, %ebp\n"
142 " pushl %edi\n"
143 " pushl %ecx\n"
144 " int $0x03\n"
145 " popl %ecx\n"
146 " popl %edi\n"
147 " popl %ebp\n"
148 " leal -4(%edx), %esp\n"
149 " ret\n");
150
151asm(".text\n"
152 " .align 8\n"
153 SYMBOL (stack_align_eax) ":\n"
154 " leal 4(%esp), %eax\n"
155 " andl $-16, %esp\n"
156 " pushl -4(%eax)\n"
157 " pushl %ebp\n"
158 " movl %esp, %ebp\n"
159 " pushl %edi\n"
160 " pushl %ecx\n"
161 " int $0x03\n"
162 " popl %ecx\n"
163 " popl %edi\n"
164 " popl %ebp\n"
165 " leal -4(%eax), %esp\n"
166 " ret\n");
167