aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorBob Manson <manson@cygnus>1997-09-13 00:08:05 +0000
committerBob Manson <manson@cygnus>1997-09-13 00:08:05 +0000
commitfc75bd970a7538c5cdbe8c8d7405e5daff999faf (patch)
tree46f246975130e4586972f66b2801806a266814e4 /gdb/testsuite/lib
parenteb16c04c8c232558f68b424bcb62b285fd2d9002 (diff)
downloadgdb-fc75bd970a7538c5cdbe8c8d7405e5daff999faf.zip
gdb-fc75bd970a7538c5cdbe8c8d7405e5daff999faf.tar.gz
gdb-fc75bd970a7538c5cdbe8c8d7405e5daff999faf.tar.bz2
* lib/gdb.exp(gdb_step_for_stub): New function.
(gdb_run_cmd): Look for gdb,do_reload_on_run target feature--if it exists, reload the executable and do a "continue" instead of doing a jump. (runto_main): Use gdb_step_for_stub. * gdb.base/break.exp: Use gdb_step_for_stub. Also, rename certain tests to have unique names. * gdb.base/callfuncs.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/help.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/opaque.exp: Ditto. * gdb.base/printcmds.exp: Ditto. Use a loop to emit multiple similar tests. * gdb.base/setshow.c: Add set_debug_traps/breakpoint calls. * gdb.c++/cplusfuncs.cc: Ditto. * gdb.c++/virtfunc.cc: Ditto. * config/monitor.exp: Keep track of the last file we saw, rather than trying to get the info from gdb. * gdb.fortran/types.exp: Move comment to previous line. Fixes for TCL8 miscellaneous problems, plus other changes.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/gdb.exp96
1 files changed, 87 insertions, 9 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index eb37fd5..9a3f2c5 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -38,6 +38,9 @@ if ![info exists CHILL_RT0] {
}
verbose "using CHILL_RT0 = $CHILL_RT0" 2
+if [info exists TOOL_EXECUTABLE] {
+ set GDB $TOOL_EXECUTABLE;
+}
if ![info exists GDB] {
if ![is_remote host] {
set GDB [findfile $base_dir/../../gdb/gdb "$base_dir/../../gdb/gdb" [transform gdb]]
@@ -171,6 +174,17 @@ proc gdb_run_cmd {args} {
}
if [target_info exists use_gdb_stub] {
+ if [target_info exists gdb,do_reload_on_run] {
+ # According to Stu, this will always work.
+ gdb_load "";
+ send_gdb "continue\n";
+ gdb_expect 60 {
+ -re "Continu\[^\r\n\]*\[\r\n\]" {}
+ default {}
+ }
+ return;
+ }
+
if [target_info exists gdb,start_symbol] {
set start [target_info gdb,start_symbol];
} else {
@@ -284,7 +298,7 @@ proc runto { function } {
# specially--if it uses stubs, assuming we hit
# breakpoint() and just step out of the function.
#
-proc runto_main {} {
+proc runto_main { } {
global gdb_prompt
global decimal
@@ -294,13 +308,8 @@ proc runto_main {} {
delete_breakpoints
- send_gdb "step\n"
- # if use stubs step out of the breakpoint() function.
- gdb_expect 120 {
- -re "main.* at .*$gdb_prompt $" {}
- -re "_start.*$gdb_prompt $" {}
- timeout { fail "single step at breakpoint() (timeout)" ; return 0 }
- }
+ gdb_step_for_stub;
+
return 1
}
@@ -360,7 +369,17 @@ proc gdb_test { args } {
}
}
- gdb_expect 600 {
+ if [info exists timeout] {
+ set tmt $timeout;
+ } else {
+ global timeout;
+ if [info exists timeout] {
+ set tmt $timeout;
+ } else {
+ set tmt 60;
+ }
+ }
+ gdb_expect $tmt {
-re "Ending remote debugging.*$gdb_prompt$" {
if ![isnative] then {
warning "Can`t communicate to remote target."
@@ -608,6 +627,7 @@ proc default_gdb_exit {} {
send_gdb "y\n";
exp_continue;
}
+ -re "DOSEXIT code" { }
default { }
}
}
@@ -1025,3 +1045,61 @@ proc setup_xfail_format { format } {
return 0
}
+proc gdb_step_for_stub { } {
+ global gdb_prompt;
+
+ if [target_info exists gdb_stub_step_command] {
+ set command [target_info gdb_stub_step_command];
+ } else {
+ set command "step";
+ }
+ send_gdb "${command}\n";
+ set tries 0;
+ gdb_expect 60 {
+ -re "(main.* at |.*in .*start).*$gdb_prompt" {
+ return;
+ }
+ -re "libgloss/\[a-z\]*\[0-9\]*/stub.c" {
+ send_gdb "where\n";
+ gdb_expect {
+ -re "main\[^\r\n\]*at \(\[^:]+\):\(\[0-9\]+\)" {
+ set file $expect_out(1,string);
+ set linenum [expr $expect_out(2,string) + 1];
+ set breakplace "${file}:${linenum}";
+ }
+ default {}
+ }
+ send_gdb "break ${breakplace}\n";
+ gdb_expect 60 {
+ -re "Breakpoint (\[0-9\]+) at.*$gdb_prompt" {
+ set breakpoint $expect_out(1,string);
+ }
+ -re "Breakpoint (\[0-9\]+): file.*$gdb_prompt" {
+ set breakpoint $expect_out(1,string);
+ }
+ default {}
+ }
+ send_gdb "continue\n";
+ gdb_expect 60 {
+ -re "Breakpoint ${breakpoint},.*$gdb_prompt" {
+ gdb_test "delete $breakpoint" ".*" "";
+ return;
+ }
+ default {}
+ }
+ }
+ -re ".*$gdb_prompt" {
+ incr tries;
+ if { $tries == 5 } {
+ fail "stepping out of breakpoint function";
+ return;
+ }
+ send_gdb "${command}\n";
+ exp_continue;
+ }
+ default {
+ fail "stepping out of breakpoint function";
+ return;
+ }
+ }
+}