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]

[PATCH v2] Fixes to gdb.mi testsuite


This is the updated version of the patch submitted in this thread:
http://sourceware.org/ml/gdb-patches/2013-05/msg00971.html

It contains two fixes to the gdb.mi testsuite:

* Add support for args to mi_run_to_main (and the commands that it
  depends on, mi_runto, mi_runto_helper). mi_run_cmd_full already
  supported arguments, but it didn't work when use_mi_command was set.

* Fix mi_expect_stop for inferiors that exit with non-zero exit codes.
  The message is a little bit different when the inferior exits with
  zero and non-zero values, so mi_expect_stop must take that into
  account.

Thanks,

Simon

gdb/testsuite/ChangeLog:
2013-06-17  Simon Marchi  <simon.marchi@ericsson.com>

	* lib/mi-support.exp (mi_run_to_main): Add "args" parameter.
	(mi_runto): Idem.
	(mi_runto_helper): Idem.
	(mi_run_cmd_full): Call -exec-arguments or set args before
	running inferior.
	(mi_expect_stop): Expect message for inferiors that exit with
	non-zero exit code.
---
 gdb/testsuite/lib/mi-support.exp | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 86a0fd6..07fe4f8 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -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}" {
 	}
@@ -882,7 +885,7 @@ proc mi_run_with_cli {args} {
 # Just like run-to-main but works with the MI interface
 #

-proc mi_run_to_main { } {
+proc mi_run_to_main {args} {
     global suppress_flag
     if { $suppress_flag } {
 	return -1
@@ -896,8 +899,7 @@ proc mi_run_to_main { } {
     mi_delete_breakpoints
     mi_gdb_reinitialize_dir $srcdir/$subdir
     mi_gdb_load ${binfile}
-
-    mi_runto main
+    eval mi_runto main $args
 }


@@ -911,7 +913,7 @@ proc mi_run_to_main { } {
 #   -1  if test suppressed, failed, timedout
 #    0  if test passed

-proc mi_runto_helper {func run_or_continue} {
+proc mi_runto_helper {func run_or_continue args} {
   global suppress_flag
   if { $suppress_flag } {
     return -1
@@ -931,7 +933,7 @@ proc mi_runto_helper {func run_or_continue} {
   }

   if {$run_or_continue == "run"} {
-      if { [mi_run_cmd] < 0 } {
+      if { [eval mi_run_cmd $args] < 0 } {
 	  return -1
       }
   } else {
@@ -941,8 +943,8 @@ proc mi_runto_helper {func run_or_continue} {
mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } $test
 }

-proc mi_runto {func} {
-    return [mi_runto_helper $func "run"]
+proc mi_runto {func args} {
+    return [eval mi_runto_helper $func "run" $args]
 }

 # Next to the next statement
@@ -1055,6 +1057,20 @@ proc mi_expect_stop { reason func args file line extra test } {
         return
     }

+    if { $reason == "exited" } {
+
+        gdb_expect {
+ -re "\\*stopped,reason=\"exited\",exit-code=\"\[0-7\]+\"\r\n$prompt_re" {
+            pass "$test"
+          }
+          -re ".*$mi_gdb_prompt$" {fail "continue to end (2)"}
+          timeout {
+              fail "$test (unknown output after running)"
+          }
+        }
+        return
+    }
+
     set args "\\\[$args\\\]"

     set bn ""


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