From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Blandy To: tromey@redhat.com Cc: gdb-patches@sources.redhat.com> Subject: Re: RFA: tolerate unavailable struct return values Date: Thu, 29 Nov 2001 22:41:00 -0000 Message-id: References: <20011129220913.2D72A5E9D8@zwingli.cygnus.com> <87667t2loj.fsf@creche.redhat.com> X-SW-Source: 2001-11/msg00600.html Tom Tromey writes: > Jim> On some architectures, it's impossible for GDB to find structs > Jim> returned by value. These shouldn't be failures. Should they be > Jim> passes? > > Dejagnu also knows about "UNTESTED" and "UNSUPPORTED". > See (dejagnu)Posix That sounds right. Revised patch: 2001-11-29 Jim Blandy If GDB says it can't find the struct the function returned, report those tests as `unsupported'. * gdb.base/structs.exp (call_struct_func): New function. (do_function_calls): Use call_struct_func to call the functions returning structs. Index: gdb/testsuite/gdb.base/structs.exp =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/structs.exp,v retrieving revision 1.17 diff -c -r1.17 structs.exp *** gdb/testsuite/gdb.base/structs.exp 2001/08/09 18:02:02 1.17 --- gdb/testsuite/gdb.base/structs.exp 2001/11/30 06:37:45 *************** *** 54,59 **** --- 54,85 ---- continue } + + # Call FUNC with no arguments, and expect to see the regexp RESULT in + # the output. If we get back the error message "Function return value + # unknown", call that an expected failure; on some architectures, it's + # impossible to find structs returned by value reliably. + proc call_struct_func { func result } { + global gdb_prompt + + set command "p ${func}()" + send_gdb "${command}\n" + gdb_expect { + -re "$result\[\r\n\]+$gdb_prompt $" { + pass "$command" + } + -re "Function return value unknown.\[\r\n\]+$gdb_prompt $" { + unsupported "$command" + } + -re "$gdb_prompt $" { + fail "$command" + } + timeout { + fail "$command (timeout)" + } + } + } + # FIXME: Before calling this proc, we should probably verify that # we can call inferior functions and get a valid integral value # returned. *************** *** 67,85 **** global gdb_prompt # First, call the "fun" functions and examine the value they return. ! gdb_test "p fun1()" " = {a = 49 '1'}" ! gdb_test "p fun2()" " = {a = 97 'a', b = 98 'b'}" ! gdb_test "p fun3()" " = {a = 65 'A', b = 66 'B', c = 67 'C'}" ! gdb_test "p fun4()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4'}" ! gdb_test "p fun5()" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e'}" ! gdb_test "p fun6()" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F'}" ! gdb_test "p fun7()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7'}" ! gdb_test "p fun8()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8'}" ! gdb_test "p fun9()" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i'}" ! gdb_test "p fun10()" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J'}" ! gdb_test "p fun11()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8', i = 57 '9', j = 65 'A', k = 66 'B'}" ! gdb_test "p fun12()" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J', k = 75 'K', l = 76 'L'}" ! gdb_test "p fun16()" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i', j = 106 'j', k = 107 'k', l = 108 'l', m = 109 'm', n = 110 'n', o = 111 'o', p = 112 'p'}" # Now call the Fun functions to set the L* variables. This # tests that gdb properly passes structures to functions. --- 93,111 ---- global gdb_prompt # First, call the "fun" functions and examine the value they return. ! call_struct_func "fun1" " = {a = 49 '1'}" ! call_struct_func "fun2" " = {a = 97 'a', b = 98 'b'}" ! call_struct_func "fun3" " = {a = 65 'A', b = 66 'B', c = 67 'C'}" ! call_struct_func "fun4" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4'}" ! call_struct_func "fun5" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e'}" ! call_struct_func "fun6" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F'}" ! call_struct_func "fun7" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7'}" ! call_struct_func "fun8" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8'}" ! call_struct_func "fun9" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i'}" ! call_struct_func "fun10" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J'}" ! call_struct_func "fun11" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8', i = 57 '9', j = 65 'A', k = 66 'B'}" ! call_struct_func "fun12" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J', k = 75 'K', l = 76 'L'}" ! call_struct_func "fun16" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i', j = 106 'j', k = 107 'k', l = 108 'l', m = 109 'm', n = 110 'n', o = 111 'o', p = 112 'p'}" # Now call the Fun functions to set the L* variables. This # tests that gdb properly passes structures to functions. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24978 invoked by alias); 30 Nov 2001 06:41:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 24942 invoked from network); 30 Nov 2001 06:41:15 -0000 Received: from unknown (HELO zwingli.cygnus.com) (208.245.165.35) by hostedprojects.ges.redhat.com with SMTP; 30 Nov 2001 06:41:15 -0000 Received: by zwingli.cygnus.com (Postfix, from userid 442) id 958D05E9D8; Fri, 30 Nov 2001 01:42:31 -0500 (EST) To: tromey@redhat.com Cc: gdb-patches@sources.redhat.com> Subject: Re: RFA: tolerate unavailable struct return values References: <20011129220913.2D72A5E9D8@zwingli.cygnus.com> <87667t2loj.fsf@creche.redhat.com> From: Jim Blandy Date: Wed, 21 Nov 2001 08:07:00 -0000 In-Reply-To: Tom Tromey's message of 29 Nov 2001 16:37:32 -0700 Message-ID: X-Mailer: Gnus v5.3/Emacs 19.34 X-SW-Source: 2001-11/txt/msg00385.txt.bz2 Message-ID: <20011121080700.sYDJfYgIReRK8C05Bas2_jztuDGFx4M1BF5BnRf0IFg@z> Tom Tromey writes: > Jim> On some architectures, it's impossible for GDB to find structs > Jim> returned by value. These shouldn't be failures. Should they be > Jim> passes? > > Dejagnu also knows about "UNTESTED" and "UNSUPPORTED". > See (dejagnu)Posix That sounds right. Revised patch: 2001-11-29 Jim Blandy If GDB says it can't find the struct the function returned, report those tests as `unsupported'. * gdb.base/structs.exp (call_struct_func): New function. (do_function_calls): Use call_struct_func to call the functions returning structs. Index: gdb/testsuite/gdb.base/structs.exp =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/structs.exp,v retrieving revision 1.17 diff -c -r1.17 structs.exp *** gdb/testsuite/gdb.base/structs.exp 2001/08/09 18:02:02 1.17 --- gdb/testsuite/gdb.base/structs.exp 2001/11/30 06:37:45 *************** *** 54,59 **** --- 54,85 ---- continue } + + # Call FUNC with no arguments, and expect to see the regexp RESULT in + # the output. If we get back the error message "Function return value + # unknown", call that an expected failure; on some architectures, it's + # impossible to find structs returned by value reliably. + proc call_struct_func { func result } { + global gdb_prompt + + set command "p ${func}()" + send_gdb "${command}\n" + gdb_expect { + -re "$result\[\r\n\]+$gdb_prompt $" { + pass "$command" + } + -re "Function return value unknown.\[\r\n\]+$gdb_prompt $" { + unsupported "$command" + } + -re "$gdb_prompt $" { + fail "$command" + } + timeout { + fail "$command (timeout)" + } + } + } + # FIXME: Before calling this proc, we should probably verify that # we can call inferior functions and get a valid integral value # returned. *************** *** 67,85 **** global gdb_prompt # First, call the "fun" functions and examine the value they return. ! gdb_test "p fun1()" " = {a = 49 '1'}" ! gdb_test "p fun2()" " = {a = 97 'a', b = 98 'b'}" ! gdb_test "p fun3()" " = {a = 65 'A', b = 66 'B', c = 67 'C'}" ! gdb_test "p fun4()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4'}" ! gdb_test "p fun5()" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e'}" ! gdb_test "p fun6()" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F'}" ! gdb_test "p fun7()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7'}" ! gdb_test "p fun8()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8'}" ! gdb_test "p fun9()" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i'}" ! gdb_test "p fun10()" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J'}" ! gdb_test "p fun11()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8', i = 57 '9', j = 65 'A', k = 66 'B'}" ! gdb_test "p fun12()" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J', k = 75 'K', l = 76 'L'}" ! gdb_test "p fun16()" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i', j = 106 'j', k = 107 'k', l = 108 'l', m = 109 'm', n = 110 'n', o = 111 'o', p = 112 'p'}" # Now call the Fun functions to set the L* variables. This # tests that gdb properly passes structures to functions. --- 93,111 ---- global gdb_prompt # First, call the "fun" functions and examine the value they return. ! call_struct_func "fun1" " = {a = 49 '1'}" ! call_struct_func "fun2" " = {a = 97 'a', b = 98 'b'}" ! call_struct_func "fun3" " = {a = 65 'A', b = 66 'B', c = 67 'C'}" ! call_struct_func "fun4" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4'}" ! call_struct_func "fun5" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e'}" ! call_struct_func "fun6" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F'}" ! call_struct_func "fun7" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7'}" ! call_struct_func "fun8" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8'}" ! call_struct_func "fun9" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i'}" ! call_struct_func "fun10" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J'}" ! call_struct_func "fun11" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8', i = 57 '9', j = 65 'A', k = 66 'B'}" ! call_struct_func "fun12" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J', k = 75 'K', l = 76 'L'}" ! call_struct_func "fun16" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i', j = 106 'j', k = 107 'k', l = 108 'l', m = 109 'm', n = 110 'n', o = 111 'o', p = 112 'p'}" # Now call the Fun functions to set the L* variables. This # tests that gdb properly passes structures to functions.