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
28 void gdb1253 (void);
29 void gdb1718 (void);
30 void gdb1338 (void);
31 void jump_at_beginning (void);
32
33 int
main(void)34 main (void)
35 {
36 standard ();
37 gdb1253 ();
38 gdb1718 ();
39 gdb1338 ();
40 jump_at_beginning ();
41 return 0;
42 }
43
44 /* A normal prologue. */
45
46 asm(".text\n"
47 " .align 8\n"
48 SYMBOL (standard) ":\n"
49 " pushl %ebp\n"
50 " movl %esp, %ebp\n"
51 " pushl %edi\n"
52 " int $0x03\n"
53 " leave\n"
54 " ret\n");
55
56 /* Relevant part of the prologue from symtab/1253. */
57
58 asm(".text\n"
59 " .align 8\n"
60 SYMBOL (gdb1253) ":\n"
61 " pushl %ebp\n"
62 " xorl %ecx, %ecx\n"
63 " movl %esp, %ebp\n"
64 " pushl %edi\n"
65 " int $0x03\n"
66 " leave\n"
67 " ret\n");
68
69 /* Relevant part of the prologue from backtrace/1718. */
70
71 asm(".text\n"
72 " .align 8\n"
73 SYMBOL (gdb1718) ":\n"
74 " pushl %ebp\n"
75 " movl $0x11111111, %eax\n"
76 " movl %esp, %ebp\n"
77 " pushl %esi\n"
78 " movl $0x22222222, %esi\n"
79 " pushl %ebx\n"
80 " int $0x03\n"
81 " leave\n"
82 " ret\n");
83
84 /* Relevant part of the prologue from backtrace/1338. */
85
86 asm(".text\n"
87 " .align 8\n"
88 SYMBOL (gdb1338) ":\n"
89 " pushl %edi\n"
90 " pushl %esi\n"
91 " pushl %ebx\n"
92 " int $0x03\n"
93 " popl %ebx\n"
94 " popl %esi\n"
95 " popl %edi\n"
96 " ret\n");
97
98 /* The purpose of this function is to verify that, during prologue
99 skip, GDB does not follow a jump at the beginnning of the "real"
100 code. */
101
102 asm(".text\n"
103 " .align 8\n"
104 SYMBOL (jump_at_beginning) ":\n"
105 " pushl %ebp\n"
106 " movl %esp,%ebp\n"
107 " jmp .gdbjump\n"
108 " nop\n"
109 ".gdbjump:\n"
110 " movl %ebp,%esp\n"
111 " popl %ebp\n"
112 " ret\n");
113