]> Git Repo - binutils.git/blame - gdb/testsuite/gdb.arch/i386-prologue.c
* gdb.arch/i386-prologue.exp: Add testcase for PR breakpoints/2080.
[binutils.git] / gdb / testsuite / gdb.arch / i386-prologue.c
CommitLineData
daab1251
CV
1/* Unwinder test program.
2
31d8bdd2 3 Copyright (C) 2003, 2004, 2006 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 ();
31d8bdd2 37 stack_align ();
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"
117 SYMBOL (stack_align) ":\n"
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");
This page took 0.650225 seconds and 4 git commands to generate.