aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-03-27 17:59:38 +0000
committerDaniel Jacobowitz <drow@false.org>2007-03-27 17:59:38 +0000
commitb741e217929039042129802a61e4510c580ecc79 (patch)
tree7f95fddc87c00954b65a276ae74af2533d50aa59 /gdb/testsuite/gdb.base
parentd2449ee801d18f5af7317bc72c92bc9bbb7b669e (diff)
downloadgdb-b741e217929039042129802a61e4510c580ecc79.zip
gdb-b741e217929039042129802a61e4510c580ecc79.tar.gz
gdb-b741e217929039042129802a61e4510c580ecc79.tar.bz2
* 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. * gdb.server/server-mon.exp: Likewise. * lib/gdb.exp (gdb_run_cmd): Use gdb_reload. (gdb_start_cmd): New. (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. (gdb_target_cmd): Handle ObjC failure case. (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/pending.exp, gdb.base/sepdebug.exp, gdb.base/unload.exp, gdb.objc/objcdecode.exp: Use gdb_run_cmd. * gdb.base/charsign.exp: Remove incorrect comment. * gdb.base/dbx.exp (gdb_file_cmd): Set last_loaded_file. * gdb.ada/exec_changed.exp, gdb.ada/null_record.exp, gdb.ada/start.exp, gdb.base/start.exp: Use gdb_start_cmd.
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r--gdb/testsuite/gdb.base/break.exp81
-rw-r--r--gdb/testsuite/gdb.base/charsign.exp2
-rw-r--r--gdb/testsuite/gdb.base/dbx.exp3
-rw-r--r--gdb/testsuite/gdb.base/ending-run.exp8
-rw-r--r--gdb/testsuite/gdb.base/pending.exp3
-rw-r--r--gdb/testsuite/gdb.base/sepdebug.exp81
-rw-r--r--gdb/testsuite/gdb.base/start.exp6
-rw-r--r--gdb/testsuite/gdb.base/unload.exp13
8 files changed, 68 insertions, 129 deletions
diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
index aba80ed..16d05b7 100644
--- a/gdb/testsuite/gdb.base/break.exp
+++ b/gdb/testsuite/gdb.base/break.exp
@@ -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
+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 "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"
+ -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
+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 "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"
+ -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)"
}
}
diff --git a/gdb/testsuite/gdb.base/charsign.exp b/gdb/testsuite/gdb.base/charsign.exp
index 7383fd6..e3d4cd7 100644
--- a/gdb/testsuite/gdb.base/charsign.exp
+++ b/gdb/testsuite/gdb.base/charsign.exp
@@ -44,8 +44,6 @@ proc do_test { cflags } {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
- # For C programs, "start" should stop in main().
-
gdb_test "p n" \
"= \"A\""
gdb_test "p s" \
diff --git a/gdb/testsuite/gdb.base/dbx.exp b/gdb/testsuite/gdb.base/dbx.exp
index 5c0610f..cd63c66 100644
--- a/gdb/testsuite/gdb.base/dbx.exp
+++ b/gdb/testsuite/gdb.base/dbx.exp
@@ -184,6 +184,9 @@ proc gdb_file_cmd {arg} {
global gdb_prompt
global spawn_id
upvar timeout timeout
+ global last_loaded_file
+
+ set last_loaded_file $arg
if [is_remote host] {
set arg [remote_download host $arg];
diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
index acf0d79..edf1181 100644
--- a/gdb/testsuite/gdb.base/ending-run.exp
+++ b/gdb/testsuite/gdb.base/ending-run.exp
@@ -67,11 +67,9 @@ gdb_test "b ending-run.c:31" ".*Breakpoint 3.*ending-run.c, line 31.*"
# 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 {
diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp
index c3351e6..3ba5176 100644
--- a/gdb/testsuite/gdb.base/pending.exp
+++ b/gdb/testsuite/gdb.base/pending.exp
@@ -191,7 +191,8 @@ gdb_test "info break" \
# Run to main which should resolve a pending breakpoint
#
-gdb_test "run" \
+gdb_run_cmd
+gdb_test "" \
"Breakpoint.*at.*
Pending breakpoint \"pendshr.c:26 if x > 3\" resolved.*
Breakpoint.*, main.*$mainline.*" \
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index 8911f51..e0a36ac 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -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
+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 "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"
+ -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
+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 "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"
+ -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)"
}
}
diff --git a/gdb/testsuite/gdb.base/start.exp b/gdb/testsuite/gdb.base/start.exp
index e8e21d6..27b2bde 100644
--- a/gdb/testsuite/gdb.base/start.exp
+++ b/gdb/testsuite/gdb.base/start.exp
@@ -37,8 +37,12 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# For C programs, "start" should stop in main().
+if { [gdb_start_cmd] < 0 } {
+ untested start
+ return -1
+}
-gdb_test "start" \
+gdb_test "" \
"main \\(\\) at .*start.c.*" \
"start"
diff --git a/gdb/testsuite/gdb.base/unload.exp b/gdb/testsuite/gdb.base/unload.exp
index 665cd06..105ddc4 100644
--- a/gdb/testsuite/gdb.base/unload.exp
+++ b/gdb/testsuite/gdb.base/unload.exp
@@ -90,26 +90,27 @@ gdb_test "info break" \
set unloadshr_line [gdb_get_line_number "unloadshr break" ${libsrcfile}]
-gdb_test "run" \
-"Starting program.*unload.*
-Breakpoint.*at.*
+gdb_run_cmd
+gdb_test "" \
+"Breakpoint.*at.*
Pending breakpoint \"shrfunc1\" resolved.*
Breakpoint.*, shrfunc1 \\\(x=3\\\).*unloadshr.c:$unloadshr_line.*" \
"running program"
gdb_test "continue" \
-"Continuing.*y is 7.*warning: Temporarily disabling breakpoints for.*unloadshr.sl.*Program exited normally." \
+"Continuing.*warning: Temporarily disabling breakpoints for.*unloadshr.sl.*Program exited normally." \
"continuing to end of program"
#
# Try to rerun program and verify that shared breakpoint is reset properly
#
-gdb_test "run" \
+gdb_run_cmd
+gdb_test "" \
".*Breakpoint.*shrfunc1.*at.*unloadshr.c:$unloadshr_line.*" \
"rerun to shared library breakpoint"
gdb_test "continue" \
-"Continuing.*y is 7.*warning: Temporarily disabling breakpoints for.*unloadshr.sl.*Program exited normally." \
+"Continuing.*warning: Temporarily disabling breakpoints for.*unloadshr.sl.*Program exited normally." \
"continuing to end of program second time"