Fix argument passing in mi_run_cmd_full
authorSimon Marchi <simon.marchi@ericsson.com>
Tue, 13 May 2014 21:37:44 +0000 (17:37 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Thu, 15 May 2014 19:45:51 +0000 (15:45 -0400)
Passing arguments did not work when use_mi_command was set.

gdb/testsuite/ChangeLog:
2014-05-13  Simon Marchi  <simon.marchi@ericsson.com>

* lib/mi-support.exp (mi_run_cmd_full): Set arguments by calling
"-exec-arguments" or "set args" before running the inferior.

gdb/testsuite/ChangeLog
gdb/testsuite/lib/mi-support.exp

index aaab227c1e3b0b1b5b860c365eeddf267de8439f..486a4e21f7e916c5e2035dedcd5d101d0ba97e1f 100644 (file)
@@ -1,3 +1,9 @@
+2014-05-15  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * lib/mi-support.exp (mi_run_cmd_full): Set arguments by
+       calling "-exec-arguments" or "set args" before running the
+       inferior.
+
 2014-05-15  Simon Marchi  <simon.marchi@ericsson.com>
 
        * lib/mi-support.exp (mi_expect_stop): Expect message for
index 4478ba0b045786bd3af3eddbadb32b7d61a6d868..10540388ebd6fd5e7855ea7764350e4f72289c74 100644 (file)
@@ -818,9 +818,11 @@ proc mi_run_cmd_full {use_mi_command args} {
     if {$use_mi_command} {
        set run_prefix "220-exec-"
        set run_match "220"
+       set set_args_cmd "-exec-arguments"
     } else {
        set run_prefix ""
        set run_match ""
+       set set_args_cmd "set args"
     }
 
     if [target_info exists gdb_init_command] {
@@ -862,7 +864,16 @@ proc mi_run_cmd_full {use_mi_command args} {
        return 0
     }
 
-    send_gdb "${run_prefix}run $args\n"
+    send_gdb "${set_args_cmd} $args\n"
+    gdb_expect {
+       -re "$mi_gdb_prompt$" { }
+       default {
+           perror "settings args failed"
+           return -1
+       }
+    }
+
+    send_gdb "${run_prefix}run\n"
     gdb_expect {
        -re "${run_match}\\^running\r\n(\\*running,thread-id=\"\[^\"\]+\"\r\n|=thread-created,id=\"1\",group-id=\"\[0-9\]+\"\r\n)*(${library_loaded_re})*(${thread_selected_re})?${mi_gdb_prompt}" {
        }