2005-09-27 Bob Rossi <bob@brasko.net>
authorBob Rossi <bob@brasko.net>
Tue, 27 Sep 2005 22:39:04 +0000 (22:39 +0000)
committerBob Rossi <bob@brasko.net>
Tue, 27 Sep 2005 22:39:04 +0000 (22:39 +0000)
        * gdb.mi/mi-disassemble.exp, gdb.mi/mi2-disassemble.exp: Remove .*
        from test.  Escape the | in mi_gdb_test call.
        * gdb.mi/mi-basics.exp, gdb.mi/mi-cli.exp, gdb.mi/mi-disassemble.exp,
        gdb.mi/mi-pthreads.exp, gdb.mi/mi-stack.exp, gdb.mi/mi2-basics.exp,
        gdb.mi/mi2-cli.exp, gdb.mi/mi2-disassemble.exp,
        gdb.mi/mi2-pthreads.exp, gdb.mi/mi2-stack.exp: Add extra details to
        expected regex's in mi_gdb_test calls.
        * lib/mi-support.exp: Remove arbitrary .* from tests.
        (mi_gdb_test): Add string_regex variable. Add anchor to main -re.
        Fully anchor GDB/MI expected results in mi_gdb_test.
        * lib/gdb.exp (string_to_regexp): Escape the ] character.
        * gdb.base/sizeof.exp: Remove escape character. Correct test.

14 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/sizeof.exp
gdb/testsuite/gdb.mi/mi-basics.exp
gdb/testsuite/gdb.mi/mi-cli.exp
gdb/testsuite/gdb.mi/mi-disassemble.exp
gdb/testsuite/gdb.mi/mi-pthreads.exp
gdb/testsuite/gdb.mi/mi-stack.exp
gdb/testsuite/gdb.mi/mi2-basics.exp
gdb/testsuite/gdb.mi/mi2-cli.exp
gdb/testsuite/gdb.mi/mi2-disassemble.exp
gdb/testsuite/gdb.mi/mi2-pthreads.exp
gdb/testsuite/gdb.mi/mi2-stack.exp
gdb/testsuite/lib/gdb.exp
gdb/testsuite/lib/mi-support.exp

index f4a78614d8ba6bed405bff204ca5980aa50fe4ed..5e5ce895440975a7af267ba3501289eb1287dcae 100644 (file)
@@ -1,3 +1,18 @@
+2005-09-27  Bob Rossi  <bob@brasko.net>
+
+       * gdb.mi/mi-disassemble.exp, gdb.mi/mi2-disassemble.exp: Remove .* 
+       from test.  Escape the | in mi_gdb_test call.
+       * gdb.mi/mi-basics.exp, gdb.mi/mi-cli.exp, gdb.mi/mi-disassemble.exp,
+       gdb.mi/mi-pthreads.exp, gdb.mi/mi-stack.exp, gdb.mi/mi2-basics.exp,
+       gdb.mi/mi2-cli.exp, gdb.mi/mi2-disassemble.exp,
+       gdb.mi/mi2-pthreads.exp, gdb.mi/mi2-stack.exp: Add extra details to
+       expected regex's in mi_gdb_test calls.
+       * lib/mi-support.exp: Remove arbitrary .* from tests.
+       (mi_gdb_test): Add string_regex variable. Add anchor to main -re.
+       Fully anchor GDB/MI expected results in mi_gdb_test.
+       * lib/gdb.exp (string_to_regexp): Escape the ] character.
+       * gdb.base/sizeof.exp: Remove escape character. Correct test.
+
 2005-09-26  Paul Brook  <paul@codesourcery.com>
 
        * long_long.exp: Exclude eabi targets from arm FPA float format test.
index b10ffbc13e88e8aed266da44d37af47f84966fe1..93291342413dea5f7749a714608a575f8ca99c73 100644 (file)
@@ -1,6 +1,6 @@
 # This testcase is part of GDB, the GNU debugger.
 
-# Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2000, 2002, 2003, 2004, 2005 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
@@ -131,7 +131,7 @@ set signof_char [get_valueof "/d" "(int) (char) -1" -1]
 set signof_signed_char [get_valueof "/d" "(int) (signed char) -1" -1]
 set signof_unsigned_char [get_valueof "/d" "(int) (unsigned char) -1" -1]
 
