From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19998 invoked by alias); 7 Sep 2002 14:05:21 -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 19988 invoked from network); 7 Sep 2002 14:05:19 -0000 Received: from unknown (HELO mailhost.intrinsity.com) (208.246.32.130) by sources.redhat.com with SMTP; 7 Sep 2002 14:05:19 -0000 Received: from victoria.eng.evsx.com (victoria.eng.evsx.com [192.168.1.29]) by mailhost.intrinsity.com (Postfix) with ESMTP id 7D7B83F40C for ; Sat, 7 Sep 2002 09:05:19 -0500 (CDT) Received: from beeville.vert.intrinsity.com (beeville.vert.intrinsity.com [192.168.3.48]) by victoria.eng.evsx.com (8.10.1/8.10.1) with ESMTP id g87E5J018683; Sat, 7 Sep 2002 09:05:19 -0500 (CDT) From: Fred Fish Received: (from fnf@localhost) by beeville.vert.intrinsity.com (8.11.2/8.11.4) id g87E4kb19664; Sat, 7 Sep 2002 09:04:46 -0500 Message-Id: <200209071404.g87E4kb19664@beeville.vert.intrinsity.com> Subject: [RFA] Fix inferior restart problem in gdb.base/commands.exp To: gdb-patches@sources.redhat.com Date: Sat, 07 Sep 2002 07:05:00 -0000 Cc: fnf@intrinsity.com Reply-To: fnf@intrinsity.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-09/txt/msg00102.txt.bz2 When running the gdb testsuite with an external simulator like "sid", if the inferior is allowed to run to completion and exit, a simple gdb_run_cmd may have problems rerunning the inferior since it doesn't do a complete restart. An alternative to gdb_run_cmd is to do the following prior to setting up the test and then later do just a continue instead of gdb_run_cmd: gdb_exit gdb_start delete_breakpoints gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} but that is much more expensive. It is sufficient to just not allow the inferior to run to completion. This patch does that. Also, to avoid having to specifically test for noinferiorio we don't check for output from the test case, it is not relevant to the given test anyway. -Fred 2002-09-07 Fred Fish * gdb.base/run.c (all_done): Add function and call it at end of main. * gdb.base/commands.exp (bp_deleted_in_command_test): Set breakpoint at all_done so we don't exit, which makes restarting more difficult. Adjust expected success results to match stopping at all_done. (temporary_breakpoint_commands): Ditto. Index: gdb.base/commands.exp =================================================================== RCS file: /mips/newtools/fsf/gdb/gdb/testsuite/gdb.base/commands.exp,v retrieving revision 1.1.1.2 diff -c -p -r1.1.1.2 commands.exp *** gdb.base/commands.exp 2002/08/31 02:49:15 1.1.1.2 --- gdb.base/commands.exp 2002/09/07 13:52:31 *************** proc bp_deleted_in_command_test {} { *** 446,451 **** --- 446,459 ---- gdb_test "set args 1" "" "set args in bp_deleted_in_command_test" delete_breakpoints + # Set a breakpoint that will prevent us from running to completion and exiting. + # If we allow the inferior to exit, gdb_run_cmd may not be sufficient to get us + # going again in a future test without a full restart, when using a gdb stub. + + gdb_test "break all_done" \ + "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \ + "breakpoint at all_done" + # Create a breakpoint, and associate a command-list to it, with # one command that deletes this breakpoint. gdb_test "break factorial" \ *************** proc bp_deleted_in_command_test {} { *** 489,496 **** } gdb_run_cmd gdb_expect { ! -re ".*factorial command-list executed.*1.*Program exited normally.*$gdb_prompt $" { pass "run factorial until breakpoint" } -re ".*$gdb_prompt $" { --- 497,507 ---- } gdb_run_cmd + # Note that we specifically don't check that the inferior printed any output + # since it is immaterial to the test results and we don't want to have to check + # whether or not "noinferiorio" is set. gdb_expect { ! -re ".*factorial command-list executed.*Breakpoint \[0-9\]+, all_done.*$gdb_prompt $" { pass "run factorial until breakpoint" } -re ".*$gdb_prompt $" { *************** proc temporary_breakpoint_commands {} { *** 507,512 **** --- 518,531 ---- gdb_test "set args 1" "" "set args in temporary_breakpoint_commands" delete_breakpoints + # Set a breakpoint that will prevent us from running to completion and exiting. + # If we allow the inferior to exit, gdb_run_cmd may not be sufficient to get us + # going again in a future test without a full restart, when using a gdb stub. + + gdb_test "break all_done" \ + "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \ + "breakpoint at all_done" + # Create a temporary breakpoint, and associate a commands list to it. # This test will verify that this commands list is executed when the # breakpoint is hit. *************** proc temporary_breakpoint_commands {} { *** 546,555 **** } gdb_run_cmd gdb_expect { ! -re ".*factorial tbreak commands executed.*1.*Program exited normally.*" { pass "run factorial until temporary breakpoint" } timeout { fail "(timeout) run factorial until temporary breakpoint" } } } --- 565,581 ---- } gdb_run_cmd + # Note that we specifically don't check that the inferior printed any output + # since it is immaterial to the test results and we don't want to have to check + # whether or not "noinferiorio" is set. gdb_expect { ! -re ".*factorial tbreak commands executed.*Breakpoint \[0-9\]+, all_done.*$gdb_prompt $" { pass "run factorial until temporary breakpoint" + } + -re ".*$gdb_prompt $" { + fail "run factorial until temporary breakpoint" } + default { fail "(timeout) run factorial until temporary breakpoint" } timeout { fail "(timeout) run factorial until temporary breakpoint" } } } Index: gdb.base/run.c =================================================================== RCS file: /mips/newtools/fsf/gdb/gdb/testsuite/gdb.base/run.c,v retrieving revision 1.1.1.1 diff -c -p -r1.1.1.1 run.c *** gdb.base/run.c 2002/07/03 16:56:33 1.1.1.1 --- gdb.base/run.c 2002/09/07 13:52:31 *************** char *arg; *** 37,42 **** --- 37,45 ---- # include #endif /* ! vxworks */ + /* Someplace we can set a breakpoint to avoid running to completion when needed */ + void all_done () {}; + #ifdef PROTOTYPES int factorial (int); *************** char *argv[], **envp; *** 63,68 **** --- 66,72 ---- printf ("%d\n", factorial (atoi (argv[1]))); } #endif + all_done (); return 0; }