This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][PATCH] Fixes to gdb.mi testsuite


On 13-05-29 04:57 AM, Yao Qi wrote:
Hi, Simon,

On 05/29/2013 03:50 AM, Simon Marchi wrote:
2013-05-28  Simon Marchi<simon.marchi@ericsson.com>

      * gdb/testsuite/lib/mi-support.exp (mi_run_to_main): add "args"
        parameter.

Each line of changelog entry is started by a tab. The description should be a sentence, so capitalize "a" in "add".

You can reference this wiki page
http://sourceware.org/gdb/wiki/ContributionChecklist#Properly_Formatted_GNU_ChangeLog

Noted.

      (mi_runto): Idem.
      (mi_runto_helper): Idem.
      (mi_run_cmd_full): Call -exec-arguments to set args before
        running inferior if use_mi_command is set.

Thanks,

Simon

diff --git a/gdb/testsuite/lib/mi-support.exp
b/gdb/testsuite/lib/mi-support.exp
index 50b926f..db8ae1a 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -846,6 +846,20 @@ proc mi_run_cmd_full {use_mi_command args} {
       return 0
       }

+    if {$use_mi_command} {
+    if { [llength $args] > 0 } {
+        send_gdb "-exec-arguments $args\n"
+        gdb_expect {
+        -re "=cmd-param-changed,param=\"args\",value=.*" {

MI notification =cmd-param-changed is not suppressed by mistake in GDB. I've post a patch <http://sourceware.org/ml/gdb-patches/2013-05/msg00976.html> to fix it. Once it is committed, this part can simplified.
Thanks.

+        }
+        default {
+            fail "-exec-arguments output not matched"
+            return -1
+        }
+        }
+    }
+    }
+
       send_gdb "${run_prefix}run $args\n"

Looks the $args are passed to -exec-run command, but -exec-run command doesn't pass args to the inferior. See mi/mi-main.c:mi_cmd_exec_run. If we can teach MI command -exec-run pass argument to inferior (not sure it is a good idea or not), we don't have to use -exec-arguments here.
When $use_mi_command is false, then the command is simply "run" (${run_prefix} is empty), which passes the arguments to the inferior. However, we could do something like this, which is cleaner:

@@ -803,9 +803,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] {
@@ -846,7 +848,8 @@ 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"
+    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}" {
     }


What do you think? I left out the check for "llength $args > 0". If no args are passed to mi_run_cmd_full, we want to make sure to erase any arguments that could have been set previously. Also, should I use gdb_test_no_output instead of send_gdb for -exec-arguments and set args?

Thanks,

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]