aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/mips_pro.c
blob: cef975d13e651acf6ffc2c811b13c242b3016712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* Tests regarding examination of prologues.  */

int
inner (z)
     int z;
{
  return 2 * z;
}

/* The native compiler seems to lack asm().  */

#if defined (__GNUC__) && defined (__mips__)
/* This is the verbatim output corresponding to the function middle.
   Label names have been changed to avoid conflicts.  It is here as
   asm() so we don't have to worry that (a) the compiler might change
   how it does things, and (b) we'd have to insure it gets compiled
   with gcc -O2.  */

asm ("\n\
	.text \n\
	.align 2 \n\
	.globl	middle \n\
	.loc	1 22 \n\
\n\
	.loc	1 21 \n\
	.ent	middle \n\
middle: \n\
	.frame	$sp,24,$31     	# vars= 0, regs= 1/0, args = 16, extra= 0 \n\
	.mask	0x80000000,-8 \n\
	.fmask	0x00000000,0 \n\
	subu	$sp,$sp,24 \n\
\n\
	.loc	1 23 \n\
	.set	noreorder \n\
	.set	nomacro \n\
	beq	$4,$0,middle_lab0 \n\
	sw	$31,16($sp) \n\
	.set	macro \n\
	.set	reorder \n\
\n\
\n\
	.loc	1 26 \n\
	.set	noreorder \n\
	.set	nomacro \n\
	jal	inner \n\
	li	$4,0x00000006		# 6 \n\
	.set	macro \n\
	.set	reorder \n\
\n\
	j	middle_lab1 \n\
middle_lab0: \n\
\n\
	.loc	1 24 \n\
	.set	noreorder \n\
	.set	nomacro \n\
	jal	inner \n\
	li	$4,0x00000005		# 5 \n\
	.set	macro \n\
	.set	reorder \n\
\n\
middle_lab1: \n\
	.set	noreorder \n\
	lw	$31,16($sp) \n\
	nop \n\
	j	$31 \n\
	addu	$sp,$sp,24 \n\
	.set	reorder \n\
	.end	middle \n\
");
#if 0
/* Not necessary, and loses if gcc is not using stabs.  */
asm (".stabs \"middle:F1\",36,0,13,middle");
asm (".stabs \"x:p1\",160,0,13,0");
#endif
#else
int
middle (x)
     int x;
{
  if (x == 0)
    return inner (5);
  else
    return inner (6);
}
#endif

int
top (y)
     int y;
{
  return middle (y + 1);
}

int
main (argc, argv)
{
  return top (-1) + top (1);
}