From patchwork Wed Nov 9 16:16:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 17341 Received: (qmail 15058 invoked by alias); 9 Nov 2016 16:16:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 15047 invoked by uid 89); 9 Nov 2016 16:16:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=nif, 3608, backslashes, 26532 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Nov 2016 16:16:32 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B9B5804FE; Wed, 9 Nov 2016 16:16:31 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uA9GGTvm005622; Wed, 9 Nov 2016 11:16:30 -0500 Subject: Re: [PATCH v2 2/5] Further cleanup/modernization of gdb.base/commands.exp To: Simon Marchi References: <1478650771-24430-1-git-send-email-palves@redhat.com> <1478650771-24430-3-git-send-email-palves@redhat.com> <994221f0964b21175ece863b9e4eed59@polymtl.ca> <1e856161-24c0-5f93-7847-a2bf9af57e8c@redhat.com> <937642fa3965d4029b5c98cb84a26954@polymtl.ca> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <835da2d0-1d1a-907d-420e-5332f3336a9b@redhat.com> Date: Wed, 9 Nov 2016 16:16:29 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <937642fa3965d4029b5c98cb84a26954@polymtl.ca> On 11/09/2016 04:09 PM, Simon Marchi wrote: > On 2016-11-09 10:59, Pedro Alves wrote: >> And I'm wondering whether this below as well would be a good idea, >> or whether it'd obfuscate? If a good idea, maybe we'd put the new >> variable in gdb.exp. > > ... > >> @@ -45,7 +50,7 @@ proc_with_prefix gdbvar_simple_if_test {} { >> "else" \ >> " p/x 0xdeadbeef" \ >> "end"] \ >> - "\\\$\[0-9\]* = 0xdeadbeef" \ >> + "$valnum_re = 0xdeadbeef" \ >> "#1" > > > That's not bad. I was going to suggest using {} instead of "" to get > rid of most backslashes (untested): > > -"\\\$\[0-9\]* = 0xdeadbeef" > +{\$[0-9]* = 0xdeadbeef} > > but with the variable it looks good as well. > Here's the resulting squashed patch then. WDYT? From 55c622b20b7b4ddba7dd01ac30db182c5fb6ef18 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 9 Nov 2016 16:10:44 +0000 Subject: [PATCH] Further cleanup/modernization of gdb.base/commands.exp - Use multi_line for matching multi-line GDB output. - Add a multi_line_input variant of multi_line to build GDB input and use it throughout. (The two changes above make the tests much more readable, IMO.) - Add a new valnum_re global to get rid of the multiple "\\\$\[0-9\]*". - Remove gdb_stop_suppressing_tests uses. - tighten a few regexps. - Replace send_gdb/gdb_expect with gdb_test_multiple and simplify, making pass/fail messages the same. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * gdb.base/commands.exp (runto_or_return): New procedure. (gdbvar_simple_if_test, gdbvar_simple_while_test) (gdbvar_complex_if_while_test, progvar_simple_if_test) (progvar_simple_while_test, progvar_complex_if_while_test) (if_while_breakpoint_command_test) (infrun_breakpoint_command_test, breakpoint_command_test) (user_defined_command_test, watchpoint_command_test) (test_command_prompt_position, redefine_hook_test) (stray_arg0_test, error_clears_commands_left, redefine_hook_test) (redefine_backtrace_test): Use runto_or_return, $valnum_re, multi_line_input and multi_line. Remove gdb_expect and gdb_stop_suppressing_tests uses. * lib/gdb.exp (valnum_re): New global. (multi_line_input): New procedure. --- gdb/testsuite/gdb.base/commands.exp | 365 ++++++++++++++++++++++++------------ gdb/testsuite/lib/gdb.exp | 13 ++ 2 files changed, 257 insertions(+), 121 deletions(-) diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index fe2c23a..44947f2 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -23,91 +23,183 @@ if { [prepare_for_testing commands.exp commands run.c {debug additional_flags=-D return -1 } +# Run to FUNCTION. If that fails, issue a FAIL and make the caller +# return. + +proc runto_or_return {function} { + if { ![runto factorial] } { + fail "cannot run to $function" + return -code return + } +} + proc_with_prefix gdbvar_simple_if_test {} { global gdb_prompt + global valnum_re gdb_test_no_output "set \$foo = 0" "set foo" # All this test should do is print 0xdeadbeef once. - gdb_test "if \$foo == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \ - "\\\$\[0-9\]* = 0xdeadbeef" "#1" + gdb_test \ + [multi_line_input \ + "if \$foo == 1" \ + " p/x 0xfeedface" \ + "else" \ + " p/x 0xdeadbeef" \ + "end"] \ + "$valnum_re = 0xdeadbeef" \ + "#1" + # All this test should do is print 0xfeedface once. - gdb_test "if \$foo == 0\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \ - "\\\$\[0-9\]* = 0xfeedface" "#2" + gdb_test \ + [multi_line_input \ + "if \$foo == 0" \ + " p/x 0xfeedface" \ + "else" \ + " p/x 0xdeadbeef" \ + "end"] \ + "$valnum_re = 0xfeedface" \ + "#2" } proc_with_prefix gdbvar_simple_while_test {} { global gdb_prompt + global valnum_re gdb_test_no_output "set \$foo = 5" "set foo" # This test should print 0xfeedface five times. - gdb_test "while \$foo > 0\np/x 0xfeedface\nset \$foo -= 1\nend" \ - "\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \ - "#1" + gdb_test \ + [multi_line_input \ + "while \$foo > 0" \ + " p/x 0xfeedface" \ + " set \$foo -= 1" \ + "end"] \ + [multi_line \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xfeedface"] \ + "#1" } proc_with_prefix gdbvar_complex_if_while_test {} { global gdb_prompt + global valnum_re - gdb_test_no_output "set \$foo = 4" \ - "set foo" + gdb_test_no_output "set \$foo = 4" "set foo" # This test should alternate between 0xdeadbeef and 0xfeedface two times. - gdb_test "while \$foo > 0\nset \$foo -= 1\nif \(\$foo % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" \ - "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \ - "#1" + gdb_test \ + [multi_line_input \ + "while \$foo > 0" \ + " set \$foo -= 1" \ + " if \(\$foo % 2\) == 1" \ + " p/x 0xdeadbeef" \ + " else" \ + " p/x 0xfeedface" \ + " end" \ + "end"] \ + [multi_line \ + "$valnum_re = 0xdeadbeef" \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xdeadbeef" \ + "$valnum_re = 0xfeedface"] \ + "#1" } proc_with_prefix progvar_simple_if_test {} { global gdb_prompt + global valnum_re + + runto_or_return factorial - if { ![runto factorial] } then { gdb_suppress_tests; } # Don't depend upon argument passing, since most simulators don't # currently support it. Bash value variable to be what we want. - gdb_test "p value=5" ".*" "set value to 5" + gdb_test "p value=5" " = 5" "set value to 5" # All this test should do is print 0xdeadbeef once. - gdb_test "if value == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \ - "\\\$\[0-9\]* = 0xdeadbeef" \ - "#1" + gdb_test \ + [multi_line_input \ + "if value == 1" \ + " p/x 0xfeedface" \ + "else" \ + " p/x 0xdeadbeef" \ + "end"] \ + "$valnum_re = 0xdeadbeef" \ + "#1" + # All this test should do is print 0xfeedface once. - gdb_test "if value == 5\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \ - "\\\$\[0-9\]* = 0xfeedface" \ - "#2" - gdb_stop_suppressing_tests + gdb_test \ + [multi_line_input \ + "if value == 5" \ + " p/x 0xfeedface" \ + "else" \ + " p/x 0xdeadbeef" \ + "end"] \ + "$valnum_re = 0xfeedface" \ + "#2" } proc_with_prefix progvar_simple_while_test {} { global gdb_prompt + global valnum_re + + runto_or_return factorial - if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't # currently support it. Bash value variable to be what we want. - gdb_test "p value=5" ".*" "set value to 5" + gdb_test "p value=5" " = 5" "set value to 5" # This test should print 0xfeedface five times. - gdb_test "while value > 0\np/x 0xfeedface\nset value -= 1\nend" \ - "\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \ - "#1" - gdb_stop_suppressing_tests + gdb_test \ + [multi_line_input \ + "while value > 0" \ + " p/x 0xfeedface" \ + " set value -= 1" \ + "end"] \ + [multi_line \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xfeedface"] \ + "#1" } proc_with_prefix progvar_complex_if_while_test {} { global gdb_prompt + global valnum_re + + runto_or_return factorial - if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't # currently support it. Bash value variable to be what we want. - gdb_test "p value=4" ".*" "set value to 4" - # This test should alternate between 0xdeadbeef and 0xfeedface two times. - gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" \ - "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \ - "#1" - gdb_stop_suppressing_tests + gdb_test "p value=4" " = 4" "set value to 4" + # This test should alternate between 0xdeadbeef and 0xfeedface two + # times. + gdb_test \ + [multi_line_input \ + "while value > 0" \ + " set value -= 1" \ + " if \(value % 2\) == 1" \ + " p/x 0xdeadbeef" \ + " else" \ + " p/x 0xfeedface" \ + " end" \ + "end"] \ + [multi_line \ + "$valnum_re = 0xdeadbeef" \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xdeadbeef" \ + "$valnum_re = 0xfeedface"] \ + "#1" } proc_with_prefix if_while_breakpoint_command_test {} { + global valnum_re + + runto_or_return factorial - if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't # currently support it. Bash value variable to be what we want. - gdb_test "p value=5" ".*" "set value to 5" + gdb_test "p value=5" " = 5" "set value to 5" delete_breakpoints gdb_test "break factorial" "Breakpoint.*at.*" "break factorial" @@ -118,14 +210,28 @@ proc_with_prefix if_while_breakpoint_command_test {} { } # This test should alternate between 0xdeadbeef and 0xfeedface two times. - gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" \ - "" \ - "commands part 2" - gdb_test "continue" \ - "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \ - "#1" + gdb_test \ + [multi_line_input \ + "while value > 0" \ + " set value -= 1" \ + " if \(value % 2\) == 1" \ + " p/x 0xdeadbeef" \ + " else" \ + " p/x 0xfeedface" \ + " end" \ + "end" \ + "end"] \ + "" \ + "commands part 2" + gdb_test \ + "continue" \ + [multi_line \ + "$valnum_re = 0xdeadbeef" \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xdeadbeef" \ + "$valnum_re = 0xfeedface"] \ + "#1" gdb_test "info break" "while.*set.*if.*p/x.*else.*p/x.*end.*" - gdb_stop_suppressing_tests } # Test that we can run the inferior from breakpoint commands. @@ -135,11 +241,11 @@ proc_with_prefix if_while_breakpoint_command_test {} { # subsection "Breakpoint command lists". proc_with_prefix infrun_breakpoint_command_test {} { + runto_or_return factorial - if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't # currently support it. Bash value variable to be what we want. - gdb_test "p value=6" ".*" "set value to 6" + gdb_test "p value=6" " = 6" "set value to 6" delete_breakpoints gdb_test "break factorial if value == 5" "Breakpoint.*at.*" @@ -159,29 +265,32 @@ proc_with_prefix infrun_breakpoint_command_test {} { gdb_test "continue" \ "Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[ \]*if \\(value > 1\\) \{.*\[0-9\]*\[ \]*value \\*= factorial \\(value - 1\\);.*" - - gdb_stop_suppressing_tests } proc_with_prefix breakpoint_command_test {} { + runto_or_return factorial - if { ![runto factorial] } then { gdb_suppress_tests; } # Don't depend upon argument passing, since most simulators don't # currently support it. Bash value variable to be what we want. - gdb_test "p value=6" ".*" "set value to 6" + gdb_test "p value=6" " = 6" "set value to 6" delete_breakpoints gdb_test "break factorial" "Breakpoint.*at.*" - gdb_test "commands\nprintf \"Now the value is %d\\n\", value\nend" \ - "End with.*" "commands" + gdb_test \ + [multi_line_input \ + "commands" \ + " printf \"Now the value is %d\\n\", value" \ + "end"] \ + "End with.*" \ + "commands" gdb_test "continue" \ "Breakpoint \[0-9\]*, factorial.*Now the value is 5" gdb_test "print value" " = 5" - gdb_stop_suppressing_tests } # Test a simple user defined command (with arguments) proc_with_prefix user_defined_command_test {} { global gdb_prompt + global valnum_re gdb_test_no_output "set \$foo = 4" "set foo" @@ -192,13 +301,31 @@ proc_with_prefix user_defined_command_test {} { } # This test should alternate between 0xdeadbeef and 0xfeedface two times. - gdb_test "while \$arg0 > 0\nset \$arg0 -= 1\nif \(\$arg0 % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" \ - "" \ - "enter commands" - - gdb_test "mycommand \$foo" \ - "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \ - "execute user-defined command" + gdb_test \ + [multi_line_input \ + "while \$arg0 > 0" \ + " set \$arg0 -= 1" \ + " if \(\$arg0 % 2\) == 1" \ + " p/x 0xdeadbeef" \ + " else" \ + " p/x 0xfeedface" \ + " end" \ + "end" \ + "end"] \ + "" \ + "enter commands" + + global decimal + set valnum_re "\\\$$decimal" + + gdb_test \ + "mycommand \$foo" \ + [multi_line \ + "$valnum_re = 0xdeadbeef" \ + "$valnum_re = 0xfeedface" \ + "$valnum_re = 0xdeadbeef" \ + "$valnum_re = 0xfeedface"] \ + "execute user-defined command" gdb_test "show user mycommand" \ " while \\\$arg0.*set.* if \\\(\\\$arg0.*p/x.* else\[^\n\].*p/x.* end\[^\n\].* end\[^\n\].*" \ "display user command" @@ -233,7 +360,8 @@ proc_with_prefix watchpoint_command_test {} { gdb_test_no_output "set can-use-hw-watchpoints 0" "" } - if { ![runto factorial] } then { return } + runto_or_return factorial + delete_breakpoints # Verify that we can create a watchpoint, and give it a commands @@ -298,60 +426,44 @@ proc_with_prefix watchpoint_command_test {} { proc_with_prefix test_command_prompt_position {} { global gdb_prompt + global valnum_re + + runto_or_return factorial - if { ![runto factorial] } then { gdb_suppress_tests; } # Don't depend upon argument passing, since most simulators don't # currently support it. Bash value variable to be what we want. delete_breakpoints gdb_test "break factorial" "Breakpoint.*at.*" gdb_test "p value=5" ".*" "set value to 5" # All this test should do is print 0xdeadbeef once. - gdb_test "if value == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \ - "\\\$\[0-9\]* = 0xdeadbeef" \ - "if test" - + gdb_test \ + [multi_line_input \ + "if value == 1" \ + " p/x 0xfeedface" \ + "else" \ + " p/x 0xdeadbeef" \ + "end"] \ + "$valnum_re = 0xdeadbeef" \ + "if test" + # Now let's test for the correct position of the '>' in gdb's # prompt for commands. It should be at the beginning of the line, # and not after one space. - send_gdb "commands\n" - gdb_expect { - -re "Type commands.*End with.*\[\r\n\]>$" { - send_gdb "printf \"Now the value is %d\\n\", value\n" - gdb_expect { + set test "> OK" + gdb_test_multiple "commands" $test { + -re "Type commands.*End with.*\[\r\n\]>$" { + gdb_test_multiple "printf \"Now the value is %d\\n\", value" $test { -re "^printf.*value\r\n>$" { - send_gdb "end\n" - gdb_expect { + gdb_test_multiple "end" $test { -re "^end\r\n$gdb_prompt $" { - pass "> OK" - } - -re ".*$gdb_prompt $" { - fail "some other message" - } - timeout { - fail "(timeout) 1" + pass $test } } } - -re "^ >$" { fail "> not OK" } - -re ".*$gdb_prompt $" { - fail "wrong message" - } - timeout { - fail "(timeout) 2" - } } } - -re "Type commands.*End with.*\[\r\n\] >$" { - fail "prompt not OK" - } - -re ".*$gdb_prompt $" { - fail "commands" - } - timeout { fail "(timeout) 3" } } - - gdb_stop_suppressing_tests } @@ -480,20 +592,22 @@ proc_with_prefix temporary_breakpoint_commands {} { # Test that GDB can handle $arg0 outside of user functions without # crashing. proc_with_prefix stray_arg0_test { } { + global valnum_re + gdb_test "print \$arg0" \ - "\\\$\[0-9\]* = void" \ + "$valnum_re = void" \ "#1" gdb_test "if 1 == 1\nprint \$arg0\nend" \ - "\\\$\[0-9\]* = void" \ + "$valnum_re = void" \ "#2" gdb_test "print \$arg0 = 1" \ - "\\\$\[0-9\]* = 1" \ + "$valnum_re = 1" \ "#3" gdb_test "print \$arg0" \ - "\\\$\[0-9\]* = 1" \ + "$valnum_re = 1" \ "#4" } @@ -685,7 +799,14 @@ proc_with_prefix error_clears_commands_left {} { gdb_test_no_output "end" "main commands 2c" gdb_run_cmd - gdb_test "" "hook-stop1\r\n.*\r\ncmd1\r\nUndefined command: \"errorcommandxy\"\\. Try \"help\"\\." "cmd1 error" + gdb_test \ + "" \ + [multi_line \ + "hook-stop1" \ + ".*" \ + "cmd1" \ + "Undefined command: \"errorcommandxy\"\\. Try \"help\"\\."] \ + "cmd1 error" gdb_test {echo idle\n} "\r\nidle" "no cmd2" } @@ -693,13 +814,20 @@ proc_with_prefix error_clears_commands_left {} { proc_with_prefix redefine_hook_test {} { global gdb_prompt - gdb_test "define one\nend" \ - "" \ - "define one" + gdb_test \ + [multi_line_input \ + "define one"\ + "end"] \ + "" \ + "define one" - gdb_test "define hook-one\necho hibob\\n\nend" \ - "" \ - "define hook-one" + gdb_test \ + [multi_line_input \ + "define hook-one" \ + "echo hibob\\n" \ + "end"] \ + "" \ + "define hook-one" set test "redefine one" gdb_test_multiple "define one" $test { @@ -713,13 +841,9 @@ proc_with_prefix redefine_hook_test {} { } } - gdb_test "end" \ - "" \ - "enter commands for one redefinition" + gdb_test "end" "" "enter commands for one redefinition" - gdb_test "one" \ - "hibob" \ - "execute one command" + gdb_test "one" "hibob" "execute one command" } proc_with_prefix redefine_backtrace_test {} { @@ -737,16 +861,15 @@ proc_with_prefix redefine_backtrace_test {} { } } - gdb_test "echo hibob\\n\nend" \ - "" \ - "enter commands" + gdb_test \ + [multi_line_input \ + "echo hibob\\n" \ + "end"] \ + "" \ + "enter commands" - gdb_test "backtrace" \ - "hibob" \ - "execute backtrace command" - gdb_test "bt" \ - "hibob" \ - "execute bt command" + gdb_test "backtrace" "hibob" "execute backtrace command" + gdb_test "bt" "hibob" "execute bt command" } gdbvar_simple_if_test diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 735ed11..e1e9880 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -117,6 +117,10 @@ set octal "\[0-7\]+" set inferior_exited_re "(\\\[Inferior \[0-9\]+ \\(.*\\) exited)" +# A regular expression that matches a value history number. +# E.g., $1, $2, etc. +set valnum_re "\\\$$decimal" + ### Only procedures should come after this point. # @@ -6005,5 +6009,14 @@ proc multi_line { args } { return [join $args "\r\n"] } +# Similar to the above, but while multi_line is meant to be used to +# match GDB output, this one is meant to be used to build strings to +# send as GDB input. + +proc multi_line_input { args } { + return [join $args "\n"] +} + + # Always load compatibility stuff. load_lib future.exp