-check_valueof "'\\\\377'" ${signof_byte}
+check_valueof "'\\377'" ${signof_byte}
 check_valueof "(int) (char) -1" ${signof_char}
 check_valueof "(int) (signed char) -1" ${signof_signed_char}
 check_valueof "(int) (unsigned char) -1" ${signof_unsigned_char}
index 7e576a7077c23cba163d2ed770bc293691a1b2df..f6e82b095a094b78dec4eec5c06ed9265b4dc0c1 100644 (file)
@@ -138,7 +138,7 @@ proc test_breakpoints_deletion {} {
 
     # The all parameter is actually no parameter.
     mi_gdb_test "200-break-delete" \
-             "\\\^done" \
+             "200\\\^done" \
              "break-delete (all) operation"
 
     mi_gdb_test "201-break-list" \
@@ -168,7 +168,7 @@ proc test_dir_specification {} {
              "environment-directory empty-string operation"
 
     mi_gdb_test "204-environment-directory -r" \
-             "\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \
+             "204\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \
              "environment-directory operation"
 }
 
@@ -184,11 +184,11 @@ proc test_cwd_specification {} {
     # -environment-pwd
 
     mi_gdb_test "205-environment-cd ${objdir}" \
-             "\\\^done" \
+             "205\\\^done" \
              "environment-cd arg operation"
 
     mi_gdb_test "206-environment-pwd" \
-             "\\\^done,cwd=\"${escapedobjdir}\"" \
+             "206\\\^done,cwd=\"${escapedobjdir}\"" \
              "environment-pwd operation"
 }
 
@@ -219,7 +219,7 @@ proc test_path_specification {} {
     }
 
     mi_gdb_test "207-environment-path" \
-             "\\\^done,path=\"$orig_path\"" \
+             "207\\\^done,path=\"$orig_path\"" \
              "environment-path no-args operation"
 
     mi_gdb_test "208-environment-path $srcdir $objdir" \
@@ -227,11 +227,11 @@ proc test_path_specification {} {
              "environment-path dir1 dir2 operation"
 
     mi_gdb_test "209-environment-path -r $objdir" \
-             "\\\^done,path=\"$escapedobjdir.$orig_path\"" \
+             "209\\\^done,path=\"$escapedobjdir.$orig_path\"" \
              "environment-path -r dir operation"
 
     mi_gdb_test "210-environment-path -r" \
-             "\\\^done,path=\"$orig_path\"" \
+             "210\\\^done,path=\"$orig_path\"" \
              "environment-path -r operation"
 
 } 
index b2159590fc38fc51fd1e1c5c85634b2c9522b06b..1293c346d7caf42c5890efd1089b7b0786ecb2e3 100644 (file)
@@ -59,7 +59,7 @@ mi_gdb_test "-interpreter-exec console bogus" \
 #   {(=.*)+\^done} \
 #   "-interpreter-exec console \"file \$binfile\""
 mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
-  {\^done} \
+  {~"Reading symbols from .*basics...".*done} \
   "-interpreter-exec console \"file \$binfile\""
 
 mi_run_to_main
@@ -125,7 +125,7 @@ mi_gdb_test "100-interpreter-exec console \"delete 2\"" \
 #   {.*=selected-frame-level-changed,level="1".*\^done} \
 #   "-interpreter-exec console \"up\""
 mi_gdb_test "200-interpreter-exec console \"up\"" \
-  {200\^done} \
+  {~"#.*".*200\^done} \
   "-interpreter-exec console \"up\""
 
 # NOTE: cagney/2003-02-03: Not yet.
@@ -133,7 +133,7 @@ mi_gdb_test "200-interpreter-exec console \"up\"" \
 #   {.*=selected-frame-level-changed,level="0".*\^done} \
 #   "-interpreter-exec console \"down\""
 mi_gdb_test "300-interpreter-exec console \"down\"" \
-  {300\^done} \
+  {~"#.*".*300\^done} \
   "-interpreter-exec console \"down\""
 
 # NOTE: cagney/2003-02-03: Not yet.
@@ -141,7 +141,7 @@ mi_gdb_test "300-interpreter-exec console \"down\"" \
 #   {.*=selected-frame-level-changed,level="2".*\^done} \
 #   "-interpreter-exec console \"frame 2\""
 mi_gdb_test "400-interpreter-exec console \"frame 2\"" \
-  {400\^done} \
+  {~"#.*".*400\^done} \
   "-interpreter-exec console \"frame 2\""
 
 # NOTE: cagney/2003-02-03: Not yet.
index 0b124976a7e7e75471fea9251117b5b0e0e1e690..625c430cdd485f7e2fabba3afbcad7c305b3126e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004, 2005 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
@@ -163,19 +163,19 @@ proc test_disassembly_bogus_args {} {
     # -data-disassembly -f basics.c -l 32 -- 9
 
     mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \
-             ".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
+             "&.*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
              "data-disassemble bogus filename"
 
     mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \
-             "321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
+             "&.*321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
              "data-disassemble bogus address"
 
     mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \
-             "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
+             "&.*456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
              "data-disassemble mix different args"
 
     mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
-             "789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
+             "&.*789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
              "data-disassemble wrong mode arg"
 
 }
index be1864798fcb667a1ee6a67c65fa6153c21b0804..64b31b0d1b15d19067a93eff13a4779ccc252906 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2002, 2003, 2004, 2005 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
@@ -187,7 +187,7 @@ proc check_mi_thread_command_set {} {
     "check_mi_thread_command_set: -thread-select"
 
   mi_gdb_test "-thread-select 123456789" \
-    {\^error,msg="Thread ID 123456789 not known\."} \
+    {&.*\^error,msg="Thread ID 123456789 not known\."} \
     "check_mi_thread_command_set: -thread-select 123456789"
 
   foreach thread $thread_list {
index 05ec32db3d09aad496227e5a0f1a86158cd4eeee..962b25f222eaf4ad851d4038c94e5b4a04f2253e 100644 (file)
@@ -68,7 +68,7 @@ proc test_stack_frame_listing {} {
                 "stack frame listing 1 3"
 
     mi_gdb_test "234-stack-list-frames 1" \
-           "234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
+           "&.*234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
            "stack frame listing wrong"
 
     mi_gdb_test "235-stack-info-frame" \
@@ -115,7 +115,7 @@ proc test_stack_args_listing {} {
                 "stack args listing 1 1 3"
 
     mi_gdb_test "234-stack-list-arguments" \
-           "234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
+           "&.*234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
            "stack args listing wrong"
 }
 
@@ -142,7 +142,7 @@ proc test_stack_info_depth {} {
                 "stack info-depth 99"
 
     mi_gdb_test "231-stack-info-depth 99 99" \
-           "231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
+           "&.*231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
                 "stack info-depth wrong usage"
 }
 
@@ -181,7 +181,7 @@ gdb_expect {
   "stack locals listing, simple types: names and values, complex type: names and types"
 
     mi_gdb_test "234-stack-list-locals" \
-           "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
+           "&.*234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
            "stack locals listing wrong"
 
     mi_gdb_test "232-stack-select-frame 1" \
index 0fd1c87e157e8b6ca300955d15d330dc27c74a7c..bde6e94d0e178b64b2d7147f6989bcae714b2375 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2003, 2004
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -139,7 +139,7 @@ proc test_breakpoints_deletion {} {
 
     # The all parameter is actually no parameter.
     mi_gdb_test "200-break-delete" \
-             "\\\^done" \
+             "200\\\^done" \
              "break-delete (all) operation"
 
     mi_gdb_test "201-break-list" \
@@ -169,7 +169,7 @@ proc test_dir_specification {} {
              "environment-directory empty-string operation"
 
     mi_gdb_test "204-environment-directory -r" \
-             "\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \
+             "204\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \
              "environment-directory operation"
 
 #exp_internal 0
@@ -187,11 +187,11 @@ proc test_cwd_specification {} {
     # -environment-pwd
 
     mi_gdb_test "205-environment-cd ${objdir}" \
-             "\\\^done" \
+             "205\\\^done" \
              "environment-cd arg operation"
 
     mi_gdb_test "206-environment-pwd" \
-             "\\\^done,cwd=\"${escapedobjdir}\"" \
+             "206\\\^done,cwd=\"${escapedobjdir}\"" \
              "environment-pwd operation"
 }
 
@@ -222,7 +222,7 @@ proc test_path_specification {} {
     }
 
     mi_gdb_test "207-environment-path" \
-             "\\\^done,path=\"$orig_path\"" \
+             "207\\\^done,path=\"$orig_path\"" \
              "environment-path no-args operation"
 
     mi_gdb_test "208-environment-path $srcdir $objdir" \
@@ -230,11 +230,11 @@ proc test_path_specification {} {
              "environment-path dir1 dir2 operation"
 
     mi_gdb_test "209-environment-path -r $objdir" \
-             "\\\^done,path=\"$escapedobjdir.$orig_path\"" \
+             "209\\\^done,path=\"$escapedobjdir.$orig_path\"" \
              "environment-path -r dir operation"
 
     mi_gdb_test "210-environment-path -r" \
-             "\\\^done,path=\"$orig_path\"" \
+             "210\\\^done,path=\"$orig_path\"" \
              "environment-path -r operation"
 
 } 
index 47e909ea9d278325728108581f91f3a5863b9224..ae778d1c0d532b06cb8091e1441253f8515e6fe4 100644 (file)
@@ -59,7 +59,7 @@ mi_gdb_test "-interpreter-exec console bogus" \
 #   {(=.*)+\^done} \
 #   "-interpreter-exec console \"file \$binfile\""
 mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
-  {\^done} \
+  {~"Reading symbols from .*basics...".*\^done} \
   "-interpreter-exec console \"file \$binfile\""
 
 mi_run_to_main
@@ -125,7 +125,7 @@ mi_gdb_test "100-interpreter-exec console \"delete 2\"" \
 #   {.*=selected-frame-level-changed,level="1".*\^done} \
 #   "-interpreter-exec console \"up\""
 mi_gdb_test "200-interpreter-exec console \"up\"" \
-  {200\^done} \
+  {~"#.*".*200\^done} \
   "-interpreter-exec console \"up\""
 
 # NOTE: cagney/2003-02-03: Not yet.
@@ -133,7 +133,7 @@ mi_gdb_test "200-interpreter-exec console \"up\"" \
 #   {.*=selected-frame-level-changed,level="0".*\^done} \
 #   "-interpreter-exec console \"down\""
 mi_gdb_test "300-interpreter-exec console \"down\"" \
-  {300\^done} \
+  {~"#.*".*300\^done} \
   "-interpreter-exec console \"down\""
 
 # NOTE: cagney/2003-02-03: Not yet.
@@ -141,7 +141,7 @@ mi_gdb_test "300-interpreter-exec console \"down\"" \
 #   {.*=selected-frame-level-changed,level="2".*\^done} \
 #   "-interpreter-exec console \"frame 2\""
 mi_gdb_test "400-interpreter-exec console \"frame 2\"" \
-  {400\^done} \
+  {~"#.*".*400\^done} \
   "-interpreter-exec console \"frame 2\""
 
 # NOTE: cagney/2003-02-03: Not yet.
index a56b027ee215acdd18357be7133e93081635c4de..b79a9c09e2197b072fdea93ef61a634917f6d857 100644 (file)
@@ -1,4 +1,5 @@
-# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# 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
@@ -163,19 +164,19 @@ proc test_disassembly_bogus_args {} {
     # -data-disassembly -f basics.c -l 32 -- 9
 
     mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \
-             ".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
+             "&.*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
              "data-disassemble bogus filename"
 
     mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \
-             "321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
+             "&.*321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
              "data-disassemble bogus address"
 
     mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \
-             "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
+             "&.*456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
              "data-disassemble mix different args"
 
     mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
-             "789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
+             "&.*789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
              "data-disassemble wrong mode arg"
 
 }
index 4067883b34fb1013ad27692b0c3091e6601ed25f..b2efeed7ed7d93e349cb88d1d7fb8062da571255 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2002, 2003, 2004, 2005 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
@@ -187,7 +187,7 @@ proc check_mi_thread_command_set {} {
     "check_mi_thread_command_set: -thread-select"
 
   mi_gdb_test "-thread-select 123456789" \
-    {\^error,msg="Thread ID 123456789 not known\."} \
+    {&.*\^error,msg="Thread ID 123456789 not known\."} \
     "check_mi_thread_command_set: -thread-select 123456789"
 
   foreach thread $thread_list {
index 80e82b6e99661da1c9d36b1be79c4c1d2fb82f8d..9199266bfa23c28dcd20e004cd4d936a58184c09 100644 (file)
@@ -68,7 +68,7 @@ proc test_stack_frame_listing {} {
                 "stack frame listing 1 3"
 
     mi_gdb_test "234-stack-list-frames 1" \
-           "234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
+           "&.*234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
            "stack frame listing wrong"
 
     mi_gdb_test "235-stack-info-frame" \
@@ -115,7 +115,7 @@ proc test_stack_args_listing {} {
                 "stack args listing 1 1 3"
 
     mi_gdb_test "234-stack-list-arguments" \
-           "234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
+           "&.*234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
            "stack args listing wrong"
 }
 
@@ -142,7 +142,7 @@ proc test_stack_info_depth {} {
                 "stack info-depth 99"
 
     mi_gdb_test "231-stack-info-depth 99 99" \
-           "231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
+           "&.*231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
                 "stack info-depth wrong usage"
 }
 
@@ -176,7 +176,7 @@ gdb_expect {
                 "stack locals listing 1"
 
     mi_gdb_test "234-stack-list-locals" \
-           "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
+           "&.*234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
            "stack locals listing wrong"
 
     mi_gdb_test "232-stack-select-frame 1" \
index c2c0b1536813956d2dadd95fbb87e14fbfe0eec4..cfddc99dbd7dc496785a905f8488e380ca195611 100644 (file)
@@ -1,5 +1,5 @@
 # Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004
+# 2002, 2003, 2004, 2005
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -864,7 +864,7 @@ proc test_print_reject { args } {
 
 proc string_to_regexp {str} {
     set result $str
-    regsub -all {[]*+.|()^$\[]} $str {\\&} result
+    regsub -all {[]*+.|()^$\[\\]} $str {\\&} result
     return $result
 }
 
index 4c1d577227106ce0fb2ec11cb28adb0f7aaf2825..fa99c53f255ce16969e9543a748328cfb4dc7ca7 100644 (file)
@@ -246,7 +246,7 @@ proc mi_delete_breakpoints {} {
            send_gdb "y\n";
            exp_continue
          }
-        -re ".*102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" {
+        -re "102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" {
             # This happens if there were no breakpoints
         }
         timeout { perror "Delete all breakpoints in mi_delete_breakpoints (timeout)" ; return }
@@ -596,6 +596,8 @@ proc mi_gdb_test { args } {
 
     set result -1
     set string "${command}\n";
+    set string_regex [string_to_regexp $command]
+
     if { $command != "" } {
        while { "$string" != "" } {
            set foo [string first "\n" "$string"];
@@ -659,7 +661,11 @@ proc mi_gdb_test { args } {
            gdb_start
            set result -1
        }
-        -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*" {
+        -re "^($string_regex\[\r\n\]+)?($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)" {
+           # At this point, $expect_out(1,string) is the MI input command.
+           # and $expect_out(2,string) is the MI output command.
+           # If $expect_out(1,string) is "", then there was no MI input command here.
+
            # NOTE, there is no trailing anchor because with GDB/MI, 
            # asynchronous responses can happen at any point, causing more 
            # data to be available.  Normally an anchor is used to make 
@@ -925,11 +931,11 @@ proc mi_execute_to_helper { cmd reason func args file line extra test } {
     global fullname_syntax
     send_gdb "220-$cmd\n"
     gdb_expect {
-       -re ".*220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$extra\r\n$mi_gdb_prompt$" {
+       -re "220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$extra\r\n$mi_gdb_prompt$" {
            pass "$test"
            return 0
        }
-       -re ".*220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" {
+       -re "220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" {
            fail "$test (stopped at wrong place)"
            return -1
        }