2004-07-31 Michael Chastain <mec.gnu@mindspring.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-prologue.c
CommitLineData
daab1251
CV
1/* Unwinder test program.
2
3 Copyright 2003, 2004 Free Software Foundation, Inc.
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{
36 gdb1253 ();
62104619 37 gdb1718 ();
c945b932 38 gdb1338 ();
a8958849 39 jump_at_beginning ();
55ed7501
MK
40 return 0;
41}
42
c945b932 43/* Relevant part of the prologue from symtab/1253. */
55ed7501
MK
44
45asm(".text\n"
46 " .align 8\n"
daab1251 47 SYMBOL (gdb1253) ":\n"
55ed7501
MK
48 " pushl %ebp\n"
49 " xorl %ecx, %ecx\n"
50 " movl %esp, %ebp\n"
51 " pushl %edi\n"
52 " int $0x03\n"
53 " leave\n"
54 " ret\n");
c945b932 55
62104619
MK
56/* Relevant part of the prologue from backtrace/1718. */
57
58asm(".text\n"
59 " .align 8\n"
60 SYMBOL (gdb1718) ":\n"
61 " pushl %ebp\n"
62 " movl $0x11111111, %eax\n"
63 " movl %esp, %ebp\n"
64 " pushl %esi\n"
65 " movl $0x22222222, %esi\n"
66 " pushl %ebx\n"
67 " int $0x03\n"
68 " leave\n"
69 " ret\n");
70
c945b932
MK
71/* Relevant part of the prologue from backtrace/1338. */
72
73asm(".text\n"
74 " .align 8\n"
daab1251 75 SYMBOL (gdb1338) ":\n"
c945b932
MK
76 " pushl %edi\n"
77 " pushl %esi\n"
78 " pushl %ebx\n"
79 " int $0x03\n"
80 " popl %ebx\n"
81 " popl %esi\n"
82 " popl %edi\n"
83 " ret\n");
a8958849
MK
84
85/* The purpose of this function is to verify that, during prologue
86 skip, GDB does not follow a jump at the beginnning of the "real"
87 code. */
88
89asm(".text\n"
90 " .align 8\n"
daab1251 91 SYMBOL (jump_at_beginning) ":\n"
a8958849
MK
92 " pushl %ebp\n"
93 " movl %esp,%ebp\n"
94 " jmp .gdbjump\n"
95 " nop\n"
96 ".gdbjump:\n"
97 " movl %ebp,%esp\n"
98 " popl %ebp\n"
99 " ret\n");
This page took 0.154424 seconds and 4 git commands to generate.