From 81a58f5b702942e10bed032f8ab47ecad4cc43e0 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 14 Jun 2003 22:10:47 +0000 Subject: [PATCH] 2003-06-14 Andrew Cagney * 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. --- gdb/testsuite/ChangeLog | 9 +++- gdb/testsuite/gdb.base/store.c | 86 +++++++++++++++++++++++--------- gdb/testsuite/gdb.base/store.exp | 58 ++++++++++++--------- 3 files changed, 104 insertions(+), 49 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ed7d7771637..cd50d64f93b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2003-06-14 Andrew Cagney + + * 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 * gdb.base/fileio.c: Include , and . Gag @@ -7,7 +15,6 @@ noinferiorio, instead of limiting it to remote. Use remote_exec instead of system. - 2003-06-12 Jeff Johnston * gdb.base/float.exp: Add ia64 support. diff --git a/gdb/testsuite/gdb.base/store.c b/gdb/testsuite/gdb.base/store.c index 802945fcce1..46acc6a1c81 100644 --- a/gdb/testsuite/gdb.base/store.c +++ b/gdb/testsuite/gdb.base/store.c @@ -31,6 +31,14 @@ add_long (register long u, register long v) return u + v; } +typedef long long longest; + +longest +add_longest (register longest u, register longest v) +{ + return u + v; +} + float add_float (register float u, register float v) { @@ -43,56 +51,82 @@ add_double (register double u, register double v) return u + v; } +typedef long double doublest; + +doublest +add_doublest (register doublest u, register doublest v) +{ + return u + v; +} + /* */ char wack_char (register char u, register char v) { - register char l = u; - l = add_char (l, v); + register char l = u, r = v; + l = add_char (l, r); return l; } short wack_short (register short u, register short v) { - register short l = u; - l = add_short (l, v); + register short l = u, r = v; + l = add_short (l, r); return l; } int wack_int (register int u, register int v) { - register int l = u; - l = add_int (l, v); + register int l = u, r = v; + l = add_int (l, r); return l; } long wack_long (register long u, register long v) { - register long l = u; - l = add_long (l, v); + register long l = u, r = 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; } float wack_float (register float u, register float v) { - register float l = u; - l = add_float (l, v); + register float l = u, r = v; + l = add_float (l, r); return l; } double wack_double (register double u, register double v) { - register double l = u; - l = add_double (l, v); + register double l = u, r = v; + l = add_double (l, r); + 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_2 { short s[2]; } z_2, s_2; struct s_3 { short s[3]; } z_3, s_3; @@ -219,20 +253,24 @@ int main () { /* These calls are for current frame test. */ - wack_char (1, 2); - wack_short (1, 2); - wack_int (1, 2); - wack_long (1, 2); - wack_float (1, 2); - wack_double (1, 2); + wack_char (-1, -2); + 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); /* These calls are for up frame. */ - wack_char (1, 2); - wack_short (1, 2); - wack_int (1, 2); - wack_long (1, 2); - wack_float (1, 2); - wack_double (1, 2); + wack_char (-1, -2); + 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); /* These calls are for current frame test. */ wack_struct_1 (); diff --git a/gdb/testsuite/gdb.base/store.exp b/gdb/testsuite/gdb.base/store.exp index d6e941a19b6..5e0e60eb793 100644 --- a/gdb/testsuite/gdb.base/store.exp +++ b/gdb/testsuite/gdb.base/store.exp @@ -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 gdb_test "tbreak wack_${t}" - gdb_test "continue" "register ${t} l = u;" "continue set ${t}" - gdb_test "next" "l = add_${t} .l, v.;" "next ${t}" - gdb_test "print l" " = ${old}" "print old ${t}" + gdb_test "continue" "register ${t} l = u, r = v;" "continue to wack_${t}" + gdb_test "next" "l = add_${t} .l, r.;" "next ${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 "print l" " = ${new}" "print new ${t}" + gdb_test "print l" " = ${new}" "print new l - ${t}" 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 "short" "1" "4" "6" -check_set "int" "1" "4" "6" -check_set "long" "1" "4" "6" -check_set "float" "1" "4" "6" -check_set "double" "1" "4" "6" +check_set "char" "-1 .*" "-2 .*" "4 ..004." "2 ..002." +check_set "short" "-1" "-2" "4" "2" +check_set "int" "-1" "-2" "4" "2" +check_set "long" "-1" "-2" "4" "2" +check_set "longest" "-1" "-2" "4" "2" +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 gdb_test "tbreak add_${t}" - gdb_test "continue" "return u . v;" "continue up ${t}" - gdb_test "up" "l = add_${t} .l, v.;" "up ${t}" - gdb_test "print l" " = ${old}" "print old up ${t}" + gdb_test "continue" "return u . v;" "continue to add_${t}" + gdb_test "up" "l = add_${t} .l, r.;" "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 "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 "short" "1" "4" -up_set "int" "1" "4" -up_set "long" "1" "4" -up_set "float" "1" "4" -up_set "double" "1" "4" +up_set "char" "-1 .*" "-2 .*" "4 ..004." +up_set "short" "-1" "-2" "4" +up_set "int" "-1" "-2" "4" +up_set "long" "-1" "-2" "4" +up_set "longest" "-1" "-2" "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 "continue" "register struct f_${t} u = f_${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 "set variable u = F_${t}" -- 2.30.2