2003-06-14 Andrew Cagney <cagney@redhat.com>

* gdb.base/store.exp: Test longest and doublest.  Test all
	parameters.  Weaken return statement match.
	* gdb.base/store.c: Add longest and doublest - aka long long and
	long double functions.  Put all parameters into local register
	variables.  Use negative values.
This commit is contained in:
Andrew Cagney 2003-06-14 22:10:47 +00:00
parent 98be1e7766
commit 81a58f5b70
3 changed files with 104 additions and 49 deletions

View File

@ -1,3 +1,11 @@
2003-06-14 Andrew Cagney <cagney@redhat.com>
* gdb.base/store.exp: Test longest and doublest. Test all
parameters. Weaken return statement match.
* gdb.base/store.c: Add longest and doublest - aka long long and
long double functions. Put all parameters into local register
variables. Use negative values.
2003-06-14 Andrew Cagney <cagney@redhat.com> 2003-06-14 Andrew Cagney <cagney@redhat.com>
* gdb.base/fileio.c: Include <errno.h>, and <sys/wait.h>. Gag * gdb.base/fileio.c: Include <errno.h>, and <sys/wait.h>. Gag
@ -7,7 +15,6 @@
noinferiorio, instead of limiting it to remote. Use remote_exec noinferiorio, instead of limiting it to remote. Use remote_exec
instead of system. instead of system.
2003-06-12 Jeff Johnston <jjohnstn@redhat.com> 2003-06-12 Jeff Johnston <jjohnstn@redhat.com>
* gdb.base/float.exp: Add ia64 support. * gdb.base/float.exp: Add ia64 support.

View File

