Commit | Line | Data |
---|---|---|
efb66345 MS |
1 | /* Test gdb's "return" command. */ |
2 | ||
3 | int void_test = 0; | |
4 | int main_test = 0; | |
5 | ||
6 | char char_returnval = '1'; | |
7 | short short_returnval = 1; | |
8 | int int_returnval = 1; | |
9 | long long_returnval = 1; | |
10 | long long long_long_returnval = 1; | |
11 | float float_returnval = 1; | |
12 | double double_returnval = 1; | |
13 | ||
14 | union { | |
15 | char char_testval; | |
16 | short short_testval; | |
17 | int int_testval; | |
18 | long long_testval; | |
19 | long long long_long_testval; | |
20 | float float_testval; | |
21 | double double_testval; | |
22 | char ffff[80]; | |
23 | } testval; | |
24 | ||
25 | void void_func () | |
26 | { | |
27 | void_test = 1; | |
28 | } | |
29 | ||
30 | char char_func () | |
31 | { | |
32 | return char_returnval; | |
33 | } | |
34 | ||
35 | short short_func () | |
36 | { | |
37 | return short_returnval; | |
38 | } | |
39 | ||
40 | int int_func () | |
41 | { | |
42 | return int_returnval; | |
43 | } | |
44 | ||
45 | long long_func () | |
46 | { | |
47 | return long_returnval; | |
48 | } | |
49 | ||
50 | long long long_long_func () | |
51 | { | |
52 | return long_long_returnval; | |
53 | } | |
54 | ||
55 | float float_func () | |
56 | { | |
57 | return float_returnval; | |
58 | } | |
59 | ||
60 | double double_func () | |
61 | { | |
62 | return double_returnval; | |
63 | } | |
64 | ||
65 | int main (int argc, char **argv) | |
66 | { | |
67 | char char_resultval; | |
68 | short short_resultval; | |
69 | int int_resultval; | |
70 | long long_resultval; | |
71 | long long long_long_resultval; | |
72 | float float_resultval; | |
73 | double double_resultval; | |
74 | int i; | |
75 | ||
76 | /* A "test load" that will insure that the function really returns | |
77 | a ${type} (as opposed to just a truncated or part of a ${type}). */ | |
78 | for (i = 0; i < sizeof (testval.ffff); i++) | |
79 | testval.ffff[i] = 0xff; | |
80 | ||
81 | void_func (); /* call to void_func */ | |
82 | char_resultval = char_func (); /* void_checkpoint */ | |
83 | short_resultval = short_func (); /* char_checkpoint */ | |
84 | int_resultval = int_func (); /* short_checkpoint */ | |
85 | long_resultval = long_func (); /* int_checkpoint */ | |
86 | long_long_resultval = long_long_func (); /* long_checkpoint */ | |
87 | float_resultval = float_func (); /* long_long_checkpoint */ | |
88 | double_resultval = double_func (); /* float_checkpoint */ | |
89 | main_test = 1; /* double_checkpoint */ | |
90 | return 0; | |
91 | } |