Major revision to testsuites for cross-testing and DOS testing support.

This commit is contained in:
Bob Manson
1997-01-29 09:40:31 +00:00
parent 1a2faf1f1e
commit 787f622077
96 changed files with 5246 additions and 12012 deletions

View File

@@ -20,16 +20,17 @@
# This file was written by Rob Savoye. (rob@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
strace $tracelevel
}
set prms_id 0
set bug_id 0
# are we on a target board
if ![isnative] then {
if [is_remote target] {
return
}
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),
@@ -160,7 +161,7 @@ proc do_steps_and_nexts {} {
}
}
proc test_with_self {} {
proc test_with_self { executable } {
global prompt
global tool
global det_file
@@ -180,7 +181,7 @@ proc test_with_self {} {
set oldtimeout $timeout
set timeout 600
verbose "Timeout is now $timeout seconds" 2
if {[gdb_load "./x$tool"] <0} then {
if {[gdb_load $executable] <0} then {
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
return -1
@@ -189,27 +190,14 @@ proc test_with_self {} {
verbose "Timeout is now $timeout seconds" 2
# disassemble yourself
send "x/10i main\n"
expect {
-re "x/10i.*main.*main.$decimal.*main.$decimal.*$prompt $"\
{ pass "Disassemble main" }
-re ".*$prompt $" { fail "Disassemble main" }
timeout { fail "(timeout) Disassemble main" }
}
gdb_test "x/10i main" \
"x/10i.*main.*main.$decimal.*main.$decimal.*" \
"Disassemble main"
set description "set breakpoint at main"
send "break main\n"
expect {
-re "Breakpoint.*at.* file.*, line.*$prompt $" {
pass "$description"
}
-re ".*$prompt $" {
fail "$description"
}
timeout {
fail "$description (timeout)"
}
}
# Set a breakpoint at main
gdb_test "break main" \
"Breakpoint.*at.* file.*, line.*" \
"breakpoint in main"
# 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.
@@ -223,7 +211,7 @@ proc test_with_self {} {
# FIXME: If we put this after the run to main, the first list
# command doesn't print the same line as the current line where
# gdb is stopped.
send "set listsize 1\n" ; expect -re "$prompt $"
gdb_test "set listsize 1" "" "set listsize to 1"
# run yourself
# It may take a very long time for the inferior gdb to start (lynx),
@@ -274,19 +262,7 @@ proc test_with_self {} {
do_steps_and_nexts
set description "print a string"
send "print \"foo\"\n"
expect {
-re ".\[0-9\]+ = \"foo\".*$prompt $" {
pass "$description"
}
-re ".*$prompt $" {
fail "$description"
}
timeout {
fail "$description (timeout)"
}
}
gdb_test "print \"foo\"" ".\[0-9\]+ = \"foo\"" "print a string"
# do_steps_and_nexts left us ready to execute an xmalloc call,
# so give that a try.
@@ -432,26 +408,20 @@ proc find_gdb { arg } {
}
# Run the test with self.
# Copy the file executable file in case this OS doesn't like to edit it's own
# Copy the file executable file in case this OS doesn't like to edit its own
# text space.
set GDB_FULLPATH [find_gdb $GDB]
# Remove any old copy lying around.
catch "exec rm -f ./x$tool"
remote_file build delete x$tool
if ![file executable $GDB_FULLPATH] then {
fail "couldn't convert $GDB to absolute pathname to make local copy"
} else {
if [catch "exec cp $GDB_FULLPATH ./x$tool"] then {
fail "couldn't copy $GDB_FULLPATH to current directory"
} else {
verbose "\t\tCopied $GDB_FULLPATH to ./x$tool"
if {[test_with_self] <0} then {
warning "Couldn't test self"
catch "exec rm -f ./x$tool"
return -1
}
catch "exec rm -f ./x$tool"
}
gdb_start
set file [remote_download build $GDB_FULLPATH x$tool]
set result [test_with_self $file];
remote_file build delete $file;
if {$result <0} then {
warning "Couldn't test self"
return -1
}

View File

@@ -21,14 +21,19 @@
# These tests don't work for targets can't take arguments...
if $noargs then {
verbose "Skipping a2-run.exp because of noargs."
return
}
if [target_info exists gdb,noargs] then {
verbose "Skipping a2-run.exp because of noargs."
return
}
if [target_info exists gdb,noinferiorio] {
verbose "Skipping a2-run.exp because of noinferiorio."
return
}
if $tracelevel then {
strace $tracelevel
}
strace $tracelevel
}
#
# test running programs
@@ -37,9 +42,9 @@ set prms_id 0
set bug_id 0
set testfile "run"
set srcfile ${srcdir}/$subdir/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -51,102 +56,109 @@ gdb_load ${binfile}
# Run with no arguments.
# On VxWorks this justs make sure the program was run.
send "run\n"
expect -re "run\[\r\n\]+" {}
gdb_run_cmd
if [istarget "*-*-vxworks*"] then {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
expect {
-i $shell_id "Program exited normally" {
unresolved "run \"$binfile\" with no args"
-i $gdb_spawn_id "Program exited normally" {
unresolved "run \"$testfile\" with no args"
}
-i $shell_id -re "usage: factorial <number>" {
pass "run \"$binfile\" with no args"
-i $gdb_spawn_id -re "usage: factorial <number>" {
pass "run \"$testfile\" with no args"
}
timeout {
fail "(timeout) run \"$binfile\" with no args"
fail "(timeout) run \"$testfile\" with no args"
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
expect -re "$prompt $" {}
} else {
expect {
-re "Starting program.*usage: factorial <number>.*Program exited with code 01.*$prompt $" {
pass "run \"$binfile\" with no args"
-re ".*usage: factorial <number>.*Program exited with code 01.*$prompt $" {
pass "run \"$testfile\" with no args"
}
-re ".*$prompt $" {
fail "run \"$binfile\" with no args"
fail "run \"$testfile\" with no args"
verbose "expect_out is $expect_out(buffer)" 2
}
timeout {
fail "(timeout) run \"$binfile\" no args"
fail "(timeout) run \"$testfile\" no args"
}
}
}
# Now run with some arguments
if [istarget "*-*-vxworks*"] then {
send "run vxmain \"5\"\n"
send_gdb "run vxmain \"5\"\n"
expect -re "run vxmain \"5\"\r\n" {}
set timeout 120
verbose "Timeout is now $timeout seconds" 2
expect {
-i $shell_id "Program exited normally" {
unresolved "run \"$binfile\" with arg"
unresolved "run \"$testfile\" with arg"
}
-i $shell_id "120" {
pass "run \"$binfile\" with arg"
pass "run \"$testfile\" with arg"
}
timeout {
fail "(timeout) run \"$binfile\" with arg"
fail "(timeout) run \"$testfile\" with arg"
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
expect -re "$prompt $" {}
} else {
setup_xfail "mips-idt-*"
send "run 5\n"
gdb_run_cmd 5
expect {
-re "Starting program.*$binfile.*120.*$prompt $"\
{ pass "run \"$binfile\" with arg" }
-re ".*$prompt $" { fail "run \"$binfile\" with arg" }
timeout { fail "(timeout) run \"$binfile\" with arg" }
-re ".*120.*$prompt $"\
{ pass "run \"$testfile\" with arg" }
-re ".*$prompt $" { fail "run \"$testfile\" with arg" }
timeout { fail "(timeout) run \"$testfile\" with arg" }
}
}
# Run again with same arguments.
setup_xfail "mips-idt-*"
send "run\n"
expect -re "run\[\r\n\]+" {}
gdb_run_cmd
if [istarget "*-*-vxworks*"] then {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
expect {
-i $shell_id "Program exited normally" {
unresolved "run \"$binfile\" again with same args"
unresolved "run \"$testfile\" again with same args"
}
-i $shell_id "120" { pass "run \"$binfile\" again with same args" }
timeout { fail "(timeout) run \"$binfile\" again with same args" }
-i $shell_id "120" { pass "run \"$testfile\" again with same args" }
timeout { fail "(timeout) run \"$testfile\" again with same args" }
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
expect -re "$prompt $" {}
} else {
expect {
-re "Starting program.*120.*$prompt $"\
{ pass "run \"$binfile\" again with same args" }
-re ".*$prompt $" { fail "run \"$binfile\" again with same args" }
timeout { fail "(timeout) run \"$binfile\" again with same args" }
-re ".*120.*$prompt $"\
{ pass "run \"$testfile\" again with same args" }
-re ".*$prompt $" { fail "run \"$testfile\" again with same args" }
timeout { fail "(timeout) run \"$testfile\" again with same args" }
}
}
# Use "set args" command to specify no arguments as default and run again.
if [istarget "*-*-vxworks*"] then {
send "set args main\n"
send_gdb "set args main\n"
} else {
send "set args\n"
send_gdb "set args\n"
}
expect -re "$prompt $"
send "run\n"
expect -re "run\[\r\n\]+" {}
gdb_run_cmd
if [istarget "*-*-vxworks*"] then {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
expect {
-i $shell_id "Program exited normally" {
unresolved "run after setting args to nil"
@@ -159,10 +171,11 @@ if [istarget "*-*-vxworks*"] then {
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
expect -re "$prompt $" {}
} else {
expect {
-re "Starting program.*usage: factorial <number>.*$prompt $" {
-re ".*usage: factorial <number>.*$prompt $" {
pass "run after setting args to nil"
}
-re ".*$prompt $" {
@@ -177,38 +190,40 @@ if [istarget "*-*-vxworks*"] then {
# Use "set args" command to specify an argument and run again.
setup_xfail "mips-idt-*"
if [istarget "*-*-vxworks*"] then {
send "set args vxmain \"6\"\n"
send_gdb "set args vxmain \"6\"\n"
} else {
send "set args 6\n"
send_gdb "set args 6\n"
}
expect -re "$prompt $"
send "run\n"
expect -re "run\[\r\n\]+" {}
gdb_run_cmd
if [istarget "*-*-vxworks*"] then {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
expect {
-i $shell_id "Program exited normally" {
unresolved "run \"$binfile\" again after setting args"
unresolved "run \"$testfile\" again after setting args"
}
-i $shell_id "720" {
pass "run \"$binfile\" again after setting args"
pass "run \"$testfile\" again after setting args"
}
timeout {
fail "(timeout) run \"$binfile\" again after setting args"
fail "(timeout) run \"$testfile\" again after setting args"
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
expect -re "$prompt $" {}
} else {
expect {
-re "Starting program.*720.*$prompt $" {
pass "run \"$binfile\" again after setting args"
-re ".*720.*$prompt $" {
pass "run \"$testfile\" again after setting args"
}
-re ".*$prompt $" {
fail "run \"$binfile\" again after setting args"
fail "run \"$testfile\" again after setting args"
}
timeout {
fail "(timeout) run \"$binfile\" again after setting args"
fail "(timeout) run \"$testfile\" again after setting args"
}
}
}
@@ -216,23 +231,22 @@ if [istarget "*-*-vxworks*"] then {
# GOAL: Test that shell is being used with "run". For remote debugging
# targets, there is no guarantee that a "shell" (whatever that is) is used.
if [isnative] then {
send "run `echo 8`\n"
send_gdb "run `echo 8`\n"
expect {
-re "Starting program.*40320.*$prompt $" {
pass "run \"$binfile\" with shell"
pass "run \"$testfile\" with shell"
}
-re ".*$prompt $" {
fail "run \"$binfile\" with shell"
fail "run \"$testfile\" with shell"
}
timeout {
fail "(timeout) run \"$binfile\" with shell"
fail "(timeout) run \"$testfile\" with shell"
}
}
}
# Reset the default arguments for VxWorks
if [istarget "*-*-vxworks*"] then {
send "set args main\n"
send_gdb "set args main\n"
expect -re ".*$prompt $" {}
}

View File

@@ -27,9 +27,9 @@ set prms_id 0
set bug_id 0
set testfile "bitfields"
set srcfile ${srcdir}/$subdir/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -55,7 +55,7 @@ proc bitfield_uniqueness {} {
-re "Break.*break1 \\(\\) at .*$srcfile:$decimal.*$prompt $" {
pass "running to break1"
}
timeout { fail "running to break1"; return }
timeout { fail "(timeout) running to break1"; return }
}
if [gdb_test "print flags" ".*uc = 1 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*"] {
@@ -145,7 +145,7 @@ proc bitfield_containment {} {
-re "Break.*break2 \\(\\) at .*$srcfile:$decimal.*$prompt $" {
pass "running to break2"
}
timeout { fail "running to break2"; return }
timeout { fail "(timeout) running to break2"; return }
}
if [gdb_test "print/x flags" "= {uc = 0xff, s1 = 0x0, u1 = 0x1, s2 = 0x0, u2 = 0x3, s3 = 0x0, u3 = 0x7, s9 = 0x0, u9 = 0x1ff, sc = 0x0}" "bitfield containment #1"] {
@@ -185,7 +185,7 @@ proc bitfield_unsignedness {} {
-re "Break.*break3 \\(\\) at .*$srcfile:$decimal.*$prompt $" {
pass "running to break3"
}
timeout { fail "running to break3"; return }
timeout { fail "(timeout) running to break3"; return }
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 1, s2 = 0, u2 = 3, s3 = 0, u3 = 7, s9 = 0, u9 = 511, sc = 0.*" "unsigned bitfield ranges"] {
@@ -217,7 +217,7 @@ proc bitfield_signedness {} {
-re "Break.*break4 \\(\\) at .*$srcfile:$decimal.*$prompt $" {
pass "running to break4"
}
timeout { fail "running to break4"; return }
timeout { fail "(timeout) running to break4"; return }
}
if [gdb_test "print flags" "= {uc = 0 .*, s1 = 0, u1 = 0, s2 = 1, u2 = 0, s3 = 3, u3 = 0, s9 = 255, u9 = 0, sc = 0 .*}" "signed bitfields, max positive values"] {
@@ -230,7 +230,7 @@ proc bitfield_signedness {} {
# Determine if the target has signed bitfields so we can xfail the
# the signed bitfield tests if it doesn't.
send "print i\n"
send_gdb "print i\n"
expect {
-re ".* = -256.*$prompt $" {
pass "determining signed-ness of bitfields"
@@ -259,14 +259,11 @@ proc bitfield_signedness {} {
}
}
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
send "set print sevenbit-strings\n" ; expect -re "$prompt $"
send_gdb "set print sevenbit-strings\n" ; expect -re "$prompt $"
bitfield_uniqueness
if [istarget "mips-idt-*"] then {
# Restart because IDT/SIM runs out of file descriptors.

View File

@@ -20,10 +20,9 @@
# This file was written by Rob Savoye. (rob@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
strace $tracelevel
}
global usestubs
#
# test running programs
@@ -32,9 +31,9 @@ set prms_id 0
set bug_id 0
set testfile "break"
set srcfile ${srcdir}/${subdir}/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -44,13 +43,8 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if $usestubs {
send "step\n"
# if use stubs step out of the breakpoint() function.
expect {
-re "main.* at .*$prompt $" {}
timeout { fail "single step at breakpoint() (timeout)" ; return 0 }
}
if [target_info exists gdb_stub] {
gdb_test "step" "(main.* at .*|.*in .*start.*)" "step for stub"
}
#
# test simple breakpoint setting commands
@@ -62,20 +56,20 @@ if $usestubs {
# Note that gdb-init.exp provides a "delete_breakpoints" proc
# for general use elsewhere.
send "delete breakpoints\n"
send_gdb "delete breakpoints\n"
expect {
-re "Delete all breakpoints.*y or n. $"\
{ send "y\n"
-i $gdb_spawn_id -re "Delete all breakpoints.*$" {
send_gdb "y\n"
expect {
-re ".*$prompt $" {
setup_xfail "i*86-*-sysv4*" "sparc-sun-sunos4*" "alpha-dec-osf2*"
fail "Delete all breakpoints when none"
-re "$prompt $" {
setup_xfail "i*86-*-sysv4*" "sparc-sun-sunos4*" "alpha-dec-osf*" "mips-dec-ultrix*"
fail "Delete all breakpoints when none (unexpected prompt)"
}
timeout { fail "Delete all breakpoints when none (timeout)" }
timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" }
}
}
-re ".*$prompt $" { pass "Delete all breakpoints when none" }
timeout { fail "Delete all breakpoints when none" }
-i $gdb_spawn_id -re ".*$prompt $" { pass "Delete all breakpoints when none" }
timeout { fail "Delete all breakpoints when none (timeout)" }
}
#
@@ -117,7 +111,7 @@ gdb_test "break $srcfile:70" \
#
# check to see what breakpoints are set
#
if $usestubs then {
if [target_info exists gdb_stub] {
set main_line 57
} else {
set main_line 60
@@ -135,6 +129,8 @@ gdb_test "info break" \
# FIXME: The rest of this test doesn't work with anything that can't
# handle arguments.
# Huh? There doesn't *appear* to be anything that passes arguments
# below.
if [istarget "mips-idt-*"] then {
return
}
@@ -142,23 +138,27 @@ if [istarget "mips-idt-*"] then {
#
# run until the breakpoint at main is hit. For non-stubs-using targets.
#
if !$usestubs then {
if ![target_info exists use_gdb_stub] {
if [istarget "*-*-vxworks*"] then {
send "run vxmain \"2\"\n"
send_gdb "run vxmain \"2\"\n"
set timeout 120
verbose "Timeout is now $timeout seconds" 2
} else {
send "run\n"
send_gdb "run\n"
}
expect {
-re "The program .* has been started already.*y or n. $" {
send "y\n"
send_gdb "y\n"
exp_continue
}
-re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:60.*60\[\t \]+if .argc.* \{.*$prompt $"\
{ pass "run until function breakpoint" }
-re ".*$prompt $" { fail "run until function breakpoint" }
timeout { fail "(timeout) run until function breakpoint" }
timeout { fail "run until function breakpoint (timeout)" }
}
} else {
gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:60.*60\[\t \]+if .argc.*\{" \
"stubs continue"
}
#
@@ -184,28 +184,7 @@ gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*,
#
# delete all breakpoints so we can start over, course this can be a test too
#
send "delete breakpoints\n"
expect {
-re "Delete all breakpoints.*y or n.*$" {
send "y\n"
expect {
-re ".*$prompt $" {
send "info breakpoints\n"
expect {
-re "No breakpoints or watchpoints..*$prompt $" {
pass "Deleted all breakpoints"
}
-re ".*$prompt $" { fail "Deleted all breakpoints" }
timeout { fail "Deleted all breakpoints" }
}
}
timeout { fail "Deleted all breakpoints" }
}
}
-re ".*$prompt $" { fail "Deleted all breakpoints" }
timeout { fail "Deleted all breakpoints" }
}
delete_breakpoints
#
# test temporary breakpoint at function
@@ -223,11 +202,11 @@ gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*"
#
# test break at line number
#
send "tbreak 64\n"
send_gdb "tbreak 64\n"
expect {
-re "Breakpoint.*at.* file .*$srcfile, line 64.*$prompt $" { pass "Temporary breakpoint line number" }
-re ".*$prompt $" { pass "Temporary breakpoint line number" }
timeout { fail "(timeout) breakpoint line number" }
timeout { fail "breakpoint line number (timeout)" }
}
gdb_test "tbreak 60" "Breakpoint.*at.* file .*$srcfile, line 60.*" "Temporary breakpoint line number"
@@ -235,11 +214,11 @@ gdb_test "tbreak 60" "Breakpoint.*at.* file .*$srcfile, line 60.*" "Temporary br
#
# test break at line number in file
#
send "tbreak $srcfile:70\n"
send_gdb "tbreak $srcfile:70\n"
expect {
-re "Breakpoint.*at.* file .*$srcfile, line 70.*$prompt $" { pass "Temporary breakpoint line number in file" }
-re ".*$prompt $" { pass "Temporary breakpoint line number in file" }
timeout { fail "(timeout) breakpoint line number in file" }
timeout { fail "Temporary breakpoint line number in file (timeout)" }
}
gdb_test "tbreak $srcfile:66" "Breakpoint.*at.* file .*$srcfile, line 66.*" "Temporary breakpoint line number in file"
@@ -247,18 +226,7 @@ gdb_test "tbreak $srcfile:66" "Breakpoint.*at.* file .*$srcfile, line 66.*" "Te
#
# check to see what breakpoints are set (temporary this time)
#
send "info break\n"
expect {
-re "Num Type.*Disp Enb Address.*What.*
\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*
\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial at .*$srcfile:76.*
\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:64.*
\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:70.*$prompt $" {
pass "Temporary breakpoint info"
}
-re ".*$prompt $" { fail "Temporary breakpoint info" }
timeout { fail "(timeout) Temporary breakpoint info" }
}
gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial at .*$srcfile:76.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:64.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:70.*" "Temporary breakpoint info"
proc test_clear_command {} {
gdb_test "break main" "Breakpoint.*at.*"
@@ -274,55 +242,59 @@ proc test_clear_command {} {
#
proc test_next_with_recursion {} {
global prompt
global decimal
global prompt
global decimal
global noresults
global binfile
# FIXME: should be using runto
send "kill\n"
expect {
-re ".*Kill the program being debugged.*y or n. $" {
send "y\n"
exp_continue
}
-re ".*$prompt $" {}
timeout { fail "killing inferior" ; return }
if [istarget "d10v-*-*"] {
# Doesn't work right now.
return;
}
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
delete_breakpoints
}
gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial"
# Run until we call factorial with 6
if [istarget "*-*-vxworks*"] then {
send "run vxmain \"6\"\n"
send_gdb "run vxmain \"6\"\n"
} else {
gdb_run_cmd
}
expect {
-re "Break.* factorial .value=6. .*$prompt $" {}
timeout { fail "run to factorial(6)" ; return }
timeout { fail "run to factorial(6) (timeout)" ; return }
}
# Continue until we call factorial recursively with 5.
send "continue\n"
send_gdb "continue\n"
expect {
-re "Continuing.*Break.* factorial .value=5. .*$prompt $" {}
timeout { fail "continue to factorial(5)" ; return }
timeout { fail "continue to factorial(5) (timeout)" ; return }
}
# Do a backtrace just to confirm how many levels deep we are.
set result [gdb_test "backtrace" \
"#0\[ \t\]+ factorial .value=5..*" \
"backtrace from factorial(5)"]
"#0\[ \t\]+ factorial .value=5..*" \
"backtrace from factorial(5)"]
if $result!=0 then { return }
# Now a "next" should position us at the recursive call, which
# we will be performing with 4.
send "next\n"
send_gdb "next\n"
expect {
-re ".* factorial .value - 1.;.*$prompt $" {}
timeout { fail "next to recursive call (timeout)" ; return }
@@ -337,30 +309,37 @@ proc test_next_with_recursion {} {
delete_breakpoints
gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \
"next over recursive call"
"next over recursive call"
# OK, we should be back in the same stack frame we started from.
# Do a backtrace just to confirm.
set result [gdb_test "backtrace" \
"#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \
"backtrace from factorial(5)"]
if $result!=0 then { return }
"#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \
"backtrace from factorial(5.1)"]
if { $result != 0 } { return }
if { $noresults == 1 } { return }
if [target_info exists use_gdb_stub] {
gdb_breakpoint "exit"
gdb_test "continue" "Continuing..*Breakpoint .*exit .code=0.*" "continue until exit in recursive next test"
} else {
# Continue until we exit. Should not stop again.
# Don't bother to check the output of the program, that may be
# extremely tough for some remote systems.
gdb_test "continue"\
"Continuing.\[\r\n0-9\]+Program exited normally\\."\
gdb_test "continue"\
"Continuing.\[\r\n0-9\]+Program exited normally\\..*"\
"continue until exit in recursive next test"
}
}
test_clear_command
test_next_with_recursion
# Reset the default arguments for VxWorks
if [istarget "*-*-vxworks*"] then {
if [istarget "*-*-vxworks*"] {
set timeout 10
send "set args main\n"
verbose "Timeout is now $timeout seconds" 2
send_gdb "set args main\n"
expect -re ".*$prompt $" {}
}

View File

@@ -1,4 +1,4 @@
# Copyright (C) 1992 Free Software Foundation, Inc.
# Copyright (C) 92, 96, 1997 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -12,12 +12,13 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
# This file was written by Fred Fish. (fnf@cygnus.com)
# and modified by Bob Manson. (manson@cygnus.com)
if $tracelevel then {
strace $tracelevel
@@ -26,19 +27,16 @@ if $tracelevel then {
set prms_id 0
set bug_id 0
set prototypes 0
set testfile "callfuncs"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
# build the first test case
execute_anywhere "echo set prototypes 1 > ${objdir}/${subdir}/callfuncs.tmp"
if { [compile "-g ${srcdir}/${subdir}/${srcfile} -o ${binfile} "] != "" } {
execute_anywhere "rm -f ${objdir}/${subdir}/callfuncs.tmp"
set prototypes 1
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
set prototypes 0;
# built the second test case since we can't use prototypes
warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
execute_anywhere "echo set prototypes 0 > ${objdir}/${subdir}/callfuncs.tmp"
if { [compile "-g -DNO_PROTOTYPES ${srcdir}/${subdir}/${srcfile} -o ${binfile} "] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } {
perror "Couldn't compile ${testfile}.c"
return -1
}
@@ -46,39 +44,31 @@ if { [compile "-g ${srcdir}/${subdir}/${srcfile} -o ${binfile} "] != "" } {
# Create and source the file that provides information about the compiler
# used to compile the test case.
execute_anywhere "rm -f ${binfile}.ci"
if { [compile "-E ${srcdir}/${subdir}/compiler.c >> ${binfile}.ci"] != "" } {
perror "Couldn't make ${binfile}.ci"
return -1
if [get_compiler_info ${binfile}] {
return -1;
}
source ${binfile}.ci
# The a29k can't call functions, so don't even bother with this test.
if [istarget "a29k-*-udi"] then {
setup_xfail "a29k-*-udi" 2416
fail "a29k-*-udi can not call functions"
if [target_info exists gdb,cannot_call_functions] {
setup_xfail "*-*-*" 2416
fail "This target can not call functions"
continue
}
# The h8300 simulator can't call functions, so don't even bother with this test.
if [istarget "h8300*-*-*"] then {
setup_xfail "h8300*-*-*"
fail "h8300*-*-* simulator can not call functions"
continue
}
# Set the current language to C. This counts as a test. If it
# fails, then we skip the other tests.
proc set_lang_c {} {
global prompt
send "set language c\n"
send_gdb "set language c\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language c (timeout)" ; return 0 }
}
send "show language\n"
send_gdb "show language\n"
expect {
-re ".* source language is \"c\".*$prompt $" {
pass "set language to \"c\""
@@ -234,12 +224,13 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
send "set print sevenbit-strings\n" ; expect -re "$prompt $"
send "set print address off\n" ; expect -re "$prompt $"
send "set width 0\n" ; expect -re "$prompt $"
gdb_test "set print sevenbit-strings" ""
gdb_test "set print address off" ""
gdb_test "set width 0" ""
if [set_lang_c] then {
if [runto_main] then {
gdb_test "next" ".*"
do_function_calls
} else {
fail "C function calling tests suppressed"

View File

@@ -28,9 +28,9 @@ set prms_id 0
set bug_id 0
set testfile "run"
set srcfile ${srcdir}/$subdir/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -69,9 +69,8 @@ proc gdbvar_complex_if_while_test {} {
proc progvar_simple_if_test {} {
global prompt
global noargs
if $noargs {
if [target_info exists gdb,noargs] {
verbose "Skipping progvar_simple_if_test because of noargs."
return
}
@@ -86,9 +85,8 @@ proc progvar_simple_if_test {} {
proc progvar_simple_while_test {} {
global prompt
global noargs
if $noargs {
if [target_info exists gdb,noargs] {
verbose "Skipping progvar_simple_while_test because of noargs."
return
}
@@ -101,9 +99,8 @@ proc progvar_simple_while_test {} {
proc progvar_complex_if_while_test {} {
global prompt
global noargs
if $noargs {
if [target_info exists gdb,noargs] {
verbose "Skipping progvar_simple_if_while_test because of noargs."
return
}
@@ -115,9 +112,7 @@ proc progvar_complex_if_while_test {} {
}
proc if_while_breakpoint_command_test {} {
global noargs
if $noargs {
if [target_info exists gdb,noargs] {
verbose "Skipping if_while_breakpoint_command_test because of noargs."
return
}
@@ -127,7 +122,7 @@ proc if_while_breakpoint_command_test {} {
delete_breakpoints
gdb_test "break factorial" "Breakpoint.*at.*"
send "commands\n"
send_gdb "commands\n"
expect {
-re "End with" {
pass "commands in if_while_breakpoint_command_test"
@@ -144,9 +139,7 @@ proc if_while_breakpoint_command_test {} {
# Test that we can run the inferior from breakpoint commands.
proc infrun_breakpoint_command_test {} {
global noargs
if $noargs {
if [target_info exists gdb,noargs] {
verbose "Skipping infrun_breakpoint_command_test because of noargs."
return
}
@@ -173,9 +166,7 @@ factorial \\(value=3\\) at .*
}
proc breakpoint_command_test {} {
global noargs
if $noargs {
if [target_info exists gdb,noargs] {
verbose "Skipping breakpoint_command_test because of noargs."
return
}
@@ -197,7 +188,7 @@ proc user_defined_command_test {} {
gdb_test "set \$foo = 4" "" "set foo in user_defined_command_test"
send "define mycommand\n"
send_gdb "define mycommand\n"
expect {
-re "End with" {
pass "define mycommand in user_defined_command_test"

View File

@@ -1,4 +1,4 @@
# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
# Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -34,19 +34,16 @@ if ![isnative] then {
set testfile "coremaker"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
execute_anywhere "rm -f ${binfile}.ci"
if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
perror "Couldn't make ${binfile}.ci file"
return -1
if [get_compiler_info ${binfile}] {
return -1;
}
source ${binfile}.ci
# Create a core file named "corefile" rather than just "core", to
# avoid problems with sys admin types that like to regularly prune all
@@ -60,13 +57,10 @@ source ${binfile}.ci
# the name of the program to "core".
set found 0
catch "system \"(cd ${objdir}/${subdir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
# execute_anywhere "${binfile}"
# remote_exec "${binfile}"
foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
set exec_output [execute_anywhere "ls $i"]
if [ regexp "No such file or directory|not found" ${exec_output} ] {
continue
} else {
execute_anywhere "mv $i ${objdir}/${subdir}/corefile"
if [remote_file build exists $i] {
remote_exec build "mv $i ${objdir}/${subdir}/corefile"
set found 1
}
}
@@ -136,13 +130,14 @@ expect {
# See previous comments above, they are still applicable.
#
gdb_exit
close;
if $verbose>1 then {
send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n"
}
spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile
eval "spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile";
expect {
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$prompt $" {
pass "args: execfile -core=corefile"
@@ -159,16 +154,17 @@ expect {
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
close;
# Now restart normally.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# Test basic corefile recognition via core-file command.
send "core-file $objdir/$subdir/corefile\n"
send_gdb "core-file $objdir/$subdir/corefile\n"
expect {
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$prompt $" {
pass "core-file command"
@@ -189,7 +185,7 @@ gdb_test "print coremaker_data" "\\\$$decimal = 202"
gdb_test "print coremaker_bss" "\\\$$decimal = 10"
gdb_test "print coremaker_ro" "\\\$$decimal = 201"
setup_xfail "i*86-*-sysv4*" "i*86-*-linux*" "m68*-*-hpux*"
setup_xfail "i*86-*-sysv4*" "i*86-pc-linux*-gnu" "m68*-*-hpux*"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
gdb_test "print func2::coremaker_local" "\\\$$decimal = {0, 1, 2, 3, 4}"
@@ -197,22 +193,22 @@ gdb_test "print func2::coremaker_local" "\\\$$decimal = {0, 1, 2, 3, 4}"
# file correctly. I don't think the other tests do this.
# Haven't investigated this xfail
setup_xfail "m68k-*-hpux*" "i*86-*-sysv4*" "i*86-*-linux*"
setup_xfail "m68k-*-hpux*" "i*86-*-sysv4*" "i*86-pc-linux*-gnu"
gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp"
# Test ability to read mmap'd data
gdb_test "x/8bd buf1" ".*:.*0.*1.*2.*3.*4.*5.*6.*7" "accessing original mmap data in core file"
setup_xfail "*-*-sunos*" "*-*-ultrix*" "*-*-aix*"
send "x/8bd buf2\n"
send_gdb "x/8bd buf2\n"
expect {
-re ".*:.*0.*1.*2.*3.*4.*5.*6.*7.*$prompt $" {
pass "accessing mmapped data in core file"
}
-re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*" {
-re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*.*$prompt $" {
fail "accessing mmapped data (mapping failed at runtime)"
}
-re "0x.*:.*Cannot access memory at address 0x.*" {
-re "0x.*:.*Cannot access memory at address 0x.*$prompt $" {
fail "accessing mmapped data (mapping address not found in core file)"
}
-re ".*$prompt $" {

View File

@@ -74,10 +74,10 @@ proc bfddefault {} {
gdb_unload
set file_loaded 0
send "file $objdir/$subdir/$binfile\n"
send_gdb "file $objdir/$subdir/$binfile\n"
expect {
-re "A program is being debugged already. Kill it.*y or n." {
send "y\n"
send_gdb "y\n"
exp_continue
}
-re "Reading symbols from $objdir/$subdir/$binfile\[.\]+done\..*$prompt $" {
@@ -135,10 +135,10 @@ proc bfdexplicit {} {
return
}
send "file $objdir/$subdir/$binfile\n"
send_gdb "file $objdir/$subdir/$binfile\n"
expect {
-re "A program is being debugged already. Kill it.*y or n." {
send "y\n"
send_gdb "y\n"
exp_continue
}
-re "Reading symbols from $objdir/$subdir/$binfile\[.\]+done\..*$prompt $" {
@@ -166,7 +166,7 @@ proc test_ptype_functions {} {
global binfile
global bfdformat
global det_file
send "ptype main\n"
send_gdb "ptype main\n"
expect {
-re "type = int \[)(\]+\r\n$prompt $" {}
timeout { fail "(timeout) $binfile ($bfdformat) function main" ; return }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
@@ -29,19 +29,19 @@ set bug_id 0
proc test_convenience_variables {} {
global prompt
gdb_test "set \$foo = 101" " = 101\[\r\n\]+" \
gdb_test "set \$foo = 101" "" \
"Set a new convenience variable"
gdb_test "print \$foo" " = 101" \
"Print contents of new convenience variable"
gdb_test "set \$foo = 301" " = 301\[\r\n\]+" \
gdb_test "set \$foo = 301" "" \
"Set convenience variable to a new value"
gdb_test "print \$foo" " = 301" \
"Print new contents of convenience variable"
gdb_test "set \$_ = 11" " = 11\[\r\n\]+" \
gdb_test "set \$_ = 11" "" \
"Set convenience variable \$_"
gdb_test "print \$_" " = 11" \
@@ -111,7 +111,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
send_gdb "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
test_value_history
test_convenience_variables

File diff suppressed because it is too large Load Diff

View File

@@ -17,8 +17,8 @@
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
if [info exists nointerrupts] {
if $nointerrupts {
if [host_info exists name] {
if [board_info host exists gdb,nointerrupts] {
verbose "Skipping interrupt.exp because of nointerrupts."
continue
}
@@ -32,18 +32,20 @@ set prms_id 0
set bug_id 0
set testfile interrupt
set srcfile ${srcdir}/$subdir/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
if $noinferiorio {
if [target_info exists gdb,noinferiorio] {
verbose "Skipping interrupt.exp because of noinferiorio."
return
}
gdb_start
if ![file exists $binfile] then {
perror "$binfile does not exist."
@@ -51,12 +53,15 @@ if ![file exists $binfile] then {
} else {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
# Hope this is unix :-)
gdb_test "shell stty intr '^C'" "" \
"set interrupt character in interrupt.exp"
if [runto_main] then {
send "continue\n"
send_gdb "continue\n"
expect {
-re "\r\ntalk to me baby\r\n$" {}
-re "\r\ntalk to me baby\r\n$" {
pass "child process is alive"
}
timeout { fail "run (timeout)" }
eof { fail "run (eof)" }
}
@@ -64,29 +69,35 @@ if ![file exists $binfile] then {
# program's output. Under dejagnu (but not interactively) for
# SunOS4, it only appears once. Don't worry about it, I imagine
# dejagnu has just done something to the tty modes.
send "a\n"
send_gdb "a\n"
expect {
-re "^a\r\n(|a\r\n)$" {}
-re "^a\r\n(|a\r\n)$" {
pass "child process ate our char"
}
timeout { fail "echo a (timeout)" }
eof { fail "echo a (eof)" }
}
# Wait until the program is in the read system call again.
exec sleep 2
sleep 2
send "\003"
send_gdb "\003"
expect {
-re "Program received signal SIGINT.*$prompt $" {
pass "send control C"
pass "send_gdb control C"
}
-re ".*$prompt $" { fail "send control C" }
timeout { fail "send control C (timeout)" }
eof { fail "send control C (eof)" }
-re ".*$prompt $" { fail "send_gdb control C" }
timeout { fail "send_gdb control C (timeout)" }
eof { fail "send_gdb control C (eof)" }
}
setup_xfail "i*86-*-linux*"
send "p func1 ()\n"
send_gdb "p func1 ()\n"
expect {
-re " = 4.*$prompt $" { pass "call function when asleep" }
-re ".*Program received signal SIGSEGV.*$prompt $" {
setup_xfail "i*86-pc-linux*-gnu"
fail "child died when we called func1, skipped rest of tests"
return
}
-re "$prompt $" { fail "call function when asleep (wrong output)" }
default {
@@ -94,7 +105,7 @@ if ![file exists $binfile] then {
# don't use PRSABORT), but apparently also happens on
# other machines as well.
setup_xfail "sparc-*-solaris2*"
setup_xfail "sparc*-*-solaris2*"
setup_xfail "mips-*-ultrix*"
setup_xfail "hppa*-*-*"
setup_xfail "i386*-*-bsd*"
@@ -105,8 +116,8 @@ if ![file exists $binfile] then {
setup_xfail "*-*-hpux*"
setup_xfail "*-*-*lynx*"
fail "call function when asleep (stays asleep)"
# Send a newline to wake it up
send "\n"
# Send_Gdb a newline to wake it up
send_gdb "\n"
gdb_test "" " = 4" "call function after waking it"
}
# eof { fail "call function when asleep (eof)" }
@@ -120,18 +131,18 @@ if ![file exists $binfile] then {
# to wake the program, in which case the program now sends it
# back. We check for it either here or in the next expect
# command, because which one it ends up in is timing dependent.
send "continue\n"
send_gdb "continue\n"
# For some reason, i386-*-sysv4 gdb fails to issue the Continuing
# message, but otherwise appears normal (FIXME).
expect {
-re "^continue\r\nContinuing.\r\n(\r\n|)$" { pass "continue" }
-re "^continue\r\n\r\n" { fail "continue (missing Continuing.)" }
-re "$prompt $" { fail "continue" }
timeout { fail "continue" }
eof { fail "continue" }
timeout { fail "continue (timeout)" }
eof { fail "continue (eof)" }
}
send "data\n"
send_gdb "data\n"
# The optional leading \r\n is in case we sent a newline above
# to wake the program, in which case the program now sends it
# back.
@@ -141,11 +152,11 @@ if ![file exists $binfile] then {
eof { fail "echo data (eof)" }
}
setup_xfail "i*86-*-linux*"
send "\004"
setup_xfail "i*86-pc-linux*-gnu"
send_gdb "\004"
expect {
-re "end of file.*Program exited normally.*$prompt $" {
pass "send end of file"
pass "send_gdb end of file"
}
-re "$prompt $" { fail "send end of file" }
timeout { fail "send end of file (timeout)" }

View File

@@ -7,27 +7,21 @@ set bug_id 0
set testfile langs
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcdir}/${subdir}/langs0.c -g -c -o ${binfile}0.o "] != "" } {
perror "Couldn't compile langs0.c to object"
return -1
if [is_remote host] {
remote_download host ${srcdir}/${subdir}/langs1.f
remote_download host ${srcdir}/${subdir}/langs2.cxx
}
if { [compile "${srcdir}/${subdir}/langs1.c -g -c -o ${binfile}1.o "] != "" } {
perror "Couldn't compile langs1.c to object"
return -1
}
if { [compile "${srcdir}/${subdir}/langs2.c -g -c -o ${binfile}2.o "] != "" } {
perror "Couldn't compile langs2.c to object"
return -1
}
if { [compile "${binfile}0.o ${binfile}1.o ${binfile}2.o -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/langs0.c ${srcdir}/${subdir}/langs1.c ${srcdir}/${subdir}/langs2.c" "${binfile}" executable {debug}] != "" } {
perror "Couldn't link langs."
return -1
}
execute_anywhere "rm -f ${binfile}.ci"
if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
perror "Couldn't make ${testfile}.ci file"
return -1
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
}
gdb_exit
@@ -35,8 +29,6 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
source ${binfile}.ci
gdb_test "b langs0" {Function "langs0" not defined\.} \
"break on nonexistent function in langs.exp"
@@ -85,8 +77,12 @@ if [runto csub] then {
if $noresults==1 then { return }
gdb_test "cont" "Program exited normally\\." \
"continue to exit in langs.exp"
if [target_info exists use_gdb_stub] {
gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
} else {
gdb_test "cont" "Program exited normally\\." \
"continue to exit in langs.exp"
}
}
return 0

View File

@@ -28,29 +28,20 @@ set bug_id 0
set testfile "list"
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "-g -c ${srcdir}/${subdir}/list0.c"] != "" } {
perror "Couldn't compile ${testfile}0.c to object"
return -1
}
execute_anywhere "mv list0.o ${binfile}0.o"
if { [compile "-g -c ${srcdir}/${subdir}/list1.c"] != "" } {
perror "Couldn't compile ${testfile}1.c to object"
return -1
}
execute_anywhere "mv list1.o ${binfile}1.o"
if { [compile "${binfile}0.o ${binfile}1.o -o ${binfile}"] != "" } {
perror "Couldn't link ${testfile}."
# Need to download the header to the host.
remote_download host ${srcdir}/${subdir}/list0.h list0.h
if { [gdb_compile "${srcdir}/${subdir}/list0.c ${srcdir}/${subdir}/list1.c" ${binfile} executable {debug}] != "" } {
perror "Couldn't compile list0.c list1.c to executable ${binfile}"
return -1
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
execute_anywhere "rm -f ${binfile}.ci"
if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
perror "Couldn't make ${binfile}.ci file"
return -1
if [get_compiler_info ${binfile}] {
return -1;
}
source ${binfile}.ci
#
# Local utility proc just to set and verify listsize
@@ -60,18 +51,15 @@ source ${binfile}.ci
proc set_listsize { arg } {
global prompt
send "set listsize $arg\n"
expect {
-re "set listsize $arg\[\r\n\]+$prompt $" {}
-re ".*$prompt $" { fail "setting listsize to $arg" ; return 0 }
timeout { fail "set listsize to $arg (timeout)" ; return 0 }
if [gdb_test "set listsize $arg" "" "setting listsize to $arg"] {
return 0;
}
send "show listsize\n"
expect {
-re "Number of source lines .* is $arg.\r\n.*$prompt $" {}
-re ".*$prompt $" { fail "listsize not set to $arg" ; return 0 }
timeout { fail "show listsize (timeout)" ; return 0 }
if { $arg <= 0 } {
set arg "unlimited";
}
if [gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg"] {
return 0;
}
return 1
}
@@ -85,342 +73,72 @@ proc test_listsize {} {
# Show default size
send "show listsize\n"
expect {
-re "Number of source lines gdb will list by default is 10.*$prompt $" {
pass "show default list size"
}
-re ".*$prompt $" {
fail "show default listsize (10)"
}
timeout {
fail "show listsize (timeout)"
}
}
gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
# Show the default lines
# The second case is for optimized code, it is still correct.
# This doesn't work for COFF targets.
setup_xfail "a29k-*-udi"
send "list\n"
expect {
-re "1\[ \t\]+#include \"list0.h\".*10\[ \t\]+x = 0;\r\n$prompt $" {
pass "list default lines around main"
}
-re "2.*11\[ \t\]+foo .x\[+)\]+;\r\n$prompt $" {
pass "list default lines around main"
}
-re ".*$prompt $" {
fail "list default lines around main"
}
timeout {
fail "list default lines around main (timeout)"
}
}
gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*10\[ \t\]+x = 0;|2.*11\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
# Ensure we can limit printouts to one line
if [ set_listsize 1 ] then {
setup_xfail "*-*-*"
send "list 1\n"
expect {
-re "1\[ \t\]+#include \"list0.h\"\r\n$prompt $" {
pass "list line 1 with listsize 1"
}
-re "list 1\r\n$prompt $" {
fail "list line 1 with listsize 1"
}
-re ".*$prompt $" {
fail "list line 1 with listsize 1"
}
timeout {
fail "list line 1 with listsize 1 (timeout)"
}
}
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1"
setup_xfail "*-*-*"
send "list 2\n"
expect {
-re "2\[ \t\]+\r\n$prompt $" {
pass "list line 2 with listsize 1"
}
-re "list 2\r\n$prompt $" {
fail "list line 2 with listsize 1"
}
-re ".*$prompt $" {
fail "list line 2 with listsize 1"
}
timeout {
fail "list line 2 with listsize 1 (timeout)"
}
}
gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1"
}
# Try just two lines
if [ set_listsize 2 ] then {
send "list 1\n"
expect {
-re "1\[ \t\]+#include \"list0.h\"\r\n$prompt $" {
pass "list line 1 with listsize 2"
}
-re ".*$prompt $" {
fail "list line 1 with listsize 2"
}
timeout {
fail "list line 1 with listsize 2 (timeout)"
}
}
send "list 2\n"
expect {
-re "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+\r\n$prompt $" {
pass "list line 2 with listsize 2"
}
-re ".*$prompt $" {
fail "list line 2 with listsize 2"
}
timeout {
fail "list line 2 with listsize 2 (timeout)"
}
}
send "list 3\n"
expect {
-re "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+\r\n$prompt $" {
pass "list line 3 with listsize 2"
}
-re ".*$prompt $" {
fail "list line 3 with listsize 2"
}
timeout {
fail "list line 3 with listsize 2 (timeout)"
}
}
}
if [ set_listsize 2 ] {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 2"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2"
gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+" "list line 3 with listsize 2"
}
# Try small listsize > 1 that is an odd number
if [ set_listsize 3 ] then {
if [ set_listsize 3 ] {
setup_xfail "*-*-*"
send "list 1\n"
expect {
-re "1\[ \t\]+#include \"list0.h\"2\[ \t\]+\r\n$prompt $" {
pass "list line 1 with listsize 3"
}
-re "1\[ \t\]+#include \"list0.h\"\r\n$prompt $" {
fail "list line 1 with listsize 3"
}
-re ".*$prompt $" {
fail "list line 1 with listsize 3"
}
timeout {
fail "list line 1 with listsize 3 (timeout)"
}
}
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"2\[ \t\]+" "list line 1 with listsize 3"
setup_xfail "*-*-*"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+" "list line 2 with listsize 3"
setup_xfail "*-*-*"
send "list 2\n"
expect {
-re "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+\r\n$prompt $" {
pass "list line 2 with listsize 3"
}
-re "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+\r\n$prompt $" {
fail "list line 2 with listsize 3"
}
-re ".*$prompt $" {
fail "list line 2 with listsize 3"
}
timeout {
fail "list line 2 with listsize 3 (timeout)"
}
}
setup_xfail "*-*-*"
send "list 3\n"
expect {
-re "2\[ \t\]+\r\n3\[ \t\]+main \[(\]+\[)\]+\r\n4\[ \t\]+\{\r\n$prompt $" {
pass "list line 3 with listsize 3"
}
-re "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+\r\n$prompt $" {
fail "list line 3 with listsize 3"
}
-re ".*$prompt $" {
fail "list line 3 with listsize 3"
}
timeout {
fail "list line 3 with listsize 3 (timeout)"
}
}
gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3"
}
# Try small listsize > 2 that is an even number.
if [ set_listsize 4 ] then {
send "list 1\n"
expect {
-re "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+\r\n$prompt $" {
pass "list line 1 with listsize 4"
}
-re ".*$prompt $" {
fail "list line 1 with listsize 4"
}
timeout {
fail "list line 1 with listsize 4 (timeout)"
}
}
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 4"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+" "list line 2 with listsize 4"
send "list 2\n"
expect {
-re "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+\r\n$prompt $" {
pass "list line 2 with listsize 4"
}
-re ".*$prompt $" {
fail "list line 2 with listsize 4"
}
timeout {
fail "list line 2 with listsize 4 (timeout)"
}
}
send "list 3\n"
expect {
-re "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{\r\n$prompt $" {
pass "list line 3 with listsize 4"
}
-re ".*$prompt $" {
fail "list line 3 with listsize 4"
}
timeout {
fail "list line 3 with listsize 4 (timeout)"
}
}
send "list 4\n"
expect {
-re "2\[ \t\]+\r\n.*5\[ \t\]+int x;\r\n$prompt $" {
pass "list line 4 with listsize 4"
}
-re ".*$prompt $" {
fail "list line 4 with listsize 4"
}
timeout {
fail "list line 4 with listsize 4 (timeout)"
}
}
gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4"
gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4"
}
# Try a size larger than the entire file.
if [ set_listsize 100 ] then {
send "list 1\n"
expect {
-re "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}\r\n$prompt $" {
pass "list line 1 with listsize 100"
}
-re ".*$prompt $" {
fail "list line 1 with listsize 100"
}
timeout {
fail "list line 1 with listsize 100 (timeout)"
}
}
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}" "list line 1 with listsize 100"
send "list 10\n"
expect {
-re "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}\r\n$prompt $" {
pass "list line 10 with listsize 100"
}
-re ".*$prompt $" {
fail "list line 10 with listsize 100"
}
timeout {
fail "list line 10 with listsize 100 (timeout)"
}
}
gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}" "list line 10 with listsize 100"
}
# Try listsize of 0 which suppresses printing.
send "set listsize 0\n"
expect {
-re "set listsize 0\[\r\n\]+$prompt $" {
setup_xfail "*-*-*"
send "show listsize\n"
expect {
-re "Number of source lines .* is 0.\r\n.*$prompt $" {
pass "listsize of 0 displays as 0"
}
-re "Number of source lines .* is unlimited.\r\n.*$prompt $" {
fail "listsize of 0 displays as unlimited"
}
-re ".*$prompt $" {
fail "listsize not set to unlimited (0)"
}
timeout {
fail "show listsize (timeout)"
}
}
send "list 1\n"
expect {
-re "list 1\[\r\n\]+$prompt $" {
pass "listsize of 0 suppresses output"
}
-re ".*$prompt $" {
fail "listsize of 0 should suppress output"
}
timeout {
fail "listsize of 0 suppresses output (timeout)"
}
}
}
-re ".*$prompt $" {
fail "setting listsize to 0"
}
timeout {
fail "set listsize to 0 (timeout)"
}
}
set_listsize 0
gdb_test "list 1" "" "listsize of 0 suppresses output"
# Try listsize of -1 which is special, and means unlimited.
send "set listsize -1\n"
expect {
-re "set listsize -1\[\r\n\]+$prompt $" {
send "show listsize\n"
expect {
-re "Number of source lines .* is unlimited.\r\n.*$prompt $" {
pass "listsize of -1 displays as unlimited"
}
-re ".*$prompt $" {
fail "listsize not set to unlimited (-1)"
}
timeout {
fail "show listsize (timeout)"
}
}
setup_xfail "*-*-*"
send "list 1\n"
expect {
-re "1\[ \t\]+#include .*\r\n39\[ \t\]+\}\r\n$prompt $" {
pass "list line 1 with unlimited listsize"
}
-re "list 1\[\r\n\]+$prompt $" {
fail "listsize of -1 (unlimited) suppresses output"
}
timeout {
fail "list line 1 with unlimited listsize (timeout)"
}
}
}
-re ".*$prompt $" {
fail "setting listsize to -1"
}
timeout {
fail "set listsize to -1 (timeout)"
}
}
set_listsize -1
setup_xfail "*-*-*"
gdb_test "list 1" "1\[ \t\]+#include .*\r\n39\[ \t\]+\}" "list line 1 with unlimited listsize"
}
#
@@ -432,39 +150,11 @@ proc test_list_include_file {} {
# FIXME Fails for COFF as well, I think.
setup_xfail "a29k-*-udi"
send "list list0.h:1\n"
expect {
-re "1\[ \t\]+/\[*\]+ An include file .*5\[ \t\]+foo \[(\]+x\[)\]+\r\n$prompt $" {
pass "list line 1 in include file"
}
-re "No source file named list0.h.\r\n$prompt $" {
fail "list line 1 in include file"
}
-re ".*$prompt $" {
fail "list line 1 in include file"
}
timeout {
fail "list line 1 in include file (timeout)"
}
}
gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*5\[ \t\]+foo \[(\]+x\[)\]+" "list line 1 in include file"
# FIXME Fails for COFF as well, I think.
setup_xfail "a29k-*-udi"
send "list list0.h:100\n"
expect {
-re "Line number 95 out of range; .*list0.h has 36 lines.\r\n$prompt $" {
pass "list message for lines past EOF"
}
-re "No source file named list0.h.\r\n$prompt $" {
fail "list message for lines past EOF"
}
-re ".*$prompt $" {
fail "list message for lines past EOF"
}
timeout {
fail "list message for lines past EOF (timeout)"
}
}
gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 36 lines." "list message for lines past EOF"
}
#
@@ -476,7 +166,7 @@ proc test_list_filename_and_number {} {
set testcnt 0
send "list list0.c:1\n"
send_gdb "list list0.c:1\n"
expect {
-re "1\[ \t\]+#include \"list0.h\".*5\[ \t\]+int x;\r\n$prompt $" {
incr testcnt
@@ -484,7 +174,7 @@ proc test_list_filename_and_number {} {
-re ".*$prompt $" { fail "list list0.c:1" ; return }
timeout { fail "list list0.c:1 (timeout)" ; return }
}
send "list list0.c:10\n"
send_gdb "list list0.c:10\n"
expect {
-re "5\[ \t\]+int x;.*14\[ \t\]+foo .x\[+)\]+;\r\n$prompt $" {
incr testcnt
@@ -492,7 +182,7 @@ proc test_list_filename_and_number {} {
-re ".*$prompt $" { fail "list list.c:10" ; return }
timeout { fail "list list.c:10 (timeout)" ; return }
}
send "list list1.c:1\n"
send_gdb "list list1.c:1\n"
expect {
-re "1\[ \t\]+void.*5\[ \t\]+printf \[(\]+.*\[)\]+;\r\n$prompt $" {
incr testcnt
@@ -500,7 +190,7 @@ proc test_list_filename_and_number {} {
-re ".*$prompt $" { fail "list list1.c:1" ; return }
timeout { fail "list list1.c:1 (timeout)" ; return }
}
send "list list1.c:12\n"
send_gdb "list list1.c:12\n"
expect {
-re "7\[ \t\]+long_line \[(\]+.*\[)\]+;.*14\[ \t\]+\}\r\n.*$prompt $" {
incr testcnt
@@ -523,56 +213,17 @@ proc test_list_function {} {
# in include files, which breaks this test.
# SunPRO cc is the second case below, it's also correct.
setup_xfail "a29k-*-udi"
send "list main\n"
expect {
-re "1\[ \t\]+#include .*8\[ \t\]+breakpoint\[(\]\[)\]+;\r\n$prompt $" {
pass "list function in source file 1"
}
-re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" {
pass "list function in source file 1"
}
-re ".*$prompt $" { fail "list main" ; return }
timeout { fail "list main (timeout)" ; return }
}
gdb_test "list main" "(5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\]+#include .*8\[ \t\]+breakpoint\[(\]\[)\]+;)" "list function in source file 1"
# Ultrix gdb takes the second case below; it's also correct.
# SunPRO cc is the third case.
send "list bar\n"
expect {
-re "1\[ \t\]+void.*8\[ \t\]+\}\r\n$prompt $" {
pass "list function in source file 2"
}
-re "1\[ \t\]+void.*7\[ \t\]*long_line ..;\r\n$prompt $" {
pass "list function in source file 2"
}
-re "1\[ \t\]+void.*7\[ \t\]*long_line ..;.*9\[ \t\]*\r\n$prompt $" {
pass "list function in source file 2"
}
-re ".*$prompt $" { fail "list bar" ; return }
timeout { fail "list bar (timeout)" ; return }
}
gdb_test "list bar" "(1\[ \t\]+void.*7\[ \t\]*long_line ..;.*9\[ \t\]*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;)" "list function in source file 2"
# Test "list function" for C include file
# Ultrix gdb is the second case, still correct.
# SunPRO cc is the third case.
setup_xfail "powerpc-*-*"
send "list foo\n"
expect {
-re "2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$prompt $" {
pass "list function in include file"
}
-re "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$prompt $" {
pass "list function in include file"
}
-re "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$prompt $" {
pass "list function in include file"
}
-re ".*main \[)(\]+.*$prompt $" {
fail "list function in include file"
}
-re ".*$prompt $" { fail "list foo (in include file)" ; return }
timeout { fail "list foo (timeout)" ; return }
}
gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file"
}
proc test_list_forward {} {
@@ -580,28 +231,28 @@ proc test_list_forward {} {
set testcnt 0
send "list list0.c:10\n"
send_gdb "list list0.c:10\n"
expect {
-re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" { incr testcnt }
-re ".*$prompt $" { fail "list list0.c:10" ; return }
timeout { fail "list list0.c:10 (timeout)" ; return }
}
send "list\n"
send_gdb "list\n"
expect {
-re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" { incr testcnt }
-re ".*$prompt $" { fail "list 15-24" ; return }
timeout { fail "list 15-24 (timeout)" ; return }
}
send "list\n"
send_gdb "list\n"
expect {
-re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" { incr testcnt }
-re ".*$prompt $" { fail "list 25-34" ; return }
timeout { fail "list 25-34 (timeout)" ; return }
}
send "list\n"
send_gdb "list\n"
expect {
-re "35\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}\r\n$prompt $" { incr testcnt }
-re ".*$prompt $" { fail "list 35-42" ; return }
@@ -616,28 +267,28 @@ proc test_list_backwards {} {
set testcnt 0
send "list list0.c:33\n"
send_gdb "list list0.c:33\n"
expect {
-re "28\[ \t\]+foo \[(\]+.*\[)\]+;.*37\[ \t\]+\r\n$prompt $" { incr testcnt }
-re ".*$prompt $" { fail "list list0.c:33" ; return }
timeout { fail "list list0.c:33 (timeout)" ; return }
}
send "list -\n"
send_gdb "list -\n"
expect {
-re "18\[ \t\]+foo \[(\]+.*\[)\]+;.*27\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" { incr testcnt }
-re ".*$prompt $" { fail "list 18-27" ; return }
timeout { fail "list 18-27 (timeout)" ; return }
}
send "list -\n"
send_gdb "list -\n"
expect {
-re "8\[ \t\]+breakpoint\[(\]\[)\];.*17\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" { incr testcnt }
-re ".*$prompt $" { fail "list 8-17" ; return }
timeout { fail "list 8-17 (timeout)" ; return }
}
send "list -\n"
send_gdb "list -\n"
expect {
-re "1\[ \t\]+#include .*7\[ \t\]+set_debug_traps\[(\]\[)\]+;\r\n$prompt $" { incr testcnt }
-re ".*$prompt $" { fail "list 1-7" ; return }
@@ -654,68 +305,19 @@ proc test_list_backwards {} {
proc test_list_range {} {
global prompt
send "list list0.c:2,list0.c:5\n"
expect {
-re "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;\r\n$prompt $" {
pass "list range; filename:line1,filename:line2"
}
-re ".*$prompt $" { fail "list list0.c:2,list0.c:5" }
timeout { fail "list list0.c:2,list0.c:5 (timeout)" }
}
gdb_test "list list0.c:2,list0.c:5" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;" "list range; filename:line1,filename:line2"
send "list 2,5\n"
expect {
-re "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;\r\n$prompt $" {
pass "list range; line1,line2"
}
-re ".*$prompt $" { fail "list 2,5" }
timeout { fail "list 2,5 (timeout)" }
}
gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;" "list range; line1,line2"
#send "list -1,6\n"
#expect {
#-re "Line number 0 out of range; .*list0.c has 39 lines.\r\n$prompt $" {
#pass "list range; lower bound negative"
#}
#-re ".*$prompt $" { fail "list -1,6" }
#timeout { fail "list -1,6 (timeout)" }
#}
# gdb_test "list -1,6" "Line number 0 out of range; .*list0.c has 39 lines." "list range; lower bound negative"
#send "list -100,-40\n"
#expect {
#-re "Line number -60 out of range; .*list0.c has 39 lines.\r\n$prompt $" {
#pass "list range; both bounds negative"
#}
#-re ".*$prompt $" { fail "-100,-40" }
#timeout { fail "-100,-40 (timeout)" }
#}
# gdb_test "list -100,-40" "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative"
send "list 30,43\n"
expect {
-re "30\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}\r\n$prompt $" {
pass "list range; upper bound past EOF"
}
-re ".*$prompt $" { fail "list 30,43" }
timeout { fail "list 30,43 (timeout)" }
}
gdb_test "list 30,43" "30\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}" "list range; upper bound past EOF"
send "list 43,100\n"
expect {
-re "Line number 43 out of range; .*list0.c has 42 lines.\r\n$prompt $" {
pass "list range; both bounds past EOF"
}
-re ".*$prompt $" { fail "43,100" }
timeout { fail "43,100 (timeout)" }
}
gdb_test "list 43,100" "Line number 43 out of range; .*list0.c has 42 lines." "list range; both bounds past EOF"
send "list list0.c:2,list1.c:17\n"
expect {
-re "Specified start and end are in different files.\r\n$prompt $" {
pass "list range, must be same files"
}
-re ".*$prompt $" { fail "list0.c:2,list1.c:17" }
timeout { fail "list0.c:2,list1.c:17 (timeout)" }
}
gdb_test "list list0.c:2,list1.c:17" "Specified start and end are in different files." "list range, must be same files"
}
#
@@ -731,7 +333,7 @@ proc test_list_filename_and_function {} {
# in include files, which breaks this test.
# SunPRO cc is the second case below, it's also correct.
setup_xfail "a29k-*-udi"
send "list list0.c:main\n"
send_gdb "list list0.c:main\n"
expect {
-re "1\[ \t\]+#include .*8\[ \t\]+breakpoint\[(\]\[)\]+;\r\n$prompt $" {
incr testcnt
@@ -748,7 +350,7 @@ proc test_list_filename_and_function {} {
# Not sure what the point of having this function be unused is.
# AIX is legitimately removing it.
setup_xfail "rs6000-*-aix*"
send "list list0.c:unused\n"
send_gdb "list list0.c:unused\n"
expect {
-re "36\[ \t\]+\}.*42\[ \t\]+\}\r\n$prompt $" {
incr testcnt
@@ -769,7 +371,7 @@ proc test_list_filename_and_function {} {
setup_xfail "powerpc-*-*" 1804
# FIXME Fails for COFF as well, I think.
setup_xfail "a29k-*-udi"
send "list list0.h:foo\n"
send_gdb "list list0.h:foo\n"
expect {
-re "2\[ \t\]+including file. This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$prompt $" {
incr testcnt
@@ -789,7 +391,7 @@ proc test_list_filename_and_function {} {
# Ultrix gdb is the second case.
# a29k-amd-udi is the third case.
send "list list1.c:bar\n"
send_gdb "list list1.c:bar\n"
expect {
-re "1\[ \t\]+void.*8\[ \t\]+\}\r\n$prompt $" {
incr testcnt
@@ -809,7 +411,7 @@ proc test_list_filename_and_function {} {
# Not sure what the point of having this function be unused is.
# AIX is legitimately removing it.
setup_xfail "rs6000-*-aix*"
send "list list1.c:unused\n"
send_gdb "list list1.c:unused\n"
expect {
-re "7\[ \t\]+long_line \[(\]\[)\];.*14\[ \t\]+\}\r\n.*$prompt $" {
incr testcnt
@@ -835,53 +437,11 @@ proc test_list_filename_and_function {} {
# contain the requested symbol, it will subsequently search all of the symtabs
# for the requested symbol.
send "list list0.c:foo\n"
expect {
-re "Function \"foo\" not defined in .*list0.c\r\n$prompt $" {
pass "list filename:function; wrong filename rejected"
}
-re "2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$prompt $" {
fail "list filename:function; wrong filename not rejected"
}
-re ".*main \[)(\]+.*$prompt $" {
fail "list filename:function; wrong filename not rejected"
}
-re ".*$prompt $" {
fail "list filename:function; wrong filename not rejected"
}
timeout {
fail "list filename:function; wrong filename (timeout)"
}
}
gdb_test "list list0.c:foo" "Function \"foo\" not defined in .*list0.c" "list filename:function; wrong filename rejected"
send "list foobar.c:main\n"
expect {
-re "No source file named foobar.c.\r\n$prompt $" {
pass "list filename:function; nonexistant file"
}
-re ".*$prompt $" {
fail "list filename:function; nonexistant file"
}
timeout {
fail "list filename:function; nonexistant file (timeout)"
}
}
gdb_test "list foobar.c:main" "No source file named foobar.c." "list filename:function; nonexistant file"
send "list list0.h:foobar\n"
expect {
-re "Function \"foobar\" not defined.\r\n$prompt $" {
pass "list filename:function; nonexistant function"
}
-re "No source file named list0.h.\r\n$prompt $" {
fail "list filename:function; nonexistant function"
}
-re ".*$prompt $" {
fail "list filename:function; nonexistant function"
}
timeout {
fail "list filename:function; nonexistant function (timeout)"
}
}
gdb_test "list list0.h:foobar" "Function \"foobar\" not defined." "list filename:function; nonexistant function"
}
@@ -902,7 +462,7 @@ proc test_forward_search {} {
# Test that GDB won't crash if the line being searched is extremely long.
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
set timeout [expr "$timeout + 300"]
verbose "Timeout is now $timeout seconds" 2
match_max 10000
gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 chars)"
@@ -917,17 +477,17 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if $usestubs {
send "step\n"
if [target_info exists use_gdb_stubs] {
send_gdb "step\n"
# if use stubs step out of the breakpoint() function.
expect {
-re "main.* at .*$prompt $" {}
-re ".*in .*start.*$prompt $" {}
timeout { fail "single step at breakpoint() (timeout)" ; return 0 }
}
}
send "set width 0\n"
expect -re "$prompt $"
gdb_test "set width 0" "" "set width 0"
test_listsize
if [ set_listsize 10 ] then {

View File

@@ -10,32 +10,21 @@ set bug_id 0
set testfile nodebug
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
# Get rid of any -g options (including -gstabs, -gdwarf, etc...
if [info exists target_info(target,cflags)] {
set saved_cflags $target_info(target,cflags)
regsub -all -- {[ ]-g[^ ]*} $target_info(target,cflags) { } target_info(target,cflags)
}
if { [compile "${srcdir}/${subdir}/${srcfile} -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
execute_anywhere "rm -f ${binfile}.ci"
if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
perror "Couldn't make ${binfile}.ci file"
return -1
}
if [info exists target_info(target,cflags)] {
set target_info(target,cflags) $saved_cflags
if [get_compiler_info ${binfile}] {
return -1;
}
source ${binfile}.ci
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
@@ -60,21 +49,27 @@ if [runto inner] then {
# even without -g, which should be accepted.
# Irix5, even though it is ELF, counts as "ecoff" because it
# encapsulates ecoff debugging info in a .mdebug section.
# Irix6 gcc omits no debug info at all for static functions and
# variables, so all tests involving statics fail.
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
gdb_test "p top" \
"{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* <top>"
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
gdb_test "whatis top" \
"(<(text variable|function), no debug info>|short \\(\\))"
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
gdb_test "ptype top" "(short|int) \\((|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
setup_xfail "mips-sgi-irix6*"
gdb_test "p middle" \
"{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* <middle>"
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
setup_xfail "mips-sgi-irix6*"
gdb_test "whatis middle" \
"(<(text variable|function), no debug info>|short \\(\\))"
setup_xfail "mips-sgi-irix6*"
gdb_test "ptype middle" "(short|int) \\((|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
gdb_test "p dataglobal" "= 3"
@@ -88,14 +83,17 @@ if [runto inner] then {
setup_xfail "rs6000*-*-aix*"
setup_xfail "powerpc*-*-aix*"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
gdb_test "p datalocal" "= 4"
setup_xfail "rs6000*-*-aix*"
setup_xfail "powerpc*-*-aix*"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
gdb_test "whatis datalocal" "<(data variable|variable), no debug info>"
setup_xfail "rs6000*-*-aix*"
setup_xfail "powerpc*-*-aix*"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
gdb_test "ptype datalocal" "<(data variable|variable), no debug info>"
gdb_test "p bssglobal" "= 0"
@@ -105,16 +103,20 @@ if [runto inner] then {
setup_xfail "rs6000*-*-aix*"
setup_xfail "powerpc*-*-aix*"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
gdb_test "p bsslocal" "= 0"
setup_xfail "rs6000*-*-aix*"
setup_xfail "powerpc*-*-aix*"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
gdb_test "whatis bsslocal" "<(data variable|variable), no debug info>"
setup_xfail "rs6000*-*-aix*"
setup_xfail "powerpc*-*-aix*"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
gdb_test "ptype bsslocal" "<(data variable|variable), no debug info>"
if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
gdb_test "backtrace 10" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main.*" \
"backtrace from inner in nodebug.exp"
# Or if that doesn't work, at least hope for the external symbols
@@ -125,11 +127,12 @@ if [runto inner] then {
# This test is not as obscure as it might look. `p getenv ("TERM")'
# is a real-world example, at least on many systems.
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" "mips-sgi-irix6*" }
gdb_test {p/c array_index("abcdef",2)} " = 99 'c'"
# Now, try that we can give names of file-local symbols which happen
# to be unique, and have it still work
if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
if [runto middle] then {
gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \
"backtrace from middle in nodebug.exp"

View File

@@ -27,9 +27,9 @@ set prms_id 0
set bug_id 0
set testfile "printcmds"
set srcfile ${srcdir}/$subdir/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -40,27 +40,14 @@ if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
proc set_lang_c {} {
global prompt
send "set language c\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language c (timeout)" ; return 0 }
if [gdb_test "set language c" "" "set language c"] {
return 0
}
send "show language\n"
expect {
-re ".* source language is \"c\".*$prompt $" {
pass "set language to \"c\""
return 1
}
-re ".*$prompt $" {
fail "setting language to \"c\""
return 0
}
timeout {
fail "can't show language (timeout)"
return 0
}
if [gdb_test "show language" ".* source language is \"c\".*"] {
return 0
}
return 1;
}
proc test_integer_literals_accepted {} {
@@ -408,7 +395,7 @@ proc test_print_all_chars {} {
proc test_print_repeats_10 {} {
global prompt
send "set print elements 1\n" ; expect -re "$prompt $"
gdb_test "set print elements 1" ""
gdb_test "p &ctable2\[0*16\]" " = \\(unsigned char \\*\\) \"a\"..."
gdb_test "p &ctable2\[1*16\]" " = \\(unsigned char \\*\\) \"a\"..."
gdb_test "p &ctable2\[2*16\]" " = \\(unsigned char \\*\\) \"a\"..."
@@ -426,7 +413,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"a\"..."
gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"a\"..."
send "set print elements 2\n" ; expect -re "$prompt $"
gdb_test "set print elements 2" ""
gdb_test "p &ctable2\[0*16\]" " = \\(unsigned char \\*\\) \"aX\"..."
gdb_test "p &ctable2\[1*16\]" " = \\(unsigned char \\*\\) \"aa\"..."
gdb_test "p &ctable2\[2*16\]" " = \\(unsigned char \\*\\) \"aa\"..."
@@ -444,7 +431,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aa\"..."
gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aa\"..."
send "set print elements 3\n" ; expect -re "$prompt $"
gdb_test "set print elements 3" ""
gdb_test "p &ctable2\[0*16\]" " = \\(unsigned char \\*\\) \"aXX\"..."
gdb_test "p &ctable2\[1*16\]" " = \\(unsigned char \\*\\) \"aaX\"..."
gdb_test "p &ctable2\[2*16\]" " = \\(unsigned char \\*\\) \"aaa\"..."
@@ -462,7 +449,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaa\"..."
gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaa\"..."
send "set print elements 4\n" ; expect -re "$prompt $"
gdb_test "set print elements 4" ""
gdb_test "p &ctable2\[0*16\]" " = \\(unsigned char \\*\\) \"aXXX\"..."
gdb_test "p &ctable2\[1*16\]" " = \\(unsigned char \\*\\) \"aaXX\"..."
gdb_test "p &ctable2\[2*16\]" " = \\(unsigned char \\*\\) \"aaaX\"..."
@@ -480,7 +467,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaa\"..."
gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaa\"..."
send "set print elements 5\n" ; expect -re "$prompt $"
gdb_test "set print elements 5" ""
gdb_test "p &ctable2\[0*16\]" " = \\(unsigned char \\*\\) \"aXXXX\"..."
gdb_test "p &ctable2\[1*16\]" " = \\(unsigned char \\*\\) \"aaXXX\"..."
gdb_test "p &ctable2\[2*16\]" " = \\(unsigned char \\*\\) \"aaaXX\"..."
@@ -498,7 +485,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaa\"..."
gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaa\"..."
send "set print elements 6\n" ; expect -re "$prompt $"
gdb_test "set print elements 6" ""
gdb_test "p &ctable2\[0*16\]" " = \\(unsigned char \\*\\) \"aXXXXX\"..."
gdb_test "p &ctable2\[1*16\]" " = \\(unsigned char \\*\\) \"aaXXXX\"..."
gdb_test "p &ctable2\[2*16\]" " = \\(unsigned char \\*\\) \"aaaXXX\"..."
@@ -516,7 +503,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaaa\"..."
gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaaa\"..."
send "set print elements 7\n" ; expect -re "$prompt $"
gdb_test "set print elements 7" ""
gdb_test "p &ctable2\[0*16\]" " = \\(unsigned char \\*\\) \"aXXXXXX\"..."
gdb_test "p &ctable2\[1*16\]" " = \\(unsigned char \\*\\) \"aaXXXXX\"..."
gdb_test "p &ctable2\[2*16\]" " = \\(unsigned char \\*\\) \"aaaXXXX\"..."
@@ -534,7 +521,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaaaa\"..."
gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaaaa\"..."
send "set print elements 8\n" ; expect -re "$prompt $"
gdb_test "set print elements 8" ""
gdb_test "p &ctable2\[0*16\]" " = \\(unsigned char \\*\\) \"aXXXXXXX\"..."
gdb_test "p &ctable2\[1*16\]" " = \\(unsigned char \\*\\) \"aaXXXXXX\"..."
gdb_test "p &ctable2\[2*16\]" " = \\(unsigned char \\*\\) \"aaaXXXXX\"..."
@@ -552,7 +539,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaa\"..."
gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaa\"..."
send "set print elements 9\n" ; expect -re "$prompt $"
gdb_test "set print elements 9" ""
gdb_test "p &ctable2\[0*16\]" " = \\(unsigned char \\*\\) \"aXXXXXXXX\"..."
gdb_test "p &ctable2\[1*16\]" " = \\(unsigned char \\*\\) \"aaXXXXXXX\"..."
gdb_test "p &ctable2\[2*16\]" " = \\(unsigned char \\*\\) \"aaaXXXXXX\"..."
@@ -570,7 +557,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaaa\"..."
gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaaa\"..."
send "set print elements 10\n" ; expect -re "$prompt $"
gdb_test "set print elements 10" ""
gdb_test "p &ctable2\[0*16\]" " = \\(unsigned char \\*\\) \"aXXXXXXXXX\"..."
gdb_test "p &ctable2\[1*16\]" " = \\(unsigned char \\*\\) \"aaXXXXXXXX\"..."
gdb_test "p &ctable2\[2*16\]" " = \\(unsigned char \\*\\) \"aaaXXXXXXX\"..."
@@ -588,7 +575,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaaaa\"..."
gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaaaa\"..."
send "set print elements 11\n" ; expect -re "$prompt $"
gdb_test "set print elements 11" ""
gdb_test "p &ctable2\[0*16\]" \
" = \\(unsigned char \\*\\) \"aXXXXXXXXXX\"..."
gdb_test "p &ctable2\[1*16\]" \
@@ -622,7 +609,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[15*16\]" \
" = \\(unsigned char \\*\\) 'a' <repeats 11 times>..."
send "set print elements 12\n" ; expect -re "$prompt $"
gdb_test "set print elements 12" ""
gdb_test "p &ctable2\[0*16\]" \
" = \\(unsigned char \\*\\) \"a\", 'X' <repeats 11 times>..."
gdb_test "p &ctable2\[1*16\]" \
@@ -656,7 +643,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[15*16\]" \
" = \\(unsigned char \\*\\) 'a' <repeats 12 times>..."
send "set print elements 13\n" ; expect -re "$prompt $"
gdb_test "set print elements 13" ""
gdb_test "p &ctable2\[0*16\]" \
" = \\(unsigned char \\*\\) \"a\", 'X' <repeats 12 times>..."
gdb_test "p &ctable2\[1*16\]" \
@@ -690,7 +677,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[15*16\]" \
" = \\(unsigned char \\*\\) 'a' <repeats 13 times>..."
send "set print elements 14\n" ; expect -re "$prompt $"
gdb_test "set print elements 14" ""
gdb_test "p &ctable2\[0*16\]" \
" = \\(unsigned char \\*\\) \"a\", 'X' <repeats 13 times>..."
gdb_test "p &ctable2\[1*16\]" \
@@ -724,7 +711,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[15*16\]" \
" = \\(unsigned char \\*\\) 'a' <repeats 14 times>..."
send "set print elements 15\n" ; expect -re "$prompt $"
gdb_test "set print elements 15" ""
gdb_test "p &ctable2\[0*16\]" \
" = \\(unsigned char \\*\\) \"a\", 'X' <repeats 14 times>..."
gdb_test "p &ctable2\[1*16\]" \
@@ -758,7 +745,7 @@ proc test_print_repeats_10 {} {
gdb_test "p &ctable2\[15*16\]" \
" = \\(unsigned char \\*\\) 'a' <repeats 15 times>..."
send "set print elements 16\n" ; expect -re "$prompt $"
gdb_test "set print elements 16" ""
gdb_test "p &ctable2\[0*16\]" \
" = \\(unsigned char \\*\\) \"a\", 'X' <repeats 15 times>..."
gdb_test "p &ctable2\[1*16\]" \
@@ -801,23 +788,23 @@ proc test_print_strings {} {
# Test that setting print elements unlimited doesn't completely suppress
# printing; this was a bug in older gdb's.
send "set print elements 0\n" ; expect -re "$prompt $"
gdb_test "set print elements 0" ""
gdb_test "p teststring" \
" = (.unsigned char .. )?\"teststring contents\""
send "set print elements 1\n" ; expect -re "$prompt $"
gdb_test "set print elements 1" ""
gdb_test "p teststring" \
" = (.unsigned char .. )?\"t\"\\.\\.\\."
send "set print elements 5\n" ; expect -re "$prompt $"
gdb_test "set print elements 5" ""
gdb_test "p teststring" \
" = (.unsigned char .. )?\"tests\"\\.\\.\\."
send "set print elements 19\n" ; expect -re "$prompt $"
gdb_test "set print elements 19" ""
gdb_test "p teststring" \
" = (.unsigned char .. )?\"teststring contents\""
send "set print elements 20\n" ; expect -re "$prompt $"
gdb_test "set print elements 20" ""
gdb_test "p teststring" \
" = (.unsigned char .. )?\"teststring contents\""
send "set print elements 8\n" ; expect -re "$prompt $"
gdb_test "set print elements 8" ""
gdb_test "p &ctable1\[0\]" \
" = \\(unsigned char \\*\\) \"\""
@@ -890,7 +877,7 @@ proc test_print_strings {} {
proc test_print_int_arrays {} {
global prompt
send "set print elements 24\n" ; expect -re "$prompt $"
gdb_test "set print elements 24" ""
gdb_test "p int1dim" \
" = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}"
@@ -916,8 +903,8 @@ proc test_print_char_arrays {} {
global prompt
global hex
send "set print elements 24\n" ; expect -re "$prompt $"
send "set print address on\n" ; expect -re "$prompt $"
gdb_test "set print elements 24" ""
gdb_test "set print address on" ""
gdb_test "p arrays" \
" = {array1 = \"abc\", array2 = \"d\", array3 = \"e\", array4 = \"fg\", array5 = \"hij\"}"
@@ -934,13 +921,13 @@ proc test_print_char_arrays {} {
gdb_test "p parrays->array5" " = \"hij\""
gdb_test "p &parrays->array5" " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex"
send "set print address off\n" ; expect -re "$prompt $"
gdb_test "set print address off" ""
}
proc test_print_string_constants {} {
global prompt
send "set print elements 50\n" ; expect -re "$prompt $"
gdb_test "set print elements 50" ""
setup_xfail "a29k-*-udi" 2416
gdb_test "p \"a string\"" " = \"a string\""
@@ -1006,15 +993,11 @@ gdb_test "print \$pc" "No registers\\."
gdb_load ${binfile}
send "set print sevenbit-strings\n" ; expect -re "$prompt $"
send "set print address off\n" ; expect -re "$prompt $"
send "set width 0\n" ; expect -re "$prompt $"
gdb_test "set print sevenbit-strings" ""
gdb_test "set print address off" ""
gdb_test "set width 0" ""
if [set_lang_c] then {
# On AIX, we can't print variables before we run the program. This is because
# the data segment and text segment are in the same range of addresses until
# they are relocated. Ick.
setup_xfail "rs6000-*-aix*"
gdb_test "p ctable1\[120\]" "120 'x'"
if [runto_main] then {

View File

@@ -30,17 +30,17 @@ set prms_id 0
set bug_id 0
set testfile "ptype"
set srcfile ${srcdir}/$subdir/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
execute_anywhere "rm -f ${binfile}.ci"
if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
perror "Couldn't make ${testfile}.ci file"
return -1
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
}
gdb_exit
@@ -48,14 +48,12 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
source ${binfile}.ci
# Test ptype of unnamed enumeration members before any action causes
# the partial symbol table to be expanded to full symbols. This fails
# with stabs compilers which fail to use a nameless stab (such as
# pre-2.4.5 versions of gcc and most non-gcc compilers).
send "ptype red1\n"
send_gdb "ptype red1\n"
expect {
-re "type = enum primary1_tag \{red1, green1, blue1\}.*$prompt $"\
{
@@ -75,7 +73,7 @@ expect {
# Here and elsewhere, we accept
# "long", "long int", or "int" for long variables (whatis.exp already
# has an XFAIL for "int" (Sun cc bug), so no need to fail it here).
send "ptype struct t_struct\n"
send_gdb "ptype struct t_struct\n"
expect {
-re "type = struct t_struct \{.*
(unsigned |)char v_char_member;.*
@@ -113,11 +111,11 @@ if [gdb_test "ptype v_t_struct_p->v_float_member" "type = float"]<0 then {
}
send "ptype struct link\n"
send_gdb "ptype struct link\n"
expect {
-re "type = struct link \{.*
struct link \[*\]next;.*
struct link \[*(\]+linkfunc\[)(\]+;.*
struct link \[*(\]+linkfunc\[)(\]+(struct link \[*\], int\[)\]|);.*
struct t_struct stuff.1..2..3.;.*
\}.*$prompt $" { pass "ptype linked list structure" }
-re ".*$prompt $" {
@@ -134,7 +132,7 @@ expect {
#
# test ptype command with unions
#
send "ptype union t_union\n"
send_gdb "ptype union t_union\n"
expect {
-re "type = union t_union \{.*
(unsigned |)char v_char_member;.*
@@ -149,11 +147,11 @@ expect {
}
send "ptype union tu_link\n"
send_gdb "ptype union tu_link\n"
expect {
-re "type = union tu_link .*
struct link \[*\]next;.*
struct link \[(\*\]+linkfunc\[)(\]+;.*
struct link \[(\*\]+linkfunc\[)(\]+(struct link \[*\], int\[)\]|);.*
struct t_struct stuff.1..2..3.;.*
\}.*$prompt $" { pass "ptype linked list union" }
-re ".*$prompt $" {
@@ -171,7 +169,7 @@ expect {
# test ptype command with enums
#
send "ptype primary\n"
send_gdb "ptype primary\n"
expect {
-re "type = enum .red, green, blue.*$prompt $" { pass "ptype unnamed enumeration" }
-re ".*$prompt $" { fail "ptype unnamed enumeration" }
@@ -179,7 +177,7 @@ expect {
}
send "ptype enum colors\n"
send_gdb "ptype enum colors\n"
expect {
-re "type = enum colors \{yellow, purple, pink\}.*$prompt $"\
{ pass "ptype named enumeration" }
@@ -191,7 +189,7 @@ expect {
#
# test ptype command with enums as typedef
#
send "ptype boolean\n"
send_gdb "ptype boolean\n"
expect {
-re "type = enum \{FALSE, TRUE\}.*$prompt $" { pass "ptype unnamed typedef'd enumeration" }
-re ".*$prompt $" { fail "ptype unnamed typedef'd enumeration" }
@@ -207,8 +205,7 @@ expect {
# GDB's behavior is correct; the type which the variable is defined
# as (51) doesn't have a name. Only 55 has a name.
setup_xfail "i*86-*-sysv4*"
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" }
gdb_test "whatis v_boolean" "type = boolean" \
"whatis unnamed typedef'd enum (compiler bug in IBM's xlc)"
@@ -221,7 +218,7 @@ gdb_test "ptype t_union3" "type = union \{.*
*double v_double_member;.*
*int v_int_member;.*\}" "printing typedef'd union"
send "ptype enum bvals\n"
send_gdb "ptype enum bvals\n"
expect {
-re "type = enum bvals \{false, true\}.*$prompt $" { pass "ptype named typedef'd enumf'd enum" }
-re ".*$prompt $" { fail "ptype named typedef'd enumeration" }
@@ -232,7 +229,7 @@ expect {
#
# test ptype command with out-of-order enum values
#
send "ptype enum misordered\n"
send_gdb "ptype enum misordered\n"
expect {
-re "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*$prompt $"\
{ pass "ptype misordered enumeration" }
@@ -244,7 +241,7 @@ expect {
#
# test ptype command with a named enum's value
#
send "ptype three\n"
send_gdb "ptype three\n"
expect {
-re "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*$prompt $"\
{ pass "ptype named enumeration member" }
@@ -253,7 +250,7 @@ expect {
}
send "ptype red\n"
send_gdb "ptype red\n"
expect {
-re "type = enum \{red, green, blue\}.*$prompt $"\
{ pass "ptype unnamed enumeration member" }
@@ -297,7 +294,7 @@ expect {
#}
send "ptype v_short\n"
send_gdb "ptype v_short\n"
expect {
-re "type = short(| int).*$prompt $" { pass "ptype short" }
-re ".*$prompt $" { fail "ptype short" }
@@ -321,7 +318,7 @@ expect {
#}
send "ptype v_int\n"
send_gdb "ptype v_int\n"
expect {
-re "type = int.*$prompt $" { pass "ptype int" }
-re ".*$prompt $" { fail "ptype int" }
@@ -482,8 +479,7 @@ expect {
#}
#
setup_xfail "i*86-*-sysv4*"
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" }
gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
#
@@ -608,7 +604,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
#
# test ptype command with nested structure and union
#
send "ptype struct outer_struct\n"
send_gdb "ptype struct outer_struct\n"
expect {
-re "type = struct outer_struct \{.*
int outer_int;.*
@@ -621,7 +617,7 @@ expect {
}
send "ptype struct inner_struct\n"
send_gdb "ptype struct inner_struct\n"
expect {
-re "type = struct inner_struct \{.*
int inner_int;.*
@@ -632,7 +628,7 @@ expect {
}
send "ptype union inner_union\n"
send_gdb "ptype union inner_union\n"
expect {
-re "type = union inner_union \{.*
int inner_union_int;.*
@@ -643,7 +639,7 @@ expect {
}
send "ptype nested_su\n"
send_gdb "ptype nested_su\n"
expect {
-re "type = struct outer_struct \{.*
int outer_int;.*
@@ -656,7 +652,7 @@ expect {
}
send "ptype nested_su.outer_int\n"
send_gdb "ptype nested_su.outer_int\n"
expect {
-re "type = int.*$prompt $" { pass "ptype outer int" }
-re ".*$prompt $" { fail "ptype outer int" }
@@ -664,7 +660,7 @@ expect {
}
send "ptype nested_su.inner_struct_instance\n"
send_gdb "ptype nested_su.inner_struct_instance\n"
expect {
-re "type = struct inner_struct \{.*
int inner_int;.*
@@ -675,7 +671,7 @@ expect {
}
send "ptype nested_su.inner_struct_instance.inner_int\n"
send_gdb "ptype nested_su.inner_struct_instance.inner_int\n"
expect {
-re "type = int.*$prompt $" { pass "ptype inner int" }
-re ".*$prompt $" { fail "ptype inner int" }
@@ -683,7 +679,7 @@ expect {
}
send "ptype nested_su.inner_union_instance\n"
send_gdb "ptype nested_su.inner_union_instance\n"
expect {
-re "type = union inner_union \{.*
int inner_union_int;.*

View File

@@ -1,4 +1,4 @@
# Copyright (C) 1992 Free Software Foundation, Inc.
# Copyright (C) 1992, 1996 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,9 +27,9 @@ set prms_id 0
set bug_id 0
set testfile "recurse"
set srcfile ${srcdir}/$subdir/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -41,12 +41,7 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# Only enabled for some targets merely because it has not been tested
# elsewhere.
if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"]} then {
# Preserve the old timeout, and set a new one that should be
# sufficient to avoid timing out during this test.
proc recurse_tests {} {
if [runto recurse] then {
# First we need to step over the assignment of b, so it has a known
@@ -99,7 +94,6 @@ if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"]} then {
"continue to recurse (a = 1)"
# Continue until second set of b (second instance).
setup_xfail "sparc*-*-sunos4*"
if [gdb_test "continue" \
"Continuing.*\[Ww\]atchpoint.*: b.*Old value = 5.*New value = 120.*return.*" \
"continue to second instance watchpoint, second time"] then {
@@ -127,6 +121,21 @@ if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"]} then {
return
}
}
}
# Only enabled for some targets merely because it has not been tested
# elsewhere.
if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"] || [istarget "sparclet-*-*"] || [istarget "m32r-*-elf"]} then {
# Preserve the old timeout, and set a new one that should be
# sufficient to avoid timing out during this test.
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
verbose "Timeout is now $timeout seconds" 2
recurse_tests
# Restore the preserved old timeout value.
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
}

View File

@@ -27,9 +27,9 @@ set prms_id 0
set bug_id 0
set testfile "return"
set srcfile ${srcdir}/$subdir/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -39,14 +39,14 @@ proc return_tests { } {
if { ! [ runto func1 ] } then { return 0 }
send "return\n"
send_gdb "return\n"
expect {
-re "Make .* return now.*y or n. $" {
send "y\n"
send_gdb "y\n"
exp_continue
}
-re "func1 ..;.*$prompt $" {
send "step\n"
send_gdb "step\n"
exp_continue
}
-re ".*in main after func1.*$prompt $" { pass "simple return" }
@@ -55,14 +55,14 @@ proc return_tests { } {
}
# Set breakpoints in other interesting functions.
send "break func2\n" ; expect -re ".*$prompt $"
send "break func3\n" ; expect -re ".*$prompt $"
gdb_test "break func2" "" "break func2"
gdb_test "break func3" "" "break func3"
gdb_test "continue" "return -5;"
send "return 5\n"
gdb_test "continue" "return -5;" "continue to return of -5"
send_gdb "return 5\n"
expect {
-re "Make .* return now.*y or n. $" {
send "y\n"
send_gdb "y\n"
exp_continue
}
-re ".*tmp2 = func2.*$prompt $" { }
@@ -73,16 +73,16 @@ proc return_tests { } {
gdb_test "p tmp2" ".* = 5" "correct value returned (integer test)"
gdb_test "continue" "return -5.0;"
send "return 5.0\n"
gdb_test "continue" "return -5.0;" "continue to return of -5.0"
send_gdb "return 5.0\n"
expect {
-re "Make .* return now.*y or n. $" {
send "y\n"
send_gdb "y\n"
exp_continue
}
-re ".*tmp3 = func3.*$prompt $" { }
-re "$prompt $" { fail "did not return (double test)" }
timeout { fail "(timeout) did not return (double test)" }
-re ".*tmp3 = func3.*$prompt $" { }
-re "$prompt $" { fail "did not return (double test)" }
timeout { fail "(timeout) did not return (double test)" }
}
gdb_test "next" "printf.*" "next over call to func3"
@@ -110,7 +110,7 @@ proc return_tests { } {
# is not xfailed.
setup_xfail "i*86-*-*" "sparc-*-solaris2.3*" "sparc-*-solaris2.4*"
gdb_test "p tmp3" ".* = 5" "correct value returned double test (known problem with i*86 and sparc solaris"
gdb_test "p tmp3" ".* = 5.*" "correct value returned double test (known problem with i*86 and sparc solaris"
}
@@ -121,4 +121,5 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
set timeout 30
return_tests

View File

@@ -26,15 +26,18 @@ if $tracelevel then {
set prms_id 0
set bug_id 0
set binfile "scope"
set srcfile $binfile.c
if ![file exists $objdir/$subdir/$binfile] then {
perror "$objdir/$subdir/$binfile does not exist."
return 0
set testfile "scope"
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/scope0.c ${srcdir}/${subdir}/scope1.c" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile scope0.c to object"
return -1
}
source gdb.base/scope0.ci
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
}
# Test locating various things when stopped just inside main, after
# running init(). To prevent cascading of errors, we report the
@@ -50,20 +53,20 @@ proc test_at_main {} {
# skip past init. There may be a call to __main at the start of
# main, so the first next may only get us to the init call.
send "next\n"
send_gdb "next\n"
expect {
-re "$decimal.*foo \\(\\);\r\n$prompt $" {
pass "next over init() in main"
}
-re "$decimal.*init \\(\\);\r\n$prompt $"\
{ send "next\n" ; exp_continue }
{ send_gdb "next\n" ; exp_continue }
-re "$prompt $" { fail "next over init() in main" ; return }
timeout { fail "(timeout) next over init() in main" ; return }
}
# Print scope0.c::filelocal, which is 1
send "print filelocal\n"
send_gdb "print filelocal\n"
expect {
-re "\\\$$decimal = 1\r\n$prompt $" { pass "print filelocal" }
-re "$prompt $" { fail "print filelocal" ; return }
@@ -72,13 +75,13 @@ proc test_at_main {} {
}
}
send "print 'scope0.c'::filelocal\n"
send_gdb "print 'scope0.c'::filelocal\n"
expect {
-re "\\\$$decimal = 1\r\n$prompt $" {
pass "print 'scope0.c'::filelocal at main"
}
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal\n"
send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope0.c'::filelocal at main" ; return }
@@ -89,7 +92,7 @@ proc test_at_main {} {
# Print scope0.c::filelocal_bss, which is 101
send "print filelocal_bss\n"
send_gdb "print filelocal_bss\n"
expect {
-re "\\\$$decimal = 101\r\n$prompt $" {
pass "print filelocal_bss"
@@ -100,13 +103,13 @@ proc test_at_main {} {
}
}
send "print 'scope0.c'::filelocal_bss\n"
send_gdb "print 'scope0.c'::filelocal_bss\n"
expect {
-re "\\\$$decimal = 101\r\n$prompt $" {
pass "print 'scope0.c'::filelocal_bss in test_at_main"
}
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
exp_continue
}
-re "$prompt $" {
@@ -123,7 +126,7 @@ proc test_at_main {} {
# No clue why the powerpc fails this test.
setup_xfail "powerpc-*-*"
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print filelocal_ro\n"
send_gdb "print filelocal_ro\n"
expect {
-re "\\\$$decimal = 201\r\n$prompt $" {
pass "print filelocal_ro in test_at_main"
@@ -140,13 +143,13 @@ proc test_at_main {} {
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
setup_xfail "powerpc-*-*"
send "print 'scope0.c'::filelocal_ro\n"
send_gdb "print 'scope0.c'::filelocal_ro\n"
expect {
-re "\\\$$decimal = 201\r\n$prompt $" {
pass "print 'scope0.c'::filelocal_ro"
}
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return }
@@ -158,13 +161,13 @@ proc test_at_main {} {
# Print scope1.c::filelocal, which is 2
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::filelocal\n"
send_gdb "print 'scope1.c'::filelocal\n"
expect {
-re "\\\$$decimal = 2\r\n$prompt $" {
pass "print 'scope1.c'::filelocal"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::filelocal" ; return }
@@ -176,13 +179,13 @@ proc test_at_main {} {
# Print scope1.c::filelocal_bss, which is 102
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::filelocal_bss\n"
send_gdb "print 'scope1.c'::filelocal_bss\n"
expect {
-re "\\\$$decimal = 102\r\n$prompt $" {
pass "print 'scope1.c'::filelocal_bss"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::filelocal_bss" ; return }
@@ -194,13 +197,13 @@ proc test_at_main {} {
# Print scope1.c::filelocal_ro, which is 202
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::filelocal_ro\n"
send_gdb "print 'scope1.c'::filelocal_ro\n"
expect {
-re "\\\$$decimal = 202\r\n$prompt $" {
pass "print 'scope1.c'::filelocal_ro"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
exp_continue
}
-re "$prompt " {fail "print 'scope1.c'::filelocal_ro" ; return }
@@ -211,7 +214,8 @@ proc test_at_main {} {
# Print scope1.c::foo::funclocal, which is 3
send "print foo::funclocal\n"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
send_gdb "print foo::funclocal\n"
expect {
-re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" }
-re "$prompt $" { fail "print foo::funclocal" ; return }
@@ -221,13 +225,13 @@ proc test_at_main {} {
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::foo::funclocal\n"
send_gdb "print 'scope1.c'::foo::funclocal\n"
expect {
-re "\\\$$decimal = 3\r\n$prompt $" {
pass "print 'scope1.c'::foo::funclocal"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::foo::funclocal" ; return }
@@ -238,7 +242,7 @@ proc test_at_main {} {
# Print scope1.c::foo::funclocal_ro, which is 203
send "print foo::funclocal_ro\n"
send_gdb "print foo::funclocal_ro\n"
expect {
-re "\\\$$decimal = 203\r\n$prompt $" {
pass "print foo::funclocal_ro"
@@ -250,12 +254,12 @@ proc test_at_main {} {
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::foo::funclocal_ro\n"
send_gdb "print 'scope1.c'::foo::funclocal_ro\n"
expect {
-re "\\\$$decimal = 203\r\n$prompt $" {
pass "print 'scope1.c'::foo::funclocal_ro" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro" ; return }
@@ -266,7 +270,7 @@ proc test_at_main {} {
# Print scope1.c::bar::funclocal, which is 4
send "print bar::funclocal\n"
send_gdb "print bar::funclocal\n"
expect {
-re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" }
-re "$prompt $" { fail "print bar::funclocal" ; return }
@@ -276,18 +280,18 @@ proc test_at_main {} {
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::bar::funclocal\n"
send_gdb "print 'scope1.c'::bar::funclocal\n"
expect {
-re "\\\$$decimal = 4\r\n$prompt $" {
pass "print 'scope1.c'::bar::funclocal"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::bar::funclocal" ; return }
timeout {
fail "print 'scope1.c'::bar::funclocal" ; return
fail "(timeout) print 'scope1.c'::bar::funclocal" ; return
}
}
}
@@ -300,7 +304,7 @@ proc test_at_foo {} {
global subdir
global gcc_compiled
send "next\n"
send_gdb "next\n"
expect {
-re ".*bar \\(\\);\r\n$prompt $" {}
-re "$prompt $" { fail "continue to foo()" ; return }
@@ -309,13 +313,13 @@ proc test_at_foo {} {
# Print scope0.c::filelocal, which is 1
send "print 'scope0.c'::filelocal\n"
send_gdb "print 'scope0.c'::filelocal\n"
expect {
-re "\\\$$decimal = 1\r\n$prompt $" {
pass "print 'scope0.c'::filelocal at foo"
}
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal\n"
send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope0.c'::filelocal at foo" ; return }
@@ -326,13 +330,13 @@ proc test_at_foo {} {
# Print scope0.c::filelocal_bss, which is 101
send "print 'scope0.c'::filelocal_bss\n"
send_gdb "print 'scope0.c'::filelocal_bss\n"
expect {
-re "\\\$$decimal = 101\r\n$prompt $" {
pass "print 'scope0.c'::filelocal_bss in test_at_foo"
}
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
exp_continue
}
-re "$prompt $" {
@@ -349,11 +353,11 @@ proc test_at_foo {} {
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
setup_xfail "powerpc-*-*"
send "print 'scope0.c'::filelocal_ro\n"
send_gdb "print 'scope0.c'::filelocal_ro\n"
expect {
-re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" }
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return }
@@ -367,13 +371,13 @@ proc test_at_foo {} {
# Print scope1.c::filelocal, which is 2
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::filelocal\n"
send_gdb "print 'scope1.c'::filelocal\n"
expect {
-re "\\\$$decimal = 2\r\n$prompt $" {
pass "print 'scope1.c'::filelocal at foo"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::filelocal at foo" ; return }
@@ -386,13 +390,13 @@ proc test_at_foo {} {
"print filelocal_bss at foo"
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::filelocal_bss\n"
send_gdb "print 'scope1.c'::filelocal_bss\n"
expect {
-re "\\\$$decimal = 102\r\n$prompt $" {
pass "print 'scope1.c'::filelocal_bss at foo"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::filelocal_bss at foo" }
@@ -405,11 +409,11 @@ proc test_at_foo {} {
"print filelocal_ro at foo"
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::filelocal_ro\n"
send_gdb "print 'scope1.c'::filelocal_ro\n"
expect {
-re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro at foo" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::filelocal_ro at foo" }
@@ -422,17 +426,19 @@ proc test_at_foo {} {
gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
gdb_test "print foo::funclocal" "\\\$$decimal = 3" \
"print foo::funclocal at foo"
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::foo::funclocal\n"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
send_gdb "print 'scope1.c'::foo::funclocal\n"
expect {
-re "\\\$$decimal = 3\r\n$prompt $" {
pass "print 'scope1.c'::foo::funclocal at foo"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::foo::funclocal at foo" }
@@ -446,17 +452,19 @@ proc test_at_foo {} {
gdb_test "print funclocal_bss" "\\\$$decimal = 103" \
"print funclocal_bss at foo"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \
"print foo::funclocal_bss at foo"
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::foo::funclocal_bss\n"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
send_gdb "print 'scope1.c'::foo::funclocal_bss\n"
expect {
-re "\\\$$decimal = 103\r\n$prompt $" {
pass "print 'scope1.c'::foo::funclocal_bss at foo"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n"
exp_continue
}
-re "$prompt $" {
@@ -472,17 +480,19 @@ proc test_at_foo {} {
gdb_test "print funclocal_ro" "\\\$$decimal = 203" \
"print funclocal_ro at foo"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \
"print foo::funclocal_ro at foo"
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::foo::funclocal_ro\n"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
send_gdb "print 'scope1.c'::foo::funclocal_ro\n"
expect {
-re "\\\$$decimal = 203\r\n$prompt $" {
pass "print 'scope1.c'::foo::funclocal_ro at foo"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro at foo" }
@@ -493,17 +503,19 @@ proc test_at_foo {} {
# Print scope1.c::bar::funclocal, which is 4
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
gdb_test "print bar::funclocal" "\\\$$decimal = 4" \
"print bar::funclocal at foo"
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::bar::funclocal\n"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
send_gdb "print 'scope1.c'::bar::funclocal\n"
expect {
-re "\\\$$decimal = 4\r\n$prompt $" {
pass "print 'scope1.c'::bar::funclocal at foo"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::bar::funclocal at foo" }
@@ -521,24 +533,26 @@ proc test_at_bar {} {
global subdir
global gcc_compiled
send "next\n"
send_gdb "next\n"
expect {
-re ".*$prompt $" {}
timeout { fail "next in bar()" ; return }
timeout { fail "(timeout) next in bar()" ; return }
}
# Print scope0.c::filelocal, which is 1
send "print 'scope0.c'::filelocal\n"
send_gdb "print 'scope0.c'::filelocal\n"
expect {
-re "\\\$$decimal = 1\r\n$prompt $" {
pass "print 'scope0.c'::filelocal at bar"
}
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal\n"
send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope0.c'::filelocal at bar" ; return }
-re "$prompt $" {
fail "print 'scope0.c'::filelocal at bar" ; return
}
timeout {
fail "(timeout) print 'scope0.c'::filelocal at bar" ; return
}
@@ -546,13 +560,13 @@ proc test_at_bar {} {
# Print scope0.c::filelocal_bss, which is 101
send "print 'scope0.c'::filelocal_bss\n"
send_gdb "print 'scope0.c'::filelocal_bss\n"
expect {
-re "\\\$$decimal = 101\r\n$prompt $" {
pass "print 'scope0.c'::filelocal_bss in test_at_bar"
}
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
exp_continue
}
-re "$prompt $" {
@@ -569,72 +583,92 @@ proc test_at_bar {} {
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
setup_xfail "powerpc-*-*"
send "print 'scope0.c'::filelocal_ro\n"
send_gdb "print 'scope0.c'::filelocal_ro\n"
expect {
-re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" }
-re "\\\$$decimal = 201\r\n$prompt $" {
pass "print 'scope0.c'::filelocal_ro at bar"
}
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return }
-re "$prompt $" {
fail "print 'scope0.c'::filelocal_ro at bar" ; return
}
timeout {
fail "(timeout) print 'scope0.c'::filelocal_ro" ; return
fail "(timeout) print 'scope0.c'::filelocal_ro at bar" ; return
}
}
# Print scope1.c::filelocal, which is 2
send "print filelocal\n"
send_gdb "print filelocal\n"
expect {
-re "\\\$$decimal = 2\r\n$prompt $" { pass "print filelocal" }
-re "$prompt $" { fail "print filelocal" ; return }
-re "\\\$$decimal = 2\r\n$prompt $" {
pass "print filelocal at bar"
}
-re "$prompt $" {
fail "print filelocal at bar" ; return
}
timeout {
fail "(timeout) print filelocal" ; return
fail "(timeout) print filelocal at bar" ; return
}
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::filelocal\n"
send_gdb "print 'scope1.c'::filelocal\n"
expect {
-re "\\\$$decimal = 2\r\n$prompt $" { pass "print 'scope1.c'::filelocal" }
-re "\\\$$decimal = 2\r\n$prompt $" {
pass "print 'scope1.c'::filelocal at bar"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::filelocal" ; return }
-re "$prompt $" {
fail "print 'scope1.c'::filelocal at bar" ; return
}
timeout {
fail "(timeout) print 'scope1.c'::filelocal" ; return
fail "(timeout) print 'scope1.c'::filelocal at bar" ; return
}
}
# Print scope1.c::filelocal_bss, which is 102
send "print filelocal_bss\n"
send_gdb "print filelocal_bss\n"
expect {
-re "\\\$$decimal = 102\r\n$prompt $" { pass "print filelocal_bss" }
-re "$prompt $" { fail "print filelocal_bss" ; return }
-re "\\\$$decimal = 102\r\n$prompt $" {
pass "print filelocal_bss at bar"
}
-re "$prompt $" {
fail "print filelocal_bss at bar" ; return
}
timeout {
fail "(timeout) print filelocal_bss" ; return
fail "(timeout) print filelocal_bss at bar" ; return
}
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::filelocal_bss\n"
send_gdb "print 'scope1.c'::filelocal_bss\n"
expect {
-re "\\\$$decimal = 102\r\n$prompt $" { pass "print 'scope1.c'::filelocal_bss" }
-re "\\\$$decimal = 102\r\n$prompt $" {
pass "print 'scope1.c'::filelocal_bss at bar"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::filelocal_bss" ; return }
-re "$prompt $" {
fail "print 'scope1.c'::filelocal_bss at bar" ; return
}
timeout {
fail "(timeout) print 'scope1.c'::filelocal_bss" ; return
fail "(timeout) print 'scope1.c'::filelocal_bss at bar" ; return
}
}
# Print scope1.c::filelocal_ro, which is 202
send "print filelocal_ro\n"
send_gdb "print filelocal_ro\n"
expect {
-re "\\\$$decimal = 202\r\n$prompt $" {
pass "print filelocal_ro in test_at_bar"
@@ -650,159 +684,212 @@ proc test_at_bar {} {
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::filelocal_ro\n"
send_gdb "print 'scope1.c'::filelocal_ro\n"
expect {
-re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro" }
-re "\\\$$decimal = 202\r\n$prompt $" {
pass "print 'scope1.c'::filelocal_ro at bar"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::filelocal_ro" ; return }
-re "$prompt $" {
fail "print 'scope1.c'::filelocal_ro at bar" ; return
}
timeout {
fail "(timeout) print 'scope1.c'::filelocal_ro" ; return
fail "(timeout) print 'scope1.c'::filelocal_ro at bar" ; return
}
}
# Print scope1.c::foo::funclocal, which is 3
send "print foo::funclocal\n"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
send_gdb "print foo::funclocal\n"
expect {
-re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" }
-re "$prompt $" { fail "print foo::funclocal" ; return }
-re "\\\$$decimal = 3\r\n$prompt $" {
pass "print foo::funclocal at bar"
}
-re "$prompt $" {
fail "print foo::funclocal at bar" ; return
}
timeout {
fail "(timeout) print foo::funclocal" ; return
fail "(timeout) print foo::funclocal at bar" ; return
}
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::foo::funclocal\n"
send_gdb "print 'scope1.c'::foo::funclocal\n"
expect {
-re "\\\$$decimal = 3\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal" }
-re "\\\$$decimal = 3\r\n$prompt $" {
pass "print 'scope1.c'::foo::funclocal at bar"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::foo::funclocal" ; return }
-re "$prompt $" {
fail "print 'scope1.c'::foo::funclocal at bar" ; return
}
timeout {
fail "(timeout) print 'scope1.c'::foo::funclocal" ; return
fail "(timeout) print 'scope1.c'::foo::funclocal at bar" ; return
}
}
# Print scope1.c::foo::funclocal_bss, which is 103
send "print foo::funclocal_bss\n"
send_gdb "print foo::funclocal_bss\n"
expect {
-re "\\\$$decimal = 103\r\n$prompt $" { pass "print foo::funclocal_bss" }
-re "$prompt $" { fail "print foo::funclocal_bss" ; return }
-re "\\\$$decimal = 103\r\n$prompt $" {
pass "print foo::funclocal_bss at bar"
}
-re "$prompt $" {
fail "print foo::funclocal_bss at bar" ; return
}
timeout {
fail "(timeout) print foo::funclocal_bss" ; return
fail "(timeout) print foo::funclocal_bss at bar" ; return
}
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::foo::funclocal_bss\n"
send_gdb "print 'scope1.c'::foo::funclocal_bss\n"
expect {
-re "\\\$$decimal = 103\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_bss" }
-re "\\\$$decimal = 103\r\n$prompt $" {
pass "print 'scope1.c'::foo::funclocal_bss at bar"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_bss" ; return }
-re "$prompt $" {
fail "print 'scope1.c'::foo::funclocal_bss at bar" ; return
}
timeout {
fail "(timeout) print 'scope1.c'::foo::funclocal_bss" ; return
fail "(timeout) print 'scope1.c'::foo::funclocal_bss at bar" ; return
}
}
# Print scope1.c::foo::funclocal_ro, which is 203
send "print foo::funclocal_ro\n"
send_gdb "print foo::funclocal_ro\n"
expect {
-re "\\\$$decimal = 203\r\n$prompt $" { pass "print foo::funclocal_ro" }
-re "$prompt $" { fail "print foo::funclocal_ro" ; return }
-re "\\\$$decimal = 203\r\n$prompt $" {
pass "print foo::funclocal_ro at bar"
}
-re "$prompt $" {
fail "print foo::funclocal_ro at bar" ; return
}
timeout {
fail "(timeout) print foo::funclocal_ro" ; return
fail "(timeout) print foo::funclocal_ro at bar" ; return
}
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::foo::funclocal_ro\n"
send_gdb "print 'scope1.c'::foo::funclocal_ro\n"
expect {
-re "\\\$$decimal = 203\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_ro" }
-re "\\\$$decimal = 203\r\n$prompt $" {
pass "print 'scope1.c'::foo::funclocal_ro at bar"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro" ; return }
-re "$prompt $" {
fail "print 'scope1.c'::foo::funclocal_ro at bar" ; return
}
timeout {
fail "(timeout) print 'scope1.c'::foo::funclocal_ro" ; return
fail "(timeout) print 'scope1.c'::foo::funclocal_ro at bar" ; return
}
}
# Print scope1.c::bar::funclocal, which is 4
send "print funclocal\n"
send_gdb "print funclocal\n"
expect {
-re "\\\$$decimal = 4\r\n$prompt $" { pass "print funclocal" }
-re "$prompt $" { fail "print funclocal" ; return }
-re "\\\$$decimal = 4\r\n$prompt $" {
pass "print funclocal at bar"
}
-re "$prompt $" {
fail "print funclocal at bar" ; return
}
timeout {
fail "(timeout) print funclocal" ; return
fail "(timeout) print funclocal at bar" ; return
}
}
send "print bar::funclocal\n"
send_gdb "print bar::funclocal\n"
expect {
-re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" }
-re "$prompt $" { fail "print bar::funclocal" ; return }
-re "\\\$$decimal = 4\r\n$prompt $" {
pass "print bar::funclocal at bar"
}
-re "$prompt $" {
fail "print bar::funclocal at bar" ; return
}
timeout {
fail "(timeout) print bar::funclocal" ; return
fail "(timeout) print bar::funclocal at bar" ; return
}
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::bar::funclocal\n"
send_gdb "print 'scope1.c'::bar::funclocal\n"
expect {
-re "\\\$$decimal = 4\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal" }
-re "\\\$$decimal = 4\r\n$prompt $" {
pass "print 'scope1.c'::bar::funclocal at bar"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::bar::funclocal" ; return }
-re "$prompt $" {
fail "print 'scope1.c'::bar::funclocal at bar" ; return
}
timeout {
fail "(timeout) print 'scope1.c'::bar::funclocal" ; return
fail "(timeout) print 'scope1.c'::bar::funclocal at bar" ; return
}
}
# Print scope1.c::bar::funclocal_bss, which is 104
send "print funclocal_bss\n"
send_gdb "print funclocal_bss\n"
expect {
-re "\\\$$decimal = 104\r\n$prompt $" { pass "print funclocal_bss" }
-re "$prompt $" { fail "print funclocal_bss" ; return }
-re "\\\$$decimal = 104\r\n$prompt $" {
pass "print funclocal_bss at bar"
}
-re "$prompt $" {
fail "print funclocal_bss at bar" ; return
}
timeout {
fail "(timeout) print funclocal_bss" ; return
fail "(timeout) print funclocal_bss at bar" ; return
}
}
send "print bar::funclocal_bss\n"
send_gdb "print bar::funclocal_bss\n"
expect {
-re "\\\$$decimal = 104\r\n$prompt $" { pass "print bar::funclocal_bss" }
-re "$prompt $" { fail "print bar::funclocal_bss" ; return }
-re "\\\$$decimal = 104\r\n$prompt $" {
pass "print bar::funclocal_bss at bar"
}
-re "$prompt $" {
fail "print bar::funclocal_bss at bar" ; return
}
timeout {
fail "(timeout) print bar::funclocal_bss" ; return
fail "(timeout) print bar::funclocal_bss at bar" ; return
}
}
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope1.c'::bar::funclocal_bss\n"
send_gdb "print 'scope1.c'::bar::funclocal_bss\n"
expect {
-re "\\\$$decimal = 104\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal_bss" }
-re "\\\$$decimal = 104\r\n$prompt $" {
pass "print 'scope1.c'::bar::funclocal_bss at bar"
}
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss\n"
send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss\n"
exp_continue
}
-re "$prompt $" { fail "print 'scope1.c'::bar::funclocal_bss" ; return }
-re "$prompt $" {
fail "print 'scope1.c'::bar::funclocal_bss at bar" ; return
}
timeout {
fail "(timeout) print 'scope1.c'::bar::funclocal_bss" ; return
fail "(timeout) print 'scope1.c'::bar::funclocal_bss at bar" ; return
}
}
}
@@ -818,15 +905,15 @@ proc test_at_autovars {} {
# Test symbol table lookup with 100 local (auto) variables.
send "break marker1\n" ; expect -re ".*$prompt $"
send_gdb "break marker1\n" ; expect -re ".*$prompt $"
send "cont\n"
send_gdb "cont\n"
expect {
-re "Break.* marker1 \\(\\) at .*:$decimal.*$prompt $" {
send "up\n"
send_gdb "up\n"
expect {
-re ".*$prompt $" {}
timeout { fail "up from marker1" ; return }
timeout { fail "(timeout) up from marker1" ; return }
}
}
-re "$prompt $" { fail "continue to marker1" ; return }
@@ -835,7 +922,7 @@ proc test_at_autovars {} {
set count 0
while {$count < 100} {
send "print i$count\n"
send_gdb "print i$count\n"
expect {
-re ".* = $count\r\n$prompt $" {}
-re "$prompt $" {
@@ -860,17 +947,17 @@ proc test_at_localscopes {} {
global hex
global srcfile
send "break marker2\n" ; expect -re ".*$prompt $"
send "break marker3\n" ; expect -re ".*$prompt $"
send "break marker4\n" ; expect -re ".*$prompt $"
send_gdb "break marker2\n" ; expect -re ".*$prompt $"
send_gdb "break marker3\n" ; expect -re ".*$prompt $"
send_gdb "break marker4\n" ; expect -re ".*$prompt $"
send "cont\n"
send_gdb "cont\n"
expect {
-re "Break.* marker2 \\(\\) at .*:$decimal.*$prompt $" {
send "up\n"
send_gdb "up\n"
expect {
-re ".*$prompt $" {}
timeout { fail "up from marker2" ; return }
timeout { fail "(timeout) up from marker2" ; return }
}
}
-re "$prompt $" { fail "continue to marker2" ; return }
@@ -917,10 +1004,11 @@ proc test_at_localscopes {} {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
gdb_load ${binfile}
if [istarget "*-*-vxworks*"] {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
}
# Test that variables in various segments print out correctly before
@@ -940,8 +1028,7 @@ gdb_test "print 'scope0.c'::filelocal_ro" "= 201"
# so we actually read memory from the board. Problem is crt0.o
# is responsible for clearing bss and that hasnt' happened yet.
setup_xfail "hppa*-*-*pro*"
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send "print 'scope0.c'::filelocal_bss\n"
send_gdb "print 'scope0.c'::filelocal_bss\n"
expect {
-re " = 0\r\n$prompt $" {
pass "print 'scope0.c'::filelocal_bss before run"
@@ -958,9 +1045,6 @@ expect {
}
}
# AIX--sections get mapped to the same address so we can't get the right one.
setup_xfail "rs6000-*-*"
gdb_test "print 'scope0.c'::filelocal" "= 1" \
"print 'scope0.c'::filelocal before run"
@@ -970,7 +1054,7 @@ if [istarget "mips-idt-*"] then {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
gdb_load ${binfile}
}
if [runto foo] then { test_at_foo }
if [istarget "mips-idt-*"] then {
@@ -978,7 +1062,7 @@ if [istarget "mips-idt-*"] then {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
gdb_load ${binfile}
}
if [runto bar] then { test_at_bar }
if [istarget "mips-idt-*"] then {
@@ -986,7 +1070,7 @@ if [istarget "mips-idt-*"] then {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
gdb_load ${binfile}
}
if [runto localscopes] then { test_at_localscopes }
if [istarget "mips-idt-*"] then {
@@ -994,10 +1078,11 @@ if [istarget "mips-idt-*"] then {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
gdb_load ${binfile}
}
if [runto autovars] then { test_at_autovars }
if [istarget "*-*-vxworks*"] {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
}

View File

@@ -0,0 +1,231 @@
# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
# This file was written by Michael Snyder (msnyder@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile "setshow"
set srcfile ${srcdir}/${subdir}/${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile ${srcfile} ${binfile} executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
# Start with a fresh gdb
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
#
# Test gdb set and show commands.
# Add tests here for show and set that don't fit neatly elsewhere.
# FIXME: many rudimentary tests for set and show commands have been
# added below, but most do nothing more than check that a
# variable has been set successfully, ie. they do not test
# whether setting the variable has had the desired effect.
#
#test default annotation_level is 0
gdb_test "show annotate" "Annotation_level is 0..*" "default annotation_level is zero"
#test set annotate 2
send_gdb "set annotate 2\n"
expect {
-re ".*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \
{ pass "set annotate 2" }
-re ".*$prompt $" { fail "set annotate 2" }
timeout { fail "(timeout) set annotate 2" }
}
send_gdb "show annotate\n"
expect {
-re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \
{ pass "show annotate (2)" }
-re ".*$prompt $" { fail "show annotate (2)" }
timeout { fail "(timeout) show annotate (2)" }
}
#test annotation_level 2
send_gdb "info line 1\n"
expect {
-re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \
{ pass "annotation_level 2" }
-re ".*$prompt $" { fail "annotation_level 2" }
timeout { fail "(timeout) annotation_level 2" }
}
#test set annotate 1
gdb_test "set annotate 1" ".*post-prompt.*" "set annotate 1"
gdb_test "show annotate" "Annotation_level is 1..*" "show annotate (1)"
#test annotation_level 1
gdb_test "info line 1" "Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*" "annotation_level 1"
#test set annotate 0
gdb_test "set annotate 0" "" "set annotate 0"
gdb_test "show annotate" "Annotation_level is 0..*" "show annotate (0)"
#test annotation_level 0
gdb_test "info line 1" "Line 1 of .* is at address .* but contains no code.*" "annotation_level 0"
#test set args
gdb_test "set args foo bar blup baz bubble" "" "set args"
#test show args
gdb_test "show args" "Arguments to give program being debugged when it is started is \"foo bar blup baz bubble\"..*" "show args"
#test passing args
gdb_test "run" "Starting program:.*foo bar blup baz bubble.*" "passing args"
#test set check range on
gdb_test "set check range on" "" "set check range on"
#test show check range on
gdb_test "show check range" "Range checking is \"on\"\..*" "show check range (on)"
#test set check range auto
gdb_test "set check range auto" "" "set check range auto"
#test show check range auto
gdb_test "show check range" "Range checking is \"auto; currently .*" "show check range (auto)"
#test set check type on
gdb_test "set check type on" "" "set check type on"
#test show check type on
gdb_test "show check type" "Type checking is \"on\"..*" "show check type (on)"
#test set check type auto
gdb_test "set check type auto" "" "set check type auto"
#test show check type
gdb_test "show check type" "Type checking is \"auto; currently .*" "show check type (auto)"
#test set complaints 100
gdb_test "set complaints 100" "" "set complaints 100"
#test show complaints 100
gdb_test "show complaints" "Max number of complaints about incorrect symbols is 100..*" "show complaints (100)"
#test set complaints 0
gdb_test "set complaints 0" "" "set complaints 0"
#test show complaints 0
gdb_test "show complaints" "Max number of complaints about incorrect symbols is 0..*" "show complaints (0)"
#test set confirm off
gdb_test "set confirm off" "" "set confirm off"
#test show confirm off
gdb_test "show confirm" "Whether to confirm potentially dangerous operations is off..*" "show confirm (off)"
#test set confirm on
gdb_test "set confirm on" "" "set confirm on"
#test show confirm on
gdb_test "show confirm" "Whether to confirm potentially dangerous operations is on..*" "show confirm (on)"
#test set editing off
gdb_test "set editing off" "" "set editing off"
#test show editing off
gdb_test "show editing" "Editing of command lines as they are typed is off..*" "show editing (off)"
#test set editing on
#gdb_test "set editing on" "" "set editing on"
#test show editing on
#gdb_test "show editing" "Editing of command lines as they are typed is on..*" "show editing (on)"
#test set environment FOOBARBAZ
gdb_test "set environment FOOBARBAZ = grbxgrbxgrbx" "" "set environment FOOBARBAZ"
#test show environment FOOBARBAZ
gdb_test "show environment FOOBARBAZ" "FOOBARBAZ = grbxgrbxgrbx.*" "show environment FOOBARBAZ"
#test set height 100
gdb_test "set height 100" "" "set height 100"
#test show height 100
gdb_test "show height" "Number of lines gdb thinks are in a page is 100..*" "show height"
#test set history expansion on
gdb_test "set history expansion on" "" "set history expansion on"
#test show history expansion on
gdb_test "show history expansion on" "History expansion on command input is on.*" "show history expansion"
#test set history filename foobar.baz
gdb_test "set history filename foobar.baz" "" "set history filename foobar.baz"
#test show history filename foobar.baz
gdb_test "show history filename" "The filename in which to record the command history is \"foobar.baz\"..*" "show history filename (foobar.baz)"
#test set history save on
gdb_test "set history save on" "" "set history save on"
#test show history save on
gdb_test "show history save" "Saving of the history record on exit is on..*" "show history save (on)"
#test set history size 100
gdb_test "set history size 100" "" "set history size 100"
#test show history size 100
gdb_test "show history size" "The size of the command history is 100..*" "show history size (100)"
#test set language asm
gdb_test "set language asm" "" "set language asm"
#test show language asm
gdb_test "show language" "The current source language is \"asm\"..*" "show language (asm)"
#test set language auto
gdb_test "set language auto" "" "set language auto"
#test show language
gdb_test "show language" "The current source language is \"auto\"..*" "show language (auto)"
#test set listsize 100
gdb_test "set listsize 100" "" "set listsize 100"
#test show listsize 100
gdb_test "show listsize" "Number of source lines gdb will list by default is 100..*" "show listsize (100)"
#test set prompt (FooBarBaz)
set newprompt "\\(FooBarBaz\\)"
send_gdb "set prompt (FooBarBaz) \n"
expect {
-re "$newprompt $" { pass "set prompt (FooBarBaz) " }
timeout { fail "(timeout) set prompt (FooBarBaz) " }
}
#test show prompt (FooBarBaz)
send_gdb "show prompt\n"
expect {
-re "Gdb's prompt is \"$newprompt \"..* $" \
{ pass "show prompt (FooBarBaz) " }
timeout { fail "(timeout) show prompt (FooBarBaz) " }
}
#test set prompt (gdb)
send_gdb "set prompt (gdb) \n"
expect {
-re "$prompt $" { pass "set prompt (gdb) " }
timeout { fail "(timeout) set prompt (gdb) " }
}
#test set radix 11
gdb_test "set radix 11" "Unsupported output radix ``decimal 11''; output radix unchanged..*" "set radix 11"
#test set radix 16
gdb_test "set radix 16" "Input and output radices now set to decimal 16, hex 10, octal 20..*" "set radix 16"
#test show radix 16
gdb_test "show radix" "Input and output radices set to decimal 16, hex 10, octal 20..*" "show radix (16)"
#test set radix 10
gdb_test "set radix" "Input and output radices now set to decimal 10, hex a, octal 12..*" "set radix 10"
#test show radix 10
gdb_test "show radix" "Input and output radices set to decimal 10, hex a, octal 12..*" "show radix (10)"
#test set width 90
gdb_test "set width 90" "" "set width 90"
#test show width 90
gdb_test "show width" "Number of characters gdb thinks are in a line is 90..*" "show width (90)"
#test set write on
# This is only supported on targets which use exec.o.
gdb_test "set write on" "" "set write on"
#test show write on
# This is only supported on targets which use exec.o.
gdb_test "show write" "Writing into executable and core files is on..*" "show write (on)"
#test set symbol-reloading on
gdb_test "set symbol-reloading on" "" "set symbol-reloading on"
#test show symbol-reloading on
gdb_test "show symbol-reloading" "Dynamic symbol table reloading multiple times in one run is on..*" "show symbol-reloading (on)"
#test show user
gdb_test "show user" "" "show user"
#test set verbose on
gdb_test "set verbose on" "" "set verbose on"
#test show verbose on
gdb_test "show verbose" "Verbose printing of informational messages is on..*" "show verbose (on)"
#test set verbose off
gdb_test "set verbose off" "" "set verbose off"
#test show verbose off
gdb_test "show verbose" "Verbosity is off..*" "show verbose (off)"

File diff suppressed because it is too large Load Diff

View File

@@ -26,12 +26,14 @@ if $tracelevel then {
set prms_id 0
set bug_id 0
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
set testfile sigall
set srcfile ${srcdir}/$subdir/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -51,15 +53,12 @@ proc test_one_sig {nextsig} {
gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
if {$thissig == "ALRM"} then {
setup_xfail "*-*-irix4*"
}
set need_another_continue 1
set missed_handler 0
if $this_sig_supported then {
send "continue\n"
send_gdb "continue\n"
if { $thissig == "IO" } {
setup_xfail "i*86-*-linuxoldld" "i*86-*-linuxaout"
setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
}
expect {
-re "Continuing.*Program received signal SIG$thissig.*$prompt $" {
@@ -87,9 +86,9 @@ proc test_one_sig {nextsig} {
}
if $need_another_continue then {
send "continue\n"
send_gdb "continue\n"
if { $thissig == "URG" } {
setup_xfail "i*86-*-linuxoldld" "i*86-*-linuxaout"
setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
}
# Either Lynx or GDB screws up on SIGPRIO
if { $thissig == "PRIO" } {
@@ -107,7 +106,7 @@ proc test_one_sig {nextsig} {
}
if { $missed_handler == "0" } then {
send "signal 0\n"
send_gdb "signal 0\n"
expect {
-re "Breakpoint.*gen_$nextsig.*kill.*$prompt $" {
pass "advance to $nextsig"

View File

@@ -13,19 +13,16 @@ set bug_id 0
set testfile signals
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
execute_anywhere "rm -f ${binfile}.ci"
if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
perror "Couldn't make ${binfile}.ci file"
return -1
if [get_compiler_info ${binfile}] {
return -1;
}
source ${binfile}.ci
proc signal_tests_1 {} {
global prompt
@@ -37,7 +34,7 @@ proc signal_tests_1 {} {
gdb_test "next" "\\+\\+count; /\\* first \\*/" \
"next over alarm (1)"
# An alarm has been signaled, give the signal time to get delivered.
exec sleep 2
sleep 2
# i386 BSD currently fails the next test with a SIGTRAP.
setup_xfail "i*86-*-bsd*"
@@ -51,8 +48,8 @@ proc signal_tests_1 {} {
# linux (aout versions) also fails with "next" acting like "continue"
# this is probably more dependant on the kernel version than on the
# object file format or utils. (sigh)
setup_xfail "i*86-*-linuxaout" "i*86-*-linuxoldld"
send "next\n"
setup_xfail "i*86-pc-linuxaout-gnu" "i*86-pc-linuxoldld-gnu"
send_gdb "next\n"
expect {
-re "alarm .*$prompt $" { pass "next to 2nd alarm (1)" }
-re "Program received signal SIGTRAP.*first.*$prompt $" {
@@ -127,11 +124,11 @@ proc signal_tests_1 {} {
gdb_test "next" "\\+\\+count; /\\* second \\*/" \
"next to 2nd ++count in signals_tests_1"
# An alarm has been signaled, give the signal time to get delivered.
exec sleep 2
sleep 2
set bash_bug 0
send "next\n"
setup_xfail "i*86-*-linux"
send_gdb "next\n"
setup_xfail "i*86-pc-linux-gnu"
expect {
-re "Breakpoint.*handler.*$prompt $" {
pass "next to handler in signals_tests_1"
@@ -151,7 +148,7 @@ proc signal_tests_1 {} {
# This doesn't test that main is frame #2, just that main is frame
# #2, #3, or higher. At some point this should be fixed (but
# it quite possibly would introduce new FAILs on some systems).
setup_xfail "i*86-*-linux" "i*86-*-bsdi2.0"
setup_xfail "i*86-pc-linux-gnu" "i*86-*-bsdi2.0"
gdb_test "backtrace" "#0.*handler.*#1.*#2.*main.*" \
"backtrace in signals_tests_1"
@@ -162,8 +159,8 @@ proc signal_tests_1 {} {
# a SIGTRAP, but with different symptoms.
setup_xfail "vax-*-ultrix*"
setup_xfail "i*86-*-bsd*"
setup_xfail "i*86-*-linux"
send "continue\n"
setup_xfail "i*86-pc-linux-gnu"
send_gdb "continue\n"
expect {
-re "Breakpoint.*func1.*$prompt $" { pass "continue to func1" }
-re "Program received signal SIGTRAP.*second.*$prompt $" {
@@ -193,8 +190,7 @@ proc signal_tests_1 {} {
}
setup_xfail "*-*-irix*"
setup_xfail "i*86-*-linux"
send "signal SIGUSR1\n"
send_gdb "signal SIGUSR1\n"
expect {
-re "Breakpoint.*handler.*$prompt $" { pass "signal SIGUSR1" }
-re "Program received signal SIGUSR1.*$prompt $" {
@@ -219,7 +215,7 @@ proc signal_tests_1 {} {
# anytime soon.
setup_xfail "*-*-*"
send "continue\n"
send_gdb "continue\n"
expect {
-re "Breakpoint.*func2.*$prompt $" { pass "continue to func2" }
-re "Breakpoint.*func1.*$prompt $" {
@@ -231,7 +227,7 @@ proc signal_tests_1 {} {
default { fail "continue to func2" }
}
exec sleep 2
sleep 2
# GDB yanks out the breakpoints to step over the breakpoint it
# stopped at, which means the breakpoint at handler is yanked.
@@ -249,7 +245,7 @@ proc signal_tests_1 {} {
setup_xfail "m68*-*-sunos4*"
}
setup_xfail "i*86-*-linux"
setup_xfail "i*86-pc-linux-gnu"
gdb_test "continue" "Breakpoint.*handler.*" "continue to handler"
# If the NO_SINGLE_STEP failure happened, we have already exited.
@@ -300,252 +296,17 @@ gdb_start
# This will need to be updated as the exact list of signals changes,
# but I want to test that TARGET_SIGNAL_0, TARGET_SIGNAL_DEFAULT, and
# TARGET_SIGNAL_UNKNOWN are skipped.
# Increase expect input buffer for large output from gdb.
# Allow blank or TAB as whitespace characters and test individually for
# each specific signal.
proc test_handle_all_print {} {
global timeout
# Increase timeout and expect input buffer for large output from gdb.
# Allow blank or TAB as whitespace characters.
set oldtimeout $timeout
set timeout [expr "$timeout + 360"]
verbose "Timeout is now $timeout seconds" 2
match_max 10000
gdb_test "handle all print" \
"Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\n.*" \
"handle all print - Output headers"
gdb_test "handle all print" \
".*SIGHUP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Hangup\r\n.*" \
"handle all print - Hangup"
gdb_test "handle all print" \
".*SIGQUIT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Quit\r\n.*" \
"handle all print - Quit"
gdb_test "handle all print" \
".*SIGILL\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Illegal instruction\r\n.*" \
"handle all print - Illegal instruction"
gdb_test "handle all print" \
".*SIGABRT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Aborted\r\n.*" \
"handle all print - Aborted"
gdb_test "handle all print" \
".*SIGEMT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Emulation trap\r\n.*" \
"handle all print - Emulation trap"
gdb_test "handle all print" \
".*SIGFPE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Arithmetic exception\r\n.*" \
"handle all print - Arithmetic exception"
gdb_test "handle all print" \
".*SIGKILL\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Killed\r\n.*" \
"handle all print - Killed"
gdb_test "handle all print" \
".*SIGBUS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Bus error\r\n.*" \
"handle all print - Bus error"
gdb_test "handle all print" \
".*SIGSEGV\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Segmentation fault\r\n.*" \
"handle all print - Segmentation fault"
gdb_test "handle all print" \
".*SIGSYS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Bad system call\r\n.*" \
"handle all print - Bad system call"
gdb_test "handle all print" \
".*SIGPIPE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Broken pipe\r\n.*" \
"handle all print - Broken pipe"
gdb_test "handle all print" \
".*SIGALRM\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Alarm clock\r\n.*" \
"handle all print - Alarm clock"
gdb_test "handle all print" \
".*SIGTERM\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Terminated\r\n.*" \
"handle all print - Terminated"
gdb_test "handle all print" \
".*SIGURG\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Urgent I/O condition\r\n.*" \
"handle all print - Urgent I/O condition"
gdb_test "handle all print" \
".*SIGSTOP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(signal\\)\r\n.*" \
"handle all print - Stopped (signal)"
gdb_test "handle all print" \
".*SIGTSTP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(user\\)\r\n.*" \
"handle all print - Stopped (user)"
gdb_test "handle all print" \
".*SIGCONT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Continued\r\n.*" \
"handle all print - Continued"
gdb_test "handle all print" \
".*SIGCHLD\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Child status changed\r\n.*" \
"handle all print - Child status changed"
gdb_test "handle all print" \
".*SIGTTIN\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(tty input\\)\r\n.*" \
"handle all print - Stopped (tty input)"
gdb_test "handle all print" \
".*SIGTTOU\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(tty output\\)\r\n.*" \
"handle all print - Stopped (tty output)"
gdb_test "handle all print" \
".*SIGIO\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+I/O possible\r\n.*" \
"handle all print - I/O possible"
gdb_test "handle all print" \
".*SIGXCPU\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+CPU time limit exceeded\r\n.*" \
"handle all print - CPU time limit exceeded"
gdb_test "handle all print" \
".*SIGXFSZ\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+File size limit exceeded\r\n.*" \
"handle all print - File size limit exceeded"
gdb_test "handle all print" \
".*SIGVTALRM\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Virtual timer expired\r\n.*" \
"handle all print - Virtual timer expired"
gdb_test "handle all print" \
".*SIGPROF\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Profiling timer expired\r\n.*" \
"handle all print - Profiling timer expired"
gdb_test "handle all print" \
".*SIGWINCH\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Window size changed\r\n.*" \
"handle all print - Window size changed"
gdb_test "handle all print" \
".*SIGLOST\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Resource lost\r\n.*" \
"handle all print - Resource lost"
gdb_test "handle all print" \
".*SIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+User defined signal 1\r\n.*" \
"handle all print - User defined signal 1"
gdb_test "handle all print" \
".*SIGUSR2\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+User defined signal 2\r\n.*" \
"handle all print - User defined signal 2"
gdb_test "handle all print" \
".*SIGPWR\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Power fail/restart\r\n.*" \
"handle all print - Power fail/restart"
gdb_test "handle all print" \
".*SIGPOLL\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Pollable event occurred\r\n.*" \
"handle all print - Pollable event occurred"
gdb_test "handle all print" \
".*SIGWIND\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGWIND\r\n.*" \
"handle all print - SIGWIND"
gdb_test "handle all print" \
".*SIGPHONE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGPHONE\r\n.*" \
"handle all print - SIGPHONE"
gdb_test "handle all print" \
".*SIGWAITING\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Process's LWPs are blocked\r\n.*" \
"handle all print - Process's LWPs are blocked"
gdb_test "handle all print" \
".*SIGLWP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Signal LWP\r\n.*" \
"handle all print - Signal LWP"
gdb_test "handle all print" \
".*SIGDANGER\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Swap space dangerously low\r\n.*" \
"handle all print - Swap space dangerously low"
gdb_test "handle all print" \
".*SIGGRANT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Monitor mode granted\r\n.*" \
"handle all print - Monitor mode granted"
gdb_test "handle all print" \
".*SIGRETRACT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Need to relinguish monitor mode\r\n.*" \
"handle all print - Need to relinguish monitor mode"
gdb_test "handle all print" \
".*SIGMSG\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Monitor mode data available\r\n.*" \
"handle all print - Monitor mode data available"
gdb_test "handle all print" \
".*SIGSOUND\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Sound completed\r\n.*" \
"handle all print - Sound completed"
gdb_test "handle all print" \
".*SIGSAK\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Secure attention\r\n.*" \
"handle all print - Secure attention"
gdb_test "handle all print" \
".*SIGPRIO\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGPRIO\r\n.*" \
"handle all print - SIGPRIO"
gdb_test "handle all print" \
".*SIG33\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 33\r\n.*" \
"handle all print - Real-time event 33"
gdb_test "handle all print" \
".*SIG34\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 34\r\n.*" \
"handle all print - Real-time event 34"
gdb_test "handle all print" \
".*SIG35\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 35\r\n.*" \
"handle all print - Real-time event 35"
gdb_test "handle all print" \
".*SIG36\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 36\r\n.*" \
"handle all print - Real-time event 36"
gdb_test "handle all print" \
".*SIG37\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 37\r\n.*" \
"handle all print - Real-time event 37"
gdb_test "handle all print" \
".*SIG38\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 38\r\n.*" \
"handle all print - Real-time event 38"
gdb_test "handle all print" \
".*SIG39\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 39\r\n.*" \
"handle all print - Real-time event 39"
gdb_test "handle all print" \
".*SIG40\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 40\r\n.*" \
"handle all print - Real-time event 40"
gdb_test "handle all print" \
".*SIG41\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 41\r\n.*" \
"handle all print - Real-time event 41"
gdb_test "handle all print" \
".*SIG42\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 42\r\n.*" \
"handle all print - Real-time event 42"
gdb_test "handle all print" \
".*SIG43\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 43\r\n.*" \
"handle all print - Real-time event 43"
gdb_test "handle all print" \
".*SIG44\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 44\r\n.*" \
"handle all print - Real-time event 44"
gdb_test "handle all print" \
".*SIG45\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 45\r\n.*" \
"handle all print - Real-time event 45"
gdb_test "handle all print" \
".*SIG46\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 46\r\n.*" \
"handle all print - Real-time event 46"
gdb_test "handle all print" \
".*SIG47\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 47\r\n.*" \
"handle all print - Real-time event 47"
gdb_test "handle all print" \
".*SIG48\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 48\r\n.*" \
"handle all print - Real-time event 48"
gdb_test "handle all print" \
".*SIG49\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 49\r\n.*" \
"handle all print - Real-time event 49"
gdb_test "handle all print" \
".*SIG50\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 50\r\n.*" \
"handle all print - Real-time event 50"
gdb_test "handle all print" \
".*SIG51\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 51\r\n.*" \
"handle all print - Real-time event 51"
gdb_test "handle all print" \
".*SIG52\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 52\r\n.*" \
"handle all print - Real-time event 52"
gdb_test "handle all print" \
".*SIG53\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 53\r\n.*" \
"handle all print - Real-time event 53"
gdb_test "handle all print" \
".*SIG54\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 54\r\n.*" \
"handle all print - Real-time event 54"
gdb_test "handle all print" \
".*SIG55\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 55\r\n.*" \
"handle all print - Real-time event 55"
gdb_test "handle all print" \
".*SIG56\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 56\r\n.*" \
"handle all print - Real-time event 56"
gdb_test "handle all print" \
".*SIG57\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 57\r\n.*" \
"handle all print - Real-time event 57"
gdb_test "handle all print" \
".*SIG58\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 58\r\n.*" \
"handle all print - Real-time event 58"
gdb_test "handle all print" \
".*SIG59\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 59\r\n.*" \
"handle all print - Real-time event 59"
gdb_test "handle all print" \
".*SIG60\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 60\r\n.*" \
"handle all print - Real-time event 60"
gdb_test "handle all print" \
".*SIG61\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 61\r\n.*" \
"handle all print - Real-time event 61"
gdb_test "handle all print" \
".*SIG62\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 62\r\n.*" \
"handle all print - Real-time event 62"
gdb_test "handle all print" \
".*SIG63\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 63\r\n.*" \
"handle all print - Real-time event 63"
gdb_test "handle all print" \
".*EXC_BAD_ACCESS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Could not access memory\r\n.*" \
"handle all print - Could not access memory"
gdb_test "handle all print" \
".*EXC_BAD_INSTRUCTION\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Illegal instruction/operand\r\n.*" \
"handle all print - Illegal instruction/operand"
gdb_test "handle all print" \
".*EXC_ARITHMETIC\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Arithmetic exception\r\n.*" \
"handle all print - Arithmetic exception"
gdb_test "handle all print" \
".*EXC_EMULATION\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Emulation instruction\r\n.*" \
"handle all print - Emulation instruction"
gdb_test "handle all print" \
".*EXC_SOFTWARE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Software generated exception\r\n.*" \
"handle all print - Software generated exception"
gdb_test "handle all print" \
".*EXC_BREAKPOINT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Breakpoint.*" \
"handle all print - Breakpoint"
gdb_test "handle all print" "Signal\[ \]+Stop\[ \]+Print\[ \]+Pass to program\[ \]+Description\r\nSIGHUP\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Hangup.*SIG63\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Real-time event 63.*EXC_BREAKPOINT\[ \]+Yes\[ \]+Yes\[ \]+Yes\[ \]+Breakpoint"
set timeout $oldtimeout
verbose "Timeout restored to $timeout seconds" 2
}
test_handle_all_print
@@ -557,7 +318,7 @@ signal_tests_1
# Force a resync, so we're looking at the right prompt. On SCO we
# were getting out of sync (I don't understand why).
send "p 1+1\n"
send_gdb "p 1+1\n"
expect {
-re "= 2.*$prompt $" {}
-re ".*$prompt $" { perror "sync trouble in signals.exp" }
@@ -574,7 +335,7 @@ if [runto_main] then {
gdb_test "next" "\\+\\+count; /\\* first \\*/" \
"next to ++count #1 in signals.exp"
# Give the signal time to get delivered
exec sleep 2
sleep 2
# Now call a function. When GDB tries to run the stack dummy,
# it will hit the breakpoint at handler. Provided it doesn't
@@ -596,7 +357,7 @@ if [runto_main] then {
gdb_test "next" "alarm \\(.*" "next to alarm #2 in signals.exp"
gdb_test "next" "\\+\\+count; /\\* second \\*/" \
"next to ++count #2 in signals.exp"
exec sleep 2
sleep 2
# This time we stop when GDB tries to run the stack dummy.
# So it is OK that we do not print the return value from the function.

View File

@@ -26,32 +26,27 @@ if $tracelevel then {
set prms_id 0
set bug_id 0
set prototypes 0
set prototypes 1
set testfile "structs"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
# build the first test case
execute_anywhere "rm -f ${binfile}.ci"
execute_anywhere "echo set prototypes 1 > ${binfile}.ci"
if { [compile "-g ${srcdir}/${subdir}/${srcfile} -o ${binfile} "] != "" } {
execute_anywhere "rm -f ${binfile}.ci"
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
# built the second test case since we can't use prototypes
warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
execute_anywhere "echo set prototypes 0 > ${binfile}.ci"
if { [compile "-g -DNO_PROTOTYPES ${srcdir}/${subdir}/${srcfile} -o ${binfile} "] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } {
perror "Couldn't compile ${testfile}.c"
return -1
}
set prototypes 0
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
if { [compile "-E ${srcdir}/${subdir}/compiler.c >> ${binfile}.ci"] != "" } {
perror "Couldn't make ${binfile}.ci"
return -1
if [get_compiler_info ${binfile}] {
return -1;
}
source ${binfile}.ci
# The a29k can't call functions, so don't even bother with this test.
if [istarget "a29k-*-udi"] then {
@@ -60,13 +55,6 @@ if [istarget "a29k-*-udi"] then {
continue
}
# The h8300 simulator can't call functions, so don't even bother with this test.
if [istarget "h8300*-*-*"] then {
setup_xfail "h8300*-*-*"
fail "h8300*-*-* simulator can not call functions"
continue
}
# FIXME: Before calling this proc, we should probably verify that
# we can call inferior functions and get a valid integral value
# returned.
@@ -84,13 +72,9 @@ proc do_function_calls {} {
gdb_test "p fun2()" " = {a = 97 'a', b = 98 'b'}"
gdb_test "p fun3()" " = {a = 65 'A', b = 66 'B', c = 67 'C'}"
gdb_test "p fun4()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4'}"
setup_xfail "hppa*-*-hpux9*"
gdb_test "p fun5()" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e'}"
setup_xfail "hppa*-*-hpux9*"
gdb_test "p fun6()" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F'}"
setup_xfail "hppa*-*-hpux9*"
gdb_test "p fun7()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7'}"
setup_xfail "hppa*-*-hpux9*"
gdb_test "p fun8()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8'}"
gdb_test "p fun9()" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i'}"
gdb_test "p fun10()" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J'}"
@@ -145,9 +129,9 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
send "set print sevenbit-strings\n" ; expect -re "$prompt $"
send "set print address off\n" ; expect -re "$prompt $"
send "set width 0\n" ; expect -re "$prompt $"
send_gdb "set print sevenbit-strings\n" ; expect -re "$prompt $"
send_gdb "set print address off\n" ; expect -re "$prompt $"
send_gdb "set width 0\n" ; expect -re "$prompt $"
if [runto_main] then {
do_function_calls

View File

@@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
@@ -28,6 +28,8 @@ if ![isnative] then {
continue
}
gdb_start
#
# test running programs
#
@@ -35,9 +37,9 @@ set prms_id 0
set bug_id 0
set testfile "run"
set srcfile ${srcdir}/$subdir/${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -46,51 +48,27 @@ delete_breakpoints
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# Test that GDB correctly identifies that it does not control a terminal.
send "info terminal\n"
gdb_test "set print sevenbit-strings" "" "test set print sevenbit-strings"
gdb_test "set print address off" "" "test set print address off"
gdb_test "set width 0" "" "test set width 0"
gdb_test "info terminal" "No saved terminal information.*" "test info terminal"
gdb_run_cmd 5
expect {
-re "No saved terminal information..*$prompt $"\
{ send "run 5\n"
expect {
-re "Starting program.*$binfile.*120.*Program exited normally..*$prompt $"\
{ send "info terminal\n"
expect {
-re "No saved terminal information..*$prompt $"\
{ pass "info terminal" }
-re ".*$prompt $" { fail "info terminal" }
timeout { fail "(timeout) info terminal" }
}
}
-re ".*$prompt $" { fail "info terminal" }
timeout { fail "(timeout) info terminal" }
}
}
-re ".*$prompt $" { fail "info terminal" }
timeout { fail "(timeout) info terminal" }
-re ".*120.*Program exited normally.*$prompt $" {
gdb_test "info terminal" "No saved terminal information.*" "test info terminal"
}
default {
fail "term.exp, factorial didn't run to completion for info terminal"
}
}
# In mid-execution
send "break main\n"
gdb_breakpoint main
gdb_run_cmd 5
expect {
-re "Breakpoint.*at.* file .*, line.*$prompt $"\
{ send "run 5\n"
expect {
-re "Starting program.*Breakpoint \[0-9\]+,.*main.*if .argc != 2.*$prompt $"\
{ send "info terminal\n"
expect {
-re "Inferior's terminal status .currently saved by GDB.:.*$prompt $"\
{ pass "info terminal at breakpoint" }
-re ".*$prompt $" { fail "info terminal at breakpoint" }
timeout { fail "(timeout) info terminal at breakpoint" }
}
}
-re ".*$prompt $" { fail "info terminal at breakpoint" }
timeout { fail "(timeout) info terminal at breakpoint" }
}
}
-re ".*Breakpoint \[0-9\]+,.*main.*if .argc != 2.*$prompt $" {
gdb_test "info terminal" "Inferior's terminal status .currently saved by GDB.:.*" "info terminal at breakpoint"
}
-re ".*$prompt $" { fail "info terminal at breakpoint" }
timeout { fail "(timeout) info terminal at breakpoint" }
}

View File

@@ -29,7 +29,7 @@ set bug_id 0
set testfile "watchpoint"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } {
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
@@ -56,7 +56,7 @@ proc initialize {} {
global decimal
global srcfile
send "break marker1\n"
send_gdb "break marker1\n"
expect {
-re "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*$prompt $" {
pass "set breakpoint at marker1"
@@ -65,7 +65,7 @@ proc initialize {} {
timeout { fail "set breakpoint at marker1 (timeout)" ; return 0 }
}
send "break marker2\n"
send_gdb "break marker2\n"
expect {
-re "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*$prompt $" {
pass "set breakpoint at marker2"
@@ -74,14 +74,14 @@ proc initialize {} {
timeout { fail "set breakpoint at marker2 (timeout)" ; return 0 }
}
send "info break\n"
send_gdb "info break\n"
expect {
-re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n$prompt $" { pass "info break in watchpoint.exp" }
-re ".*$prompt $" { fail "info break in watchpoint.exp" ; return 0 }
timeout { fail "info break in watchpoint.exp (timeout)" ; return 0 }
}
send "watch ival3\n"
send_gdb "watch ival3\n"
expect {
-re ".*\[Ww\]atchpoint 3: ival3\r\n$prompt $" {
pass "set watchpoint on ival3"
@@ -92,7 +92,7 @@ proc initialize {} {
# "info watch" is the same as "info break"
send "info watch\n"
send_gdb "info watch\n"
expect {
-re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3\r\n$prompt $" {
pass "watchpoint found in watchpoint/breakpoint table"
@@ -101,7 +101,7 @@ proc initialize {} {
fail "watchpoint found in watchpoint/breakpoint table" ; return 0
}
timeout {
fail "watchpoint found in watchpoint/breakpoint table" ; return 0
fail "watchpoint found in watchpoint/breakpoint table (timeout)" ; return 0
}
}
@@ -109,7 +109,7 @@ proc initialize {} {
# to use it. This allows the test program to run at full speed until
# we get to the first marker function.
send "disable 3\n"
send_gdb "disable 3\n"
expect {
-re "disable 3\[\r\n\]+$prompt $" { pass "disable watchpoint" }
-re ".*$prompt $" { fail "disable watchpoint" ; return 0 }
@@ -131,7 +131,7 @@ proc test_simple_watchpoint {} {
# Ensure that the watchpoint is disabled when we startup.
send "disable 3\n"
send_gdb "disable 3\n"
expect {
-re "^disable 3\[\r\n\]+$prompt $" {
pass "disable watchpoint in test_simple_watchpoint"
@@ -149,6 +149,7 @@ proc test_simple_watchpoint {} {
# Run until we get to the first marker function.
gdb_run_cmd
set timeout 600
expect {
-re "Breakpoint 1, marker1 .*$prompt $" {
pass "run to marker1 in test_simple_watchpoint"
@@ -165,7 +166,7 @@ proc test_simple_watchpoint {} {
# After reaching the marker function, enable the watchpoint.
send "enable 3\n"
send_gdb "enable 3\n"
expect {
-re "^enable 3\[\r\n\]+$prompt $" { pass "enable watchpoint" }
-re ".*$prompt $" { fail "enable watchpoint" ; return }
@@ -180,7 +181,7 @@ proc test_simple_watchpoint {} {
# Continue until the first change, from -1 to 0
send "cont\n"
send_gdb "cont\n"
expect {
-re "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*$prompt $" {
pass "watchpoint hit, first time"
@@ -222,7 +223,7 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count
# Disable the watchpoint so we run at full speed until we exit.
send "disable 3\n"
send_gdb "disable 3\n"
expect {
-re "^disable 3\[\r\n\]+$prompt $" { pass "watchpoint disabled" }
-re ".*$prompt $" { fail "watchpoint disabled" ; return }
@@ -249,7 +250,7 @@ proc test_disabling_watchpoints {} {
# Ensure that the watchpoint is disabled when we startup.
send "disable 3\n"
send_gdb "disable 3\n"
expect {
-re "^disable 3\[\r\n\]+$prompt $" {
pass "disable watchpoint in test_disabling_watchpoints"
@@ -267,6 +268,7 @@ proc test_disabling_watchpoints {} {
# Run until we get to the first marker function.
gdb_run_cmd
set timeout 600
expect {
-re "Breakpoint 1, marker1 .*$prompt $" {
pass "run to marker1 in test_disabling_watchpoints"
@@ -283,7 +285,7 @@ proc test_disabling_watchpoints {} {
# After reaching the marker function, enable the watchpoint.
send "enable 3\n"
send_gdb "enable 3\n"
expect {
-re "^enable 3\[\r\n\]+$prompt $" { pass "watchpoint enabled" }
-re ".*$prompt $" { fail "watchpoint enabled" ; return }
@@ -300,7 +302,7 @@ proc test_disabling_watchpoints {} {
# Disable the watchpoint but leave breakpoints
send "disable 3\n"
send_gdb "disable 3\n"
expect {
-re "^disable 3\[\r\n\]+$prompt $" {
pass "disable watchpoint #2 in test_disabling_watchpoints"
@@ -375,14 +377,14 @@ proc test_stepping {} {
# on other targets. In this case we will step once more.
#
send "finish\n"
send_gdb "finish\n"
expect {
-re "Run.*exit from.*marker1.*main.* at" { }
default { fail "finish from marker1" ; return }
}
expect {
-re "marker1 \\(\\);.*$prompt $" {
send "step\n"
send_gdb "step\n"
exp_continue
}
-re "func1 \\(\\);.*$prompt $" {
@@ -407,7 +409,7 @@ proc test_stepping {} {
gdb_test "until" "ival1 = count.*" "until to ival1 assignment"
gdb_test "until" "ival3 = count.*" "until to ival3 assignment"
send "until\n"
send_gdb "until\n"
expect {
-re "(for \\(count = 0|\}).*$prompt $" {
gdb_test "until" "ival1 = count; /. Outside loop ./" \
@@ -430,6 +432,7 @@ proc test_stepping {} {
proc test_watchpoint_triggered_in_syscall {} {
global prompt
global noinferiorio
global noresults
if $noinferiorio {
verbose "Skipping test_watchpoint_triggered_in_syscall due to noinferiorio"
@@ -449,50 +452,50 @@ proc test_watchpoint_triggered_in_syscall {} {
gdb_test "set doread = 1" ""
# If we send "123\n" before gdb has switched the tty, then it goes
# If we send_gdb "123\n" before gdb has switched the tty, then it goes
# to gdb, not the inferior, and we lose. So that is why we have
# watchpoint.c prompt us, so we can wait for that prompt.
send "continue\n"
send_gdb "continue\n"
expect {
-re "Continuing\\.\r\ntype stuff for buf now:" {
pass "continue to read"
}
default { fail "continue to read"; return }
}
send "123\n"
send_gdb "123\n"
expect {
-re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
-re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
-re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
-re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
-re ".*$prompt $" { pass "sent 123" }
timeout { fail "sent 123" }
timeout { fail "sent 123 (timeout)" }
}
# Examine the values in buf to see how many watchpoints we
# should have printed.
send "print buf\[0\]\n"
send_gdb "print buf\[0\]\n"
expect {
-re ".*= 49.*$prompt $" { set y [expr $y+1]; pass "print buf\[0\]"}
-re ".*= 0.*$prompt $" { pass "print buf\[0\]"}
-re ".*$prompt $" { fail "print buf\[0\]"}
default { fail "print buf\[0\]"}
}
send "print buf\[1\]\n"
send_gdb "print buf\[1\]\n"
expect {
-re ".*= 50.*$prompt $" { set y [expr $y+1]; pass "print buf\[1\]"}
-re ".*= 0.*$prompt $" { pass "print buf\[1\]"}
-re ".*$prompt $" { fail "print buf\[1\]"}
default { fail "print buf\[1\]"}
}
send "print buf\[2\]\n"
send_gdb "print buf\[2\]\n"
expect {
-re ".*= 51.*$prompt $" { set y [expr $y+1]; pass "print buf\[2\]"}
-re ".*= 0.*$prompt $" { pass "print buf\[2\]"}
-re ".*$prompt $" { fail "print buf\[2\]"}
default { fail "print buf\[2\]"}
}
send "print buf\[3\]\n"
send_gdb "print buf\[3\]\n"
expect {
-re ".*= 10.*$prompt $" { set y [expr $y+1]; pass "print buf\[3\]"}
-re ".*= 0.*$prompt $" { pass "print buf\[3\]"}
@@ -511,6 +514,8 @@ proc test_watchpoint_triggered_in_syscall {} {
# Disable everything so we can finish the program at full speed
gdb_test "disable" "" "disable in test_watchpoint_triggered_in_syscall"
if $noresults==1 then { return }
gdb_test "cont" "Continuing.*Program exited normally.*" \
"continue to exit in test_watchpoint_triggered_in_syscall"
}
@@ -521,6 +526,7 @@ proc test_watchpoint_triggered_in_syscall {} {
proc test_complex_watchpoint {} {
global prompt
global noresults
if [runto marker4] then {
gdb_test "watch ptr1->val" ".*\[Ww\]atchpoint \[0-9\]*: ptr1->val"
@@ -537,6 +543,8 @@ proc test_complex_watchpoint {} {
# Disable everything so we can finish the program at full speed
gdb_test "disable" "" "disable in test_complex_watchpoint"
if $noresults==1 then { return }
gdb_test "cont" "Continuing.*Program exited normally.*" \
"continue to exit in test_complex_watchpoint"
}
@@ -548,6 +556,8 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
set timeout 600
verbose "Timeout now 600 sec.\n"
if [initialize] then {