2002-12-05 01:48:19 +00:00
|
|
|
/* Check that GDB can correctly update a value, living in a register,
|
|
|
|
in the target. This pretty much relies on the compiler taking heed
|
|
|
|
of requests for values to be stored in registers. */
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
/* NOTE: carlton/2002-12-05: These functions were all static, but for
|
|
|
|
whatever reason that caused GCC 3.1 to optimize away some of the
|
|
|
|
function calls within main even when no optimization flags were
|
|
|
|
passed. */
|
|
|
|
|
2003-07-03 13:55:22 +00:00
|
|
|
typedef signed char charest;
|
|
|
|
|
|
|
|
charest
|
|
|
|
add_charest (register charest u, register charest v)
|
2002-12-05 01:48:19 +00:00
|
|
|
{
|
|
|
|
return u + v;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
short
|
2002-12-05 01:48:19 +00:00
|
|
|
add_short (register short u, register short v)
|
|
|
|
{
|
|
|
|
return u + v;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
int
|
2002-12-05 01:48:19 +00:00
|
|
|
add_int (register int u, register int v)
|
|
|
|
{
|
|
|
|
return u + v;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
long
|
2002-12-05 01:48:19 +00:00
|
|
|
add_long (register long u, register long v)
|
|
|
|
{
|
|
|
|
return u + v;
|
|
|
|
}
|
|
|
|
|
2003-06-14 22:10:47 +00:00
|
|
|
typedef long long longest;
|
|
|
|
|
|
|
|
longest
|
|
|
|
add_longest (register longest u, register longest v)
|
|
|
|
{
|
|
|
|
return u + v;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
float
|
2002-12-05 01:48:19 +00:00
|
|
|
add_float (register float u, register float v)
|
|
|
|
{
|
|
|
|
return u + v;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
double
|
2002-12-05 01:48:19 +00:00
|
|
|
add_double (register double u, register double v)
|
|
|
|
{
|
|
|
|
return u + v;
|
|
|
|
}
|
|
|
|
|
2003-06-14 22:10:47 +00:00
|
|
|
typedef long double doublest;
|
|
|
|
|
|
|
|
doublest
|
|
|
|
add_doublest (register doublest u, register doublest v)
|
|
|
|
{
|
|
|
|
return u + v;
|
|
|
|
}
|
|
|
|
|
2002-12-05 01:48:19 +00:00
|
|
|
/* */
|
|
|
|
|
2003-07-03 13:55:22 +00:00
|
|
|
charest
|
|
|
|
wack_charest (register charest u, register charest v)
|
2002-12-05 01:48:19 +00:00
|
|
|
{
|
2003-07-03 13:55:22 +00:00
|
|
|
register charest l = u, r = v;
|
|
|
|
l = add_charest (l, r);
|
|
|
|
return l + r;
|
2002-12-05 01:48:19 +00:00
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
short
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_short (register short u, register short v)
|
|
|
|
{
|
2003-06-14 22:10:47 +00:00
|
|
|
register short l = u, r = v;
|
|
|
|
l = add_short (l, r);
|
2003-07-03 13:55:22 +00:00
|
|
|
return l + r;
|
2002-12-05 01:48:19 +00:00
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
int
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_int (register int u, register int v)
|
|
|
|
{
|
2003-06-14 22:10:47 +00:00
|
|
|
register int l = u, r = v;
|
|
|
|
l = add_int (l, r);
|
2003-07-03 13:55:22 +00:00
|
|
|
return l + r;
|
2002-12-05 01:48:19 +00:00
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
long
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_long (register long u, register long v)
|
|
|
|
{
|
2003-06-14 22:10:47 +00:00
|
|
|
register long l = u, r = v;
|
|
|
|
l = add_long (l, r);
|
2003-07-03 13:55:22 +00:00
|
|
|
return l + r;
|
2003-06-14 22:10:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
long
|
|
|
|
wack_longest (register longest u, register longest v)
|
|
|
|
{
|
|
|
|
register longest l = u, r = v;
|
|
|
|
l = add_longest (l, r);
|
2003-07-03 13:55:22 +00:00
|
|
|
return l + r;
|
2002-12-05 01:48:19 +00:00
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
float
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_float (register float u, register float v)
|
|
|
|
{
|
2003-06-14 22:10:47 +00:00
|
|
|
register float l = u, r = v;
|
|
|
|
l = add_float (l, r);
|
2003-07-03 13:55:22 +00:00
|
|
|
return l + r;
|
2002-12-05 01:48:19 +00:00
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
double
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_double (register double u, register double v)
|
|
|
|
{
|
2003-06-14 22:10:47 +00:00
|
|
|
register double l = u, r = v;
|
|
|
|
l = add_double (l, r);
|
2003-07-03 13:55:22 +00:00
|
|
|
return l + r;
|
2003-06-14 22:10:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
doublest
|
|
|
|
wack_doublest (register doublest u, register doublest v)
|
|
|
|
{
|
|
|
|
register doublest l = u, r = v;
|
|
|
|
l = add_doublest (l, r);
|
2003-07-03 13:55:22 +00:00
|
|
|
return l + r;
|
2002-12-05 01:48:19 +00:00
|
|
|
}
|
|
|
|
|
2003-06-14 22:10:47 +00:00
|
|
|
/* */
|
|
|
|
|
2002-12-05 01:48:19 +00:00
|
|
|
struct s_1 { short s[1]; } z_1, s_1;
|
|
|
|
struct s_2 { short s[2]; } z_2, s_2;
|
|
|
|
struct s_3 { short s[3]; } z_3, s_3;
|
|
|
|
struct s_4 { short s[4]; } z_4, s_4;
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct s_1
|
2002-12-05 01:48:19 +00:00
|
|
|
add_struct_1 (struct s_1 s)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < sizeof (s) / sizeof (s.s[0]); i++)
|
|
|
|
{
|
|
|
|
s.s[i] = s.s[i] + s.s[i];
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct s_2
|
2002-12-05 01:48:19 +00:00
|
|
|
add_struct_2 (struct s_2 s)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < sizeof (s) / sizeof (s.s[0]); i++)
|
|
|
|
{
|
|
|
|
s.s[i] = s.s[i] + s.s[i];
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct s_3
|
2002-12-05 01:48:19 +00:00
|
|
|
add_struct_3 (struct s_3 s)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < sizeof (s) / sizeof (s.s[0]); i++)
|
|
|
|
{
|
|
|
|
s.s[i] = s.s[i] + s.s[i];
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct s_4
|
2002-12-05 01:48:19 +00:00
|
|
|
add_struct_4 (struct s_4 s)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < sizeof (s) / sizeof (s.s[0]); i++)
|
|
|
|
{
|
|
|
|
s.s[i] = s.s[i] + s.s[i];
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct s_1
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_struct_1 (void)
|
|
|
|
{
|
|
|
|
int i; register struct s_1 u = z_1;
|
|
|
|
for (i = 0; i < sizeof (s_1) / sizeof (s_1.s[0]); i++) { s_1.s[i] = i + 1; }
|
|
|
|
u = add_struct_1 (u);
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct s_2
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_struct_2 (void)
|
|
|
|
{
|
|
|
|
int i; register struct s_2 u = z_2;
|
|
|
|
for (i = 0; i < sizeof (s_2) / sizeof (s_2.s[0]); i++) { s_2.s[i] = i + 1; }
|
|
|
|
u = add_struct_2 (u);
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct s_3
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_struct_3 (void)
|
|
|
|
{
|
|
|
|
int i; register struct s_3 u = z_3;
|
|
|
|
for (i = 0; i < sizeof (s_3) / sizeof (s_3.s[0]); i++) { s_3.s[i] = i + 1; }
|
|
|
|
u = add_struct_3 (u);
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct s_4
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_struct_4 (void)
|
|
|
|
{
|
|
|
|
int i; register struct s_4 u = z_4;
|
|
|
|
for (i = 0; i < sizeof (s_4) / sizeof (s_4.s[0]); i++) { s_4.s[i] = i + 1; }
|
|
|
|
u = add_struct_4 (u);
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
struct f_1 {unsigned i:1;unsigned j:1;unsigned k:1; } f_1 = {1,1,1}, F_1;
|
|
|
|
struct f_2 {unsigned i:2;unsigned j:2;unsigned k:2; } f_2 = {1,1,1}, F_2;
|
|
|
|
struct f_3 {unsigned i:3;unsigned j:3;unsigned k:3; } f_3 = {1,1,1}, F_3;
|
|
|
|
struct f_4 {unsigned i:4;unsigned j:4;unsigned k:4; } f_4 = {1,1,1}, F_4;
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct f_1
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_field_1 (void)
|
|
|
|
{
|
|
|
|
register struct f_1 u = f_1;
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct f_2
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_field_2 (void)
|
|
|
|
{
|
|
|
|
register struct f_2 u = f_2;
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct f_3
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_field_3 (void)
|
|
|
|
{
|
|
|
|
register struct f_3 u = f_3;
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
2002-12-06 19:21:51 +00:00
|
|
|
struct f_4
|
2002-12-05 01:48:19 +00:00
|
|
|
wack_field_4 (void)
|
|
|
|
{
|
|
|
|
register struct f_4 u = f_4;
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
int
|
|
|
|
main ()
|
|
|
|
{
|
|
|
|
/* These calls are for current frame test. */
|
2003-07-03 13:55:22 +00:00
|
|
|
wack_charest (-1, -2);
|
2003-06-14 22:10:47 +00:00
|
|
|
wack_short (-1, -2);
|
|
|
|
wack_int (-1, -2);
|
|
|
|
wack_long (-1, -2);
|
|
|
|
wack_longest (-1, -2);
|
|
|
|
wack_float (-1, -2);
|
|
|
|
wack_double (-1, -2);
|
|
|
|
wack_doublest (-1, -2);
|
2002-12-05 01:48:19 +00:00
|
|
|
|
|
|
|
/* These calls are for up frame. */
|
2003-07-03 13:55:22 +00:00
|
|
|
wack_charest (-1, -2);
|
2003-06-14 22:10:47 +00:00
|
|
|
wack_short (-1, -2);
|
|
|
|
wack_int (-1, -2);
|
|
|
|
wack_long (-1, -2);
|
|
|
|
wack_longest (-1, -2);
|
|
|
|
wack_float (-1, -2);
|
|
|
|
wack_double (-1, -2);
|
|
|
|
wack_doublest (-1, -2);
|
2002-12-05 01:48:19 +00:00
|
|
|
|
|
|
|
/* These calls are for current frame test. */
|
|
|
|
wack_struct_1 ();
|
|
|
|
wack_struct_2 ();
|
|
|
|
wack_struct_3 ();
|
|
|
|
wack_struct_4 ();
|
|
|
|
|
|
|
|
/* These calls are for up frame. */
|
|
|
|
wack_struct_1 ();
|
|
|
|
wack_struct_2 ();
|
|
|
|
wack_struct_3 ();
|
|
|
|
wack_struct_4 ();
|
|
|
|
|
|
|
|
wack_field_1 ();
|
|
|
|
wack_field_2 ();
|
|
|
|
wack_field_3 ();
|
|
|
|
wack_field_4 ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|