From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6658 invoked by alias); 19 May 2011 04:46:19 -0000 Received: (qmail 6642 invoked by uid 22791); 19 May 2011 04:46:17 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 19 May 2011 04:46:03 +0000 Received: (qmail 15045 invoked from network); 19 May 2011 04:46:02 -0000 Received: from unknown (HELO ?192.168.0.102?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 19 May 2011 04:46:02 -0000 Message-ID: <4DD4A086.9030306@codesourcery.com> Date: Thu, 19 May 2011 04:46:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [_Complex test 3/4] Isolate each test's effect in callfuncs.exp References: <4DC401D0.1050500@codesourcery.com> <4DC75036.4040806@codesourcery.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------030204080208000209070606" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00420.txt.bz2 This is a multi-part message in MIME format. --------------030204080208000209070606 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 467 When I was writing patch 4/4 in callfuncs.exp, a fatal fail will make the rest of tests failed as well. In this patch, some code is moved to proc rerun_and_prepare, which is called some times at the beginning of each tests. Also, fetch registers before each test starts, and then, compare with the register state after test is done. This patch is not about _Complex type testing. With this patch, test result of patch 4/4 looks more reasonable. -- Yao (齐尧) --------------030204080208000209070606 Content-Type: text/x-patch; name="0003-prepare-for-test.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0003-prepare-for-test.patch" Content-length: 4623 gdb/testsuite/ * gdb.base/callfuncs.exp (rerun_and_prepare): New. Call rerun_and_prepare for each test to isolate effects. >From 461e0c6aac5ed689bae57f3995e073769288d235 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Wed, 18 May 2011 23:12:18 +0800 Subject: [PATCH 3/4] prepare for test --- gdb/testsuite/gdb.base/callfuncs.exp | 82 ++++++++++++++++++++++------------ 1 files changed, 54 insertions(+), 28 deletions(-) diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp index 27ebd1e..ff86eb8 100644 --- a/gdb/testsuite/gdb.base/callfuncs.exp +++ b/gdb/testsuite/gdb.base/callfuncs.exp @@ -273,6 +273,39 @@ proc fetch_all_registers {test} { return $all_registers_lines } +proc rerun_and_prepare {} { + global hp_aCC_compiler + + if { $hp_aCC_compiler } { + # Do not set language explicitly to 'C'. This will cause aCC + # tests to fail because promotion rules are different. Just let + # the language be set to the default. + + if { ![runto_main] } { + gdb_suppress_tests; + } + + # However, turn off overload-resolution for aCC. Having it on causes + # a lot of failures. + + gdb_test_no_output "set overload-resolution 0" + } else { + gdb_test_no_output "set language c" + if { ![runto_main] } { + gdb_suppress_tests; + } + } + + get_debug_format + + # Make sure that malloc gets called and that the floating point unit + # is initialized via a call to t_double_values. + gdb_test "next" "t_double_values\\(double_val1, double_val2\\);.*" \ + "next to t_double_values" + gdb_test "next" "t_structs_c\\(struct_val1\\);.*" \ + "next to t_structs_c" +} + # Start with a fresh gdb. @@ -285,34 +318,7 @@ gdb_test_no_output "set print sevenbit-strings" gdb_test_no_output "set print address off" gdb_test_no_output "set width 0" -if { $hp_aCC_compiler } { - # Do not set language explicitly to 'C'. This will cause aCC - # tests to fail because promotion rules are different. Just let - # the language be set to the default. - - if { ![runto_main] } { - gdb_suppress_tests; - } - - # However, turn off overload-resolution for aCC. Having it on causes - # a lot of failures. - - gdb_test_no_output "set overload-resolution 0" -} else { - gdb_test_no_output "set language c" - if { ![runto_main] } { - gdb_suppress_tests; - } -} - -get_debug_format - -# Make sure that malloc gets called and that the floating point unit -# is initialized via a call to t_double_values. -gdb_test "next" "t_double_values\\(double_val1, double_val2\\);.*" \ - "next to t_double_values" -gdb_test "next" "t_structs_c\\(struct_val1\\);.*" \ - "next to t_structs_c" +rerun_and_prepare # Save all register contents. set old_reg_content [fetch_all_registers "retrieve original register contents"] @@ -330,6 +336,10 @@ if {$old_reg_content == $new_reg_content} then { fail "gdb function calls preserve register contents" } +rerun_and_prepare +# Save all register contents. +set old_reg_content [fetch_all_registers "retrieve original register contents"] + # Set breakpoint at a function we will call from gdb. gdb_breakpoint add @@ -351,6 +361,12 @@ if ![gdb_test "bt 2" \ } } +rerun_and_prepare +# Set breakpoint at a function we will call from gdb. +gdb_breakpoint add +# Save all register contents. +set old_reg_content [fetch_all_registers "retrieve original register contents"] + # Call function (causing a breakpoint hit in the call dummy) and do a finish, # make sure we are back at main and still have the same register contents. gdb_test "print add(4,5)" "The program being debugged stopped while.*" \ @@ -370,6 +386,12 @@ if ![gdb_test "bt 2" \ } } +rerun_and_prepare +# Set breakpoint at a function we will call from gdb. +gdb_breakpoint add +# Save all register contents. +set old_reg_content [fetch_all_registers "retrieve original register contents"] + # Call function (causing a breakpoint hit in the call dummy) and do a return # with a value, make sure we are back at main with the same register contents. gdb_test "print add(4,5)" "The program being debugged stopped while.*" \ @@ -388,6 +410,10 @@ if ![gdb_test "return 7" \ } } +rerun_and_prepare +# Set breakpoint at a function we will call from gdb. +gdb_breakpoint add +set old_reg_content [fetch_all_registers "retrieve original register contents"] + # Call function (causing a breakpoint hit in the call dummy), and # call another function from the call dummy frame (thereby setting up # several nested call dummy frames). Test that backtrace and finish -- 1.7.0.4 --------------030204080208000209070606--