@ -31,6 +31,14 @@ add_long (register long u, register long v)
return u + v; return u + v;
} }
typedef long long longest;
longest
add_longest (register longest u, register longest v)
{
return u + v;
}
float float
add_float (register float u, register float v) add_float (register float u, register float v)
{ {
@ -43,56 +51,82 @@ add_double (register double u, register double v)
return u + v; return u + v;
} }
typedef long double doublest;
doublest
add_doublest (register doublest u, register doublest v)
{
return u + v;
}
/* */ /* */
char char
wack_char (register char u, register char v) wack_char (register char u, register char v)
{ {
register char l = u; register char l = u, r = v;
l = add_char (l, v); l = add_char (l, r);
return l; return l;
} }
short short
wack_short (register short u, register short v) wack_short (register short u, register short v)
{ {
register short l = u; register short l = u, r = v;
l = add_short (l, v); l = add_short (l, r);
return l; return l;
} }
int int
wack_int (register int u, register int v) wack_int (register int u, register int v)
{ {
register int l = u; register int l = u, r = v;
l = add_int (l, v); l = add_int (l, r);
return l; return l;
} }
long long
wack_long (register long u, register long v) wack_long (register long u, register long v)
{ {
register long l = u; register long l = u, r = v;
l = add_long (l, v); l = add_long (l, r);
return l;
}
long
wack_longest (register longest u, register longest v)
{
register longest l = u, r = v;
l = add_longest (l, r);
return l; return l;
} }
float float
wack_float (register float u, register float v) wack_float (register float u, register float v)
{ {
register float l = u; register float l = u, r = v;
l = add_float (l, v); l = add_float (l, r);
return l; return l;
} }
double double
wack_double (register double u, register double v) wack_double (register double u, register double v)
{ {
register double l = u; register double l = u, r = v;
l = add_double (l, v); l = add_double (l, r);
return l; return l;
} }
doublest
wack_doublest (register doublest u, register doublest v)
{
register doublest l = u, r = v;
l = add_doublest (l, r);
return l;
}
/* */
struct s_1 { short s[1]; } z_1, s_1; struct s_1 { short s[1]; } z_1, s_1;
struct s_2 { short s[2]; } z_2, s_2; struct s_2 { short s[2]; } z_2, s_2;
struct s_3 { short s[3]; } z_3, s_3; struct s_3 { short s[3]; } z_3, s_3;
@ -219,20 +253,24 @@ int
main () main ()
{ {
/* These calls are for current frame test. */ /* These calls are for current frame test. */
wack_char (1, 2); wack_char (-1, -2);
wack_short (1, 2); wack_short (-1, -2);
wack_int (1, 2); wack_int (-1, -2);
wack_long (1, 2); wack_long (-1, -2);
wack_float (1, 2); wack_longest (-1, -2);
wack_double (1, 2); wack_float (-1, -2);
wack_double (-1, -2);
wack_doublest (-1, -2);
/* These calls are for up frame. */ /* These calls are for up frame. */
wack_char (1, 2); wack_char (-1, -2);
wack_short (1, 2); wack_short (-1, -2);
wack_int (1, 2); wack_int (-1, -2);
wack_long (1, 2); wack_long (-1, -2);
wack_float (1, 2); wack_longest (-1, -2);
wack_double (1, 2); wack_float (-1, -2);
wack_double (-1, -2);
wack_doublest (-1, -2);
/* These calls are for current frame test. */ /* These calls are for current frame test. */
wack_struct_1 (); wack_struct_1 ();

View File

@ -54,43 +54,49 @@ if ![runto_main] then {
# #
proc check_set { t old new add } { proc check_set { t l r new add } {
global gdb_prompt global gdb_prompt
gdb_test "tbreak wack_${t}" gdb_test "tbreak wack_${t}"
gdb_test "continue" "register ${t} l = u;" "continue set ${t}" gdb_test "continue" "register ${t} l = u, r = v;" "continue to wack_${t}"
gdb_test "next" "l = add_${t} .l, v.;" "next ${t}" gdb_test "next" "l = add_${t} .l, r.;" "next ${t}"
gdb_test "print l" " = ${old}" "print old ${t}" gdb_test "print l" " = ${l}" "print old l - ${t}"
gdb_test "print r" " = ${r}" "print old r - ${t}"
gdb_test "set variable l = 4" gdb_test "set variable l = 4"
gdb_test "print l" " = ${new}" "print new ${t}" gdb_test "print l" " = ${new}" "print new l - ${t}"
gdb_test "next" "return l;" gdb_test "next" "return l;"
gdb_test "print l" " = ${add}" "print add ${t}" gdb_test "print l" " = ${add}" "print add - ${t}"
} }
check_set "char" "1 ..001." "4 ..004." "6 ..006." check_set "char" "-1 .*" "-2 .*" "4 ..004." "2 ..002."
check_set "short" "1" "4" "6" check_set "short" "-1" "-2" "4" "2"
check_set "int" "1" "4" "6" check_set "int" "-1" "-2" "4" "2"
check_set "long" "1" "4" "6" check_set "long" "-1" "-2" "4" "2"
check_set "float" "1" "4" "6" check_set "longest" "-1" "-2" "4" "2"
check_set "double" "1" "4" "6" check_set "float" "-1" "-2" "4" "2"
check_set "double" "-1" "-2" "4" "2"
check_set "doublest" "-1" "-2" "4" "2"
# #
proc up_set { t old new } { proc up_set { t l r new } {
global gdb_prompt global gdb_prompt
gdb_test "tbreak add_${t}" gdb_test "tbreak add_${t}"
gdb_test "continue" "return u . v;" "continue up ${t}" gdb_test "continue" "return u . v;" "continue to add_${t}"
gdb_test "up" "l = add_${t} .l, v.;" "up ${t}" gdb_test "up" "l = add_${t} .l, r.;" "up ${t}"
gdb_test "print l" " = ${old}" "print old up ${t}" gdb_test "print l" " = ${l}" "up print old l - ${t}"
gdb_test "print r" " = ${r}" "up print old r - ${t}"
gdb_test "set variable l = 4" gdb_test "set variable l = 4"
gdb_test "print l" " = ${new}" "print new up ${t}" gdb_test "print l" " = ${new}" "up print new l - ${t}"
} }
up_set "char" "1 ..001." "4 ..004." up_set "char" "-1 .*" "-2 .*" "4 ..004."
up_set "short" "1" "4" up_set "short" "-1" "-2" "4"
up_set "int" "1" "4" up_set "int" "-1" "-2" "4"
up_set "long" "1" "4" up_set "long" "-1" "-2" "4"
up_set "float" "1" "4" up_set "longest" "-1" "-2" "4"
up_set "double" "1" "4" up_set "float" "-1" "-2" "4"
up_set "double" "-1" "-2" "4"
up_set "doublest" "-1" "-2" "4"
# #
@ -133,7 +139,11 @@ proc check_field { t } {
gdb_test "tbreak wack_field_${t}" gdb_test "tbreak wack_field_${t}"
gdb_test "continue" "register struct f_${t} u = f_${t};" \ gdb_test "continue" "register struct f_${t} u = f_${t};" \
"continue field ${t}" "continue field ${t}"
gdb_test "next" "return u;" "next field ${t}"
# Match either the return statement, or the line immediatly after
# it. The compiler can end up merging the return statement into
# the return instruction.
gdb_test "next" "(return u;|\})" "next field ${t}"
gdb_test "print u" " = {i = 1, j = 1, k = 1}" "old field ${t}" gdb_test "print u" " = {i = 1, j = 1, k = 1}" "old field ${t}"
gdb_test "set variable u = F_${t}" gdb_test "set variable u = F_${t}"