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]

[rfc] Simplify gdb remote / simulator testing


Someone (Aman, I think) recently reminded me on gdb@ about this
problem.  There's a lot of inefficiency in testing gdbserver based on
the fact that gdb_load starts the server and connects, instead of just
issuing a "file" command.  So this patch rearranges things until
gdb_run_cmd does this instead.

I only rearranged gdbserver for the non-MI tests, but did the
equivalent fix to all of the supported targets for the MI tests - the
problem there is that the gdb_load bits are specific to each target
and hard to adjust.  It would not be too hard to fix the other targets
either based on the new gdb_reload hook.

The advantages of this patch are (A) efficiency during testing, and
(B) once the rest of config is converted, tests can assume that the
target isn't "running" after gdb_load, which has been a problem with
writing new tests.

I tested ARM using remote gdbserver, ARM using the in-tree simulator,
and x86_64-linux native.  I'm fairly confident I got this right, but
I'll leave it for a little while in case any interested parties
want to comment :-)

-- 
Daniel Jacobowitz
CodeSourcery

2007-02-26  Daniel Jacobowitz  <dan@codesourcery.com>

	* config/gdbserver.exp (gdbserver_gdb_load): Update argument list.
	(gdb_load): Delete, replace with...
	(gdb_reload): ...this.
	* gdb.server/server-run.exp: Use gdb_load and gdbserver_run.
	* lib/gdb.exp (gdb_run_cmd): Use gdb_reload.
	(gdb_file_cmd): Save the last loaded file.
	(gdb_reload): New.
	(gdb_gnu_strip_debug): Use transform.
	* lib/gdbserver-support.exp (gdbserver_spawn): Move file download
	support here.  Use new $last_loaded_file.  Check mtime.
	(infer_host_exec): Delete.
	(gdbserver_load): Rename to...
	(gdbserver_run): ...this.  Simplify.
	* lib/mi-support.exp (mi_gdb_file_cmd): Set last_loaded_file.
	(mi_gdb_load): Move most contents to a new function...
	(mi_gdb_target_load): ...here.  Simplify call to gdbserver_gdb_load.
	(mi_run_cmd): Use mi_gdb_target_load.
	* gdb.base/break.exp, gdb.base/ending-run.exp,
	gdb.base/sepdebug.exp: Use gdb_run_cmd.

---
 gdb/testsuite/config/gdbserver.exp      |    8 +--
 gdb/testsuite/gdb.base/break.exp        |   85 +++++++++-----------------------
 gdb/testsuite/gdb.base/ending-run.exp   |    8 +--
 gdb/testsuite/gdb.base/sepdebug.exp     |   85 +++++++++-----------------------
 gdb/testsuite/gdb.server/server-run.exp |    3 -
 gdb/testsuite/lib/gdb.exp               |   27 +++++++---
 gdb/testsuite/lib/gdbserver-support.exp |   85 +++++++++++++-------------------
 gdb/testsuite/lib/mi-support.exp        |   55 +++++++-------------
 8 files changed, 137 insertions(+), 219 deletions(-)

Index: src/gdb/testsuite/config/gdbserver.exp
===================================================================
--- src.orig/gdb/testsuite/config/gdbserver.exp	2007-02-26 09:45:57.000000000 -0500
+++ src/gdb/testsuite/config/gdbserver.exp	2007-02-26 09:46:03.000000000 -0500
@@ -74,10 +74,10 @@
 
 load_lib gdbserver-support.exp
 
