From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17128 invoked by alias); 13 Jan 2007 17:21:31 -0000 Received: (qmail 17119 invoked by uid 22791); 13 Jan 2007 17:21:31 -0000 X-Spam-Check-By: sourceware.org Received: from romy.inter.net.il (HELO romy.inter.net.il) (192.114.186.66) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 13 Jan 2007 17:21:25 +0000 Received: from HOME-C4E4A596F7 (IGLD-80-230-11-156.inter.net.il [80.230.11.156]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id GUT55928 (AUTH halo1); Sat, 13 Jan 2007 19:21:18 +0200 (IST) Date: Sat, 13 Jan 2007 17:21:00 -0000 Message-Id: From: Eli Zaretskii To: gdb-patches@sources.redhat.com In-reply-to: (message from Eli Zaretskii on Sat, 13 Jan 2007 19:11:41 +0200) Subject: Re: [RFA] Allow use of breakpoint commands inside `if' or `while' Reply-to: Eli Zaretskii References: 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: 2007-01/txt/msg00337.txt.bz2 > Date: Sat, 13 Jan 2007 19:11:41 +0200 > From: Eli Zaretskii > > (I will post an initial attempt to add a test for this in a moment.) Here it is. It is admittedly inelegant; in particular, the diagnostics for a GDB that fails the test is not very smart, and one of the two tests isn't counted in the sum of failed tests, although it does fail. Hopefully, someone more fluent with Expect will be able to improve on the test (I think Daniel offered help back when I first reported this). --- testsuite/gdb.base/commands.exp.~0 2007-01-09 12:59:09.000000000 -0500 +++ testsuite/gdb.base/commands.exp 2007-01-13 12:00:18.912682122 -0500 @@ -618,6 +618,23 @@ file delete file3 } +proc breakpoint_commands_in_if_command_test {} { + if [target_info exists noargs] { + verbose "Skipping breakpoint_commands_in_if_command_test because of noargs." + return + } + + gdb_test "set \$tem = 1" "" "set \$tem in breakpoint_commands_in_if_command_test" + delete_breakpoints + gdb_test "if \$tem == 2\nbreak main\nelse\nbreak factorial\ncommands\nsilent\nset \$tem = 3\n\continue\nend\nend" \ + "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \ + "breakpoint in else condition" + delete_breakpoints + gdb_test "if \$tem == 1\nbreak main\nelse\nbreak factorial\ncommands\nsilent\nset \$tem = 3\n\continue\nend\nend" \ + "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \ + "breakpoint in if condition" +} + gdbvar_simple_if_test gdbvar_simple_while_test gdbvar_complex_if_while_test @@ -635,3 +652,4 @@ temporary_breakpoint_commands stray_arg0_test recursive_source_test +breakpoint_commands_in_if_command_test