# are we on a target board
if ![isnative] then {
- warning "These test cases can't run on a target system."
+ continue
+}
+if [istarget "m68k*-*-hpux*"] then {
+ # The top-level makefile passes CFLAGS= (no -g) for hp300. This probably
+ # should be fixed (it is only needed for gcc bootstrapping, not gdb),
+ # but until then.....
+ setup_xfail "*-*-*"
+ fail "cannot test self if compiled without debug info"
continue
}
global prompt
global tool
global det_file
- global timeout
global decimal
# load yourself into the debugger
# entire symbol table. Set the timeout to 10 minutes, which should be
# adequate for most environments (it *has* timed out with 5 min on a
# SPARCstation SLC under moderate load, so this isn't unreasonable).
- # After gdb is loaded, set the timeout to 30 seconds for the duration
+ # After gdb is started, set the timeout to 30 seconds for the duration
# of this test, and then back to the original value.
- set oldtimeout $timeout
set timeout 600
if {[gdb_load "./x$tool"] <0} then {
return -1
}
- set timeout 30
-
# disassemble yourself
send "x/10i main\n"
expect {
}
}
+ # We'll need this when we send a ^C to GDB. Need to do it before we
+ # run the program and gdb starts saving and restoring tty states.
+ # On Ultrix, we don't need it and it is really slow (because shell_escape
+ # doesn't use vfork).
+ if ![istarget "*-*-ultrix*"] then {
+ gdb_test "shell stty intr '^C'" "" \
+ "set interrupt character in test_with_self"
+ }
+
# run yourself
set description "run until breakpoint at main"
send "run\n"
}
}
+ # It may take a very long time for the inferior gdb to start (lynx),
+ # so we wait until after it's started to reset the timeout value.
+ set timeout 30
+
# do we have a version number ?
send "print version\n"
expect {
fail "$description"
}
timeout {
- fail "$description" (timeout)"
+ fail "$description (timeout)"
}
}
fail "$description"
}
timeout {
- fail "$description" (timeout)"
+ fail "$description (timeout)"
}
}
fail "$description"
}
timeout {
- fail "$description" (timeout)"
+ fail "$description (timeout)"
}
}
set description "step over ttyarg initialization"
send "step\n"
expect {
- -re "init_malloc.* NULL.*$prompt $" {
+ -re ".*time_at_startup = get_run_time .*$prompt $" {
pass "$description"
}
-re ".*No such file or directory.\r\n$prompt $" {
fail "$description"
}
timeout {
- fail "$description" (timeout)"
+ fail "$description (timeout)"
}
}
# now jump over a few functions
- set description "next over init_malloc and everything it calls"
+ set description "next over get_run_time and everything it calls"
+ set got_over_get_run_time 0
send "next\n"
expect {
- -re "if.*SET_TOP_LEVEL.*$prompt $" {
+ -re ".*init_malloc.*$prompt $" {
pass "$description"
+ set got_over_get_run_time 1
+ }
+ -re ".*No such file or directory.\r\n$prompt $" {
+ pass "$description (no source available)"
+ set got_over_get_run_time 1
}
- -re "i = .*count.*$prompt $" {
- pass "$description"
- set description "next over ALIGN_STACK_ON_STARTUP code"
- send "next\n"
- expect {
+ -re ".*A file or directory .* does not exist..\r\n$prompt $" {
+ pass "$description (no source available)"
+ set got_over_get_run_time 1
+ }
+ -re ".*$prompt $" {
+ fail "$description"
+ }
+ timeout {
+ fail "$description (timeout)"
+ }
+ }
+ # -re "if \(setmp \(to_top_level\)\).*$prompt $" { pass "first next" }
+
+ if $got_over_get_run_time then {
+ set description "next over init_malloc and everything it calls"
+ send "next\n"
+ expect {
+ -re "if.*SET_TOP_LEVEL.*$prompt $" {
+ pass "$description"
+ }
+ -re "i = .*count.*$prompt $" {
+ pass "$description"
+ set description "next over ALIGN_STACK_ON_STARTUP code"
+ send "next\n"
+ expect {
-re "if.*i != 0.*$prompt $" {
pass "$description"
send "next\n"
}
}
}
+ }
+ }
+ -re ".*No such file or directory.\r\n$prompt $" {
+ pass "$description (no source available)"
+ }
+ -re ".*A file or directory .* does not exist..\r\n$prompt $" {
+ pass "$description (no source available)"
+ }
+ -re ".*$prompt $" {
+ fail "$description"
+ }
+ default {
+ fail "$description (timeout or eof)"
}
- }
- -re ".*No such file or directory.\r\n$prompt $" {
- pass "$description (no source available)"
- }
- -re ".*A file or directory .* does not exist..\r\n$prompt $" {
- pass "$description (no source available)"
- }
- -re ".*$prompt $" {
- fail "$description"
- }
- timeout {
- fail "$description (timeout)"
}
}
- # -re "if \(setmp \(to_top_level\)\).*$prompt $" { pass "first next" }
-
-
- # This one fails on Solaris (for some versions of gdb) because you
- # can't next over library functions
- setup_xfail "sparc-sun-solaris2" 1817
+
set next_ok 1
set need_to_step_over_cmdsize 1
set description "next over SET_TOP_LEVEL call"
fail "$description"
}
timeout {
- fail "$description" (timeout)"
+ fail "$description (timeout)"
}
}
}
# and another step for good luck
- # This one fails on Solaris (for some versions of gdb) because you
- # can't step into library functions
if $next_ok {
set description "step into xmalloc call"
send "step\n"
}
}
}
-
+
# start the "xgdb" process
send "continue\n"
expect {
}
# get a stack trace
- setup_xfail "rs6000-*-*"
setup_xfail "i486-*-sysv4"
set description "backtrace through signal handler"
send "backtrace\n"
expect {
- -re "#0.*read.*#\[1-9\].*main.c.*$prompt $" {
+ -re "#0.*read.*in main \\(.*\\) at .*main\\.c.*$prompt $" {
pass "$description"
}
-re ".*$prompt $" {
+ # On the alpha, we hit the infamous problem about gdb
+ # being unable to get the frame pointer (mentioned in
+ # gdb/README). As it is intermittent, there is no way to
+ # XFAIL it which will give us an XPASS if the problem goes
+ # away.
+ setup_xfail "alpha*-*-osf*"
fail "$description"
}
timeout {
fail "$description (timeout)"
}
}
-
- # force GDB to dump core. On Solaris expect seems to not see the
- # final message, even if gdb did dump core, so we check for the
- # core dump explicitly if we time out.
- # bsd 386 systems append the name of the program to the corefile name.
- system rm -f core core.gdb
- send "maint dump-me\n"
- expect {
- -re "maint dump-me.*Should GDB dump core.*y or n. $" {
- send "y\n"
- expect {
- -re "Quit.*core dumped.*" { pass "GDB dumped core" }
- -re "Program received signal SIGQUIT.*$prompt $" {
- pass "GDB dumped core"
- # This means we just told xgdb, not gdb, to dump core.
- # Get out of gdb so that removing xgdb doesn't get
- # test busy errors.
- gdb_exit
- }
- -re "$prompt $" { fail "GDB dumped core" }
- default {
- if {[file exists core] || [file exists core.gdb]} then {
- pass "GDB dumped core"
- } else {
- fail "GDB dumped core"
- }
- }
- }
- }
- -re ".*$prompt $" { fail "GDB dumped core" }
- timeout { fail "(timeout) GDB dumped core" }
- }
- system rm -f core core.gdb
+
+ gdb_exit
# Set the timeout back to the value it had when we were called.
- set timeout $oldtimeout
# Restart gdb in case next test expects it to be started already.
gdb_start