-proc gdbserver_gdb_load { arg } {
-    return [gdbserver_spawn $arg ""]
+proc gdbserver_gdb_load { } {
+    return [gdbserver_spawn ""]
 }
 
-proc gdb_load { arg } {
-    return [gdbserver_load $arg ""]
+proc gdb_reload { } {
+    return [gdbserver_run ""]
 }
Index: src/gdb/testsuite/gdb.server/server-run.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.server/server-run.exp	2007-02-26 09:45:57.000000000 -0500
+++ src/gdb/testsuite/gdb.server/server-run.exp	2007-02-26 09:46:03.000000000 -0500
@@ -34,8 +34,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/
 
 gdb_exit
 gdb_start
+gdb_load $binfile
 
-gdbserver_load $binfile ""
+gdbserver_run ""
 gdb_reinitialize_dir $srcdir/$subdir
 
 gdb_breakpoint main
Index: src/gdb/testsuite/lib/gdb.exp
===================================================================
--- src.orig/gdb/testsuite/lib/gdb.exp	2007-02-26 09:45:57.000000000 -0500
+++ src/gdb/testsuite/lib/gdb.exp	2007-02-26 10:01:40.000000000 -0500
@@ -203,9 +203,7 @@ proc gdb_run_cmd {args} {
 
     if [target_info exists use_gdb_stub] {
 	if [target_info exists gdb,do_reload_on_run] {
-	    # Specifying no file, defaults to the executable
-	    # currently being debugged.
-	    if { [gdb_load ""] != 0 } {
+	    if { [gdb_reload] != 0 } {
 		return;
 	    }
 	    send_gdb "continue\n";
@@ -250,7 +248,7 @@ proc gdb_run_cmd {args} {
 		    send_gdb "y\n"
 		}
 		-re "The program is not being run.*$gdb_prompt $" {
-		    if { [gdb_load ""] != 0 } {
+		    if { [gdb_reload] != 0 } {
 			return;
 		    }
 		    send_gdb "jump *$start\n";
@@ -272,7 +270,7 @@ proc gdb_run_cmd {args} {
     }
 
     if [target_info exists gdb,do_reload_on_run] {
-	if { [gdb_load ""] != 0 } {
+	if { [gdb_reload] != 0 } {
 	    return;
 	}
     }
@@ -999,6 +997,9 @@ proc gdb_file_cmd { arg } {
     global gdb_prompt
     global verbose
     global GDB
+    global last_loaded_file
+
+    set last_loaded_file $arg
 
     # Set whether debug info was found.
     # Default to "fail".
@@ -1935,6 +1936,18 @@ proc gdb_load { arg } {
     return [gdb_file_cmd $arg]
 }
 
+# gdb_reload -- load a file into the target.  Called before "running",
+# either the first time or after already starting the program once,
+# for remote targets.  Most files that override gdb_load should now
+# override this instead.
+
+proc gdb_reload { } {
+    # For the benefit of existing configurations, default to gdb_load.
+    # Specifying no file defaults to the executable currently being
+    # debugged.
+    return [gdb_load ""]
+}
+
 proc gdb_continue { function } {
     global decimal
 
@@ -2379,8 +2392,8 @@ proc gdb_gnu_strip_debug { dest args } {
     gdb_exit
 
     set debug_file [separate_debug_filename $dest]
-    set strip_to_file_program strip
-    set objcopy_program objcopy
+    set strip_to_file_program [transform strip]
+    set objcopy_program [transform objcopy]
 
     # Make sure the directory that will hold the separated debug
     # info actually exists.
Index: src/gdb/testsuite/lib/gdbserver-support.exp
===================================================================
--- src.orig/gdb/testsuite/lib/gdbserver-support.exp	2007-02-26 09:45:57.000000000 -0500
+++ src/gdb/testsuite/lib/gdbserver-support.exp	2007-02-26 09:46:03.000000000 -0500
@@ -129,8 +129,40 @@ proc skip_gdbserver_tests { } {
 #
 # Returns the target protocol and socket to connect to.
 
-proc gdbserver_spawn { server_exec child_args } {
+proc gdbserver_spawn { child_args } {
     global portnum
+    global gdbserver_host_exec
+    global gdbserver_host_mtime
+    global gdbserver_server_exec
+    global last_loaded_file
+
+    set host_exec $last_loaded_file
+
+    # If we already downloaded a file to the target, see if we can reuse it.
+    set reuse 0
+    if { [info exists gdbserver_server_exec] } {
+	set reuse 1
+
+	# If the file has changed, we can not.
+	if { $host_exec != $gdbserver_host_exec } {
+	    set reuse 0
+	}
+
+	# If the mtime has changed, we can not.
+	if { [file mtime $host_exec] != $gdbserver_host_mtime } {
+	    set reuse 0
+	}
+    }
+
+    if { $reuse == 0 } {
+	set gdbserver_host_exec $host_exec
+	set gdbserver_host_mtime [file mtime $host_exec]
+	if [is_remote target] {
+	    set gdbserver_server_exec [remote_download target $host_exec /tmp/[file tail $host_exec].[pid]]
+	} else {
+	    set gdbserver_server_exec $host_exec
+	}
+    }
 
     # Port id -- either specified in baseboard file, or managed here.
     if [target_info exists gdb,socketport] {
@@ -162,7 +194,7 @@ proc gdbserver_spawn { server_exec child
     # Fire off the debug agent.  This flavour of gdbserver takes as
     # arguments the port information, the name of the executable file to
     # be debugged, and any arguments.
-    set gdbserver_command "$gdbserver :$portnum $server_exec"
+    set gdbserver_command "$gdbserver :$portnum $gdbserver_server_exec"
     if { $child_args != "" } {
 	append gdbserver_command " $child_args"
     }
@@ -194,58 +226,13 @@ proc gdbserver_spawn { server_exec child
     return [list $protocol $gdbport]
 }
 
-proc infer_host_exec { } {
-    set host_exec ""
-
-    send_gdb "info files\n"
-    gdb_expect 30 {
-	-re "Symbols from \"(\[^\"\]+)\"" {
-	    set host_exec $expect_out(1,string)
-	    exp_continue
-	}
-	-re "Local exec file:\[\r\n\]+\[ \t\]*`(\[^'\]+)'," {
-	    set host_exec $expect_out(1,string)
-	    exp_continue
-	}
-	-re "$gdb_prompt $" { }
-    }
-
-    return $host_exec
-}
-
 # Start a gdbserver process running HOST_EXEC and pass CHILD_ARGS
 # to it.  Return 0 on success, or non-zero on failure.
 
-proc gdbserver_load { host_exec child_args } {
-    global gdbserver_host_exec
-    global gdbserver_server_exec
-
-    # If we weren't passed an explicit binary, try to reuse the current
-    # one.  If we were, be sure to redownload it.
-
-    if { $host_exec == "" && $gdbserver_host_exec == "" } {
-	set gdbserver_host_exec [infer_host_exec]
-    } elseif { $host_exec != "" } {
-	set gdbserver_host_exec $host_exec
-	if [info exists gdbserver_server_exec] { unset gdbserver_server_exec }
-    }
-
-    if { ! [info exists gdbserver_server_exec] } {
-	if [is_remote target] {
-	    set gdbserver_server_exec [remote_download target $host_exec /tmp/[file tail $gdbserver_host_exec].[pid]]
-	} else {
-	    set gdbserver_server_exec $gdbserver_host_exec
-	}
-    }
-
-    set res [gdbserver_spawn $gdbserver_server_exec $child_args]
+proc gdbserver_run { child_args } {
+    set res [gdbserver_spawn $child_args]
     set protocol [lindex $res 0]
     set gdbport [lindex $res 1]
 
-    if { $host_exec != "" } {
-	if [gdb_file_cmd $host_exec] {
-	    return -1
-	}
-    }
     gdb_target_cmd $protocol $gdbport
 }
Index: src/gdb/testsuite/lib/mi-support.exp
===================================================================
--- src.orig/gdb/testsuite/lib/mi-support.exp	2007-02-26 09:45:57.000000000 -0500
+++ src/gdb/testsuite/lib/mi-support.exp	2007-02-26 10:33:05.000000000 -0500
@@ -379,18 +379,10 @@ proc mi_gdb_file_cmd { arg } {
     global loadfile
     global GDB
     global mi_gdb_prompt
-    global last_mi_gdb_file
-    global last_mi_remote_file
+    global last_loaded_file
     upvar timeout timeout
 
-    if { $arg == "" } {
-	set arg $last_mi_gdb_file;
-    } else {
-	set last_mi_gdb_file $arg
-	if { [ info exists last_mi_remote_file ] } {
-	    unset last_mi_remote_file
-	}
-    }
+    set last_loaded_file $arg
 
     if [is_remote host] {
 	set arg [remote_download host $arg];
@@ -449,10 +441,10 @@ proc mi_gdb_file_cmd { arg } {
 }
 
 #
-# load a file into the debugger.
+# connect to the target and download a file, if necessary.
 # return a -1 if anything goes wrong.
 #
-proc mi_gdb_load { arg } {
+proc mi_gdb_target_load { } {
     global verbose
     global loadpath
     global loadfile
@@ -460,25 +452,8 @@ proc mi_gdb_load { arg } {
     global mi_gdb_prompt
     upvar timeout timeout
 
-    # ``gdb_unload''
-    if { $arg != "" } {
-	mi_gdb_file_cmd $arg
-    }
-
-    # ``load''
     if { [info procs gdbserver_gdb_load] != "" } {
-	global last_mi_gdb_file
-	global last_mi_remote_file
-
-	if { ! [info exists last_mi_remote_file] } {
-	    if [is_remote target] {
-		set last_mi_remote_file [remote_download target $arg /tmp/[file tail $arg].[pid]]
-	    } else {
-		set last_mi_remote_file $last_mi_gdb_file
-	    }
-	}
-
-	set res [gdbserver_gdb_load $last_mi_remote_file]
+	set res [gdbserver_gdb_load]
 	set protocol [lindex $res 0]
 	set gdbport [lindex $res 1]
 
@@ -544,6 +519,17 @@ proc mi_gdb_load { arg } {
     return 0
 }
 
+#
+# load a file into the debugger.
+# return a -1 if anything goes wrong.
+#
+proc mi_gdb_load { arg } {
+    if { $arg != "" } {
+	return [mi_gdb_file_cmd $arg]
+    }
+    return 0
+}
+
 # mi_gdb_test COMMAND PATTERN MESSAGE [IPATTERN] -- send a command to gdb; 
 #   test the result.
 #
@@ -786,13 +772,12 @@ proc mi_run_cmd {args} {
 	}
     }
 
+    if { [mi_gdb_target_load] < 0 } {
+	return
+    }
+
     if [target_info exists use_gdb_stub] {
 	if [target_info exists gdb,do_reload_on_run] {
-	    # Specifying no file, defaults to the executable
-	    # currently being debugged.
-	    if { [mi_gdb_load ""] < 0 } {
-		return;
-	    }
 	    send_gdb "000-exec-continue\n";
 	    gdb_expect 60 {
 		-re "000\\^running\[\r\n\]+$mi_gdb_prompt$" {}
Index: src/gdb/testsuite/gdb.base/break.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.base/break.exp	2007-02-26 09:49:21.000000000 -0500
+++ src/gdb/testsuite/gdb.base/break.exp	2007-02-26 10:04:46.000000000 -0500
@@ -202,27 +202,16 @@ if [istarget "mips-idt-*"] then {
 #
 # run until the breakpoint at main is hit. For non-stubs-using targets.
 #
-if ![target_info exists use_gdb_stub] {
-  if [istarget "*-*-vxworks*"] then {
-    send_gdb "run vxmain \"2\"\n"
-    set timeout 120
-    verbose "Timeout is now $timeout seconds" 2
-  } else {
-	send_gdb "run\n"
-  }
-  gdb_expect {
-    -re "The program .* has been started already.*y or n. $" {
-	send_gdb "y\n"
-	exp_continue
-    }
-    -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\
-	                    { pass "run until function breakpoint" }
-    -re ".*$gdb_prompt $"       { fail "run until function breakpoint" }
-    timeout	            { fail "run until function breakpoint (timeout)" }
-  }
-} else {
-    if ![target_info exists gdb_stub] {
-	gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue"
+gdb_run_cmd
+gdb_expect {
+    -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" {
+	pass "run until function breakpoint"
+    }
+    -re "$gdb_prompt $" {
+	fail "run until function breakpoint"
+    }
+    timeout {
+	fail "run until function breakpoint (timeout)"
     }
 }
 
@@ -773,26 +762,14 @@ proc test_next_with_recursion {} { 
     global decimal
     global binfile
 
-    if [target_info exists use_gdb_stub] {
-	# Reload the program.
-	delete_breakpoints
-	gdb_load ${binfile};
-    } else {
-	# FIXME: should be using runto
-	gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y"
-
-	delete_breakpoints
-    }
+    gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y"
+    delete_breakpoints
 
     gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial"
 
     # Run until we call factorial with 6
 
-    if [istarget "*-*-vxworks*"] then {
-	send_gdb "run vxmain \"6\"\n"
-    } else {
-	gdb_run_cmd
-    }
+    gdb_run_cmd
     gdb_expect {
 	-re "Break.* factorial .value=6. .*$gdb_prompt $" {}
 	-re ".*$gdb_prompt $" {
@@ -916,29 +893,19 @@ gdb_test "break marker4" \
 #
 # run until the breakpoint at main is hit. For non-stubs-using targets.
 #
-if ![target_info exists use_gdb_stub] {
-  if [istarget "*-*-vxworks*"] then {
-    send_gdb "run vxmain \"2\"\n"
-    set timeout 120
-    verbose "Timeout is now $timeout seconds" 2
-  } else {
-	send_gdb "run\n"
-  }
-  gdb_expect {
-    -re "The program .* has been started already.*y or n. $" {
-	send_gdb "y\n"
-	exp_continue
-    }
-    -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\
-	                    { pass "run until function breakpoint, optimized file" }
-    -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $"\
-	                    { pass "run until function breakpoint, optimized file (code motion)" }
-    -re ".*$gdb_prompt $"       { fail "run until function breakpoint, optimized file" }
-    timeout	            { fail "run until function breakpoint, optimized file (timeout)" }
-  }
-} else {
-    if ![target_info exists gdb_stub] {
-	gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue, optimized file"
+gdb_run_cmd
+gdb_expect {
+    -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" {
+	pass "run until function breakpoint, optimized file"
+    }
+    -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $" {
+	pass "run until function breakpoint, optimized file (code motion)"
+    }
+    -re "$gdb_prompt $" {
+	fail "run until function breakpoint, optimized file"
+    }
+    timeout {
+	fail "run until function breakpoint, optimized file (timeout)"
     }
 }
 
Index: src/gdb/testsuite/gdb.base/ending-run.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.base/ending-run.exp	2007-02-26 09:57:42.000000000 -0500
+++ src/gdb/testsuite/gdb.base/ending-run.exp	2007-02-26 09:58:35.000000000 -0500
@@ -67,11 +67,9 @@ gdb_test "b ending-run.c:31" ".*Breakpoi
 # Expect to hit the bp at line "1", but symbolize this
 # as line "13".  Then try to clear it--this should work.
 #
-if [target_info exists use_gdb_stub] {
-  gdb_test "continue" ".*Breakpoint.*1.*callee.*13.*"
-} else {
-  gdb_test "r" ".*Breakpoint.*1.*callee.*13.*"
-}
+gdb_run_cmd
+gdb_test "" ".*Breakpoint.*1.*callee.*13.*" "run"
+
 gdb_test "cle" ".*Deleted breakpoints 2 1.*" "clear worked"
 send_gdb "i b\n"
 gdb_expect {
Index: src/gdb/testsuite/gdb.base/sepdebug.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.base/sepdebug.exp	2007-02-26 09:59:57.000000000 -0500
+++ src/gdb/testsuite/gdb.base/sepdebug.exp	2007-02-26 10:04:57.000000000 -0500
@@ -199,27 +199,16 @@ if [istarget "mips-idt-*"] then {
 #
 # run until the breakpoint at main is hit. For non-stubs-using targets.
 #
-if ![target_info exists use_gdb_stub] {
-  if [istarget "*-*-vxworks*"] then {
-    send_gdb "run vxmain \"2\"\n"
-    set timeout 120
-    verbose "Timeout is now $timeout seconds" 2
-  } else {
-	send_gdb "run\n"
-  }
-  gdb_expect {
-    -re "The program .* has been started already.*y or n. $" {
-	send_gdb "y\n"
-	exp_continue
-    }
-    -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\
-	                    { pass "run until function breakpoint" }
-    -re ".*$gdb_prompt $"       { fail "run until function breakpoint" }
-    timeout	            { fail "run until function breakpoint (timeout)" }
-  }
-} else {
-    if ![target_info exists gdb_stub] {
-	gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue"
+gdb_run_cmd
+gdb_expect {
+    -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" {
+	pass "run until function breakpoint"
+    }
+    -re "$gdb_prompt $" {
+	fail "run until function breakpoint"
+    }
+    timeout {
+	fail "run until function breakpoint (timeout)"
     }
 }
 
@@ -759,26 +748,14 @@ proc test_next_with_recursion {} { 
     global decimal
     global binfile
 
-    if [target_info exists use_gdb_stub] {
-	# Reload the program.
-	delete_breakpoints
-	gdb_load ${binfile};
-    } else {
-	# FIXME: should be using runto
-	gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y"
-
-	delete_breakpoints
-    }
+    gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y"
+    delete_breakpoints
 
     gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial"
 
     # Run until we call factorial with 6
 
-    if [istarget "*-*-vxworks*"] then {
-	send_gdb "run vxmain \"6\"\n"
-    } else {
-	gdb_run_cmd
-    }
+    gdb_run_cmd
     gdb_expect {
 	-re "Break.* factorial .value=6. .*$gdb_prompt $" {}
 	-re ".*$gdb_prompt $" {
@@ -883,29 +860,19 @@ gdb_test "break marker4" \
 #
 # run until the breakpoint at main is hit. For non-stubs-using targets.
 #
-if ![target_info exists use_gdb_stub] {
-  if [istarget "*-*-vxworks*"] then {
-    send_gdb "run vxmain \"2\"\n"
-    set timeout 120
-    verbose "Timeout is now $timeout seconds" 2
-  } else {
-	send_gdb "run\n"
-  }
-  gdb_expect {
-    -re "The program .* has been started already.*y or n. $" {
-	send_gdb "y\n"
-	exp_continue
-    }
-    -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\
-	                    { pass "run until function breakpoint, optimized file" }
-    -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $"\
-	                    { pass "run until function breakpoint, optimized file (code motion)" }
-    -re ".*$gdb_prompt $"       { fail "run until function breakpoint, optimized file" }
-    timeout	            { fail "run until function breakpoint, optimized file (timeout)" }
-  }
-} else {
-    if ![target_info exists gdb_stub] {
-	gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue, optimized file"
+gdb_run_cmd
+gdb_expect {
+    -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" {
+	pass "run until function breakpoint, optimized file"
+    }
+    -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $" {
+	pass "run until function breakpoint, optimized file (code motion)"
+    }
+    -re "$gdb_prompt $" {
+	fail "run until function breakpoint, optimized file"
+    }
+    timeout {
+	fail "run until function breakpoint, optimized file (timeout)"
     }
 }
 


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