From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5726 invoked by alias); 16 Jul 2004 19:27:59 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 5719 invoked from network); 16 Jul 2004 19:27:59 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 16 Jul 2004 19:27:59 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i6GJRxe3013476 for ; Fri, 16 Jul 2004 15:27:59 -0400 Received: from localhost.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i6GJRwa01040; Fri, 16 Jul 2004 15:27:58 -0400 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 68B112B9D; Fri, 16 Jul 2004 15:27:56 -0400 (EDT) Message-ID: <40F82C3C.4010809@gnu.org> Date: Fri, 16 Jul 2004 19:27:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040217 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [rfc] Cleanup restore.exp Content-Type: multipart/mixed; boundary="------------040500010201040306010805" X-SW-Source: 2004-07/txt/msg00197.txt.bz2 This is a multi-part message in MIME format. --------------040500010201040306010805 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 112 Another one, makes the tests unique and uses gdb_test_multiple and simplifies some patterns. comments? Andrew --------------040500010201040306010805 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 3913 2004-07-16 Andrew Cagney * gdb.base/restore.exp: Update copyright, re-indent. (restore_tests): Use gdb_test_multiple. Add "calleeN calls callerN" prefix where needed. Simplify patterns. Index: gdb.base/restore.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/restore.exp,v retrieving revision 1.6 diff -p -u -r1.6 restore.exp --- gdb.base/restore.exp 22 Jan 2002 01:05:06 -0000 1.6 +++ gdb.base/restore.exp 16 Jul 2004 19:26:00 -0000 @@ -1,4 +1,6 @@ -# Copyright 1998, 1999, 2000 Free Software Foundation, Inc. +# This testcase is part of GDB, the GNU debugger. + +# Copyright 1998, 1999, 2000, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +16,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Test GDB's ability to restore saved registers from stack frames # when using the `return' command. # @@ -24,7 +23,7 @@ # fragments borrowed from return.exp. if $tracelevel then { - strace $tracelevel + strace $tracelevel } set prms_id 0 @@ -34,13 +33,15 @@ set testfile "restore" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } proc restore_tests { } { global gdb_prompt - if { ! [ runto driver ] } then { return 0 } + if { ! [ runto driver ] } { + return 0 + } set limit 5 @@ -48,30 +49,35 @@ proc restore_tests { } { # call each of the callee functions, # force a return from the callee, and # make sure that the local variables still have the right values. + for {set c 1} {$c <= $limit} {incr c} { # Set a breakpoint at the next caller function. - gdb_test "tbreak caller$c" "Breakpoint.*\[0-9\]*\\." "tbreak caller$c" + gdb_test "tbreak caller$c" "Breakpoint.*\[0-9\]*\\." \ + "tbreak caller$c" # Continue to the next caller function. - gdb_test "continue" ".*/\\* caller$c \\*/" "run to caller$c" + gdb_test "continue" " caller$c .*" "run to caller$c" # Do each callee function. for {set e 1} {$e <= $limit} {incr e} { gdb_test "tbreak callee$e" "Breakpoint.*\[0-9\]*\\." \ - "tbreak callee$e" + "caller$c calls callee$e; tbreak callee" - gdb_test "continue" ".*/\\* callee$e \\*/" "run to callee$e" - + gdb_test "continue" " callee$e .*/" \ + "caller$c calls callee$e; continue to callee" + # Do a forced return from the callee. - send_gdb "return 0\n" - gdb_expect { + set test "caller$c calls callee$e; return callee now" + gdb_test_multiple "return 0" "$test" { -re "Make .* return now.*y or n. $" { send_gdb "y\n" exp_continue } - -re "$gdb_prompt $" { } + -re " caller$c .*$gdb_prompt $" { + pass "$test" + } } # Check that the values of the local variables are what @@ -79,7 +85,7 @@ proc restore_tests { } { for {set var 1} {$var <= $c} {incr var} { set expected [expr 0x7eeb + $var] gdb_test "print l$var" " = $expected" \ - "caller$c called callee$e; variable l$var restored to $expected" + "caller$c calls callee$e; return restored l$var to $expected" } } } --------------040500010201040306010805--