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

@ -26,7 +26,7 @@ if {[which $OBJCOPY] == 0} then {
send_user "Version [binutil_version $OBJCOPY]"
if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then {
if {![binutils_assemble $AS $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
unresolved "objcopy (simple copy)"
return
}
@ -56,7 +56,7 @@ if ![string match "" $got] then {
setup_xfail "i*86-*-sysv3" "i*86-*-isc*" "i*86-*-sco*" "i*86-*-coff"
setup_xfail "i*86-*-aix*" "i*86-*-go32*"
setup_xfail "a29k-*-udi" "a29k-*-coff" "a29k-*-vxworks*"
setup_xfail "i960-*-vxworks*" "i960-*-coff"
setup_xfail "i960-*-coff"
setup_xfail "h8300-*-hms" "h8300-*-coff"
setup_xfail "h8500-*-hms" "h8500-*-coff"
setup_xfail "hppa*-*-*"
@ -70,6 +70,12 @@ if ![string match "" $got] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
# On OSF/1, this succeeds with gas and fails with /bin/as.
setup_xfail "alpha*-*-osf*"
# This fails for COFF i960-vxworks targets.
setup_xfail "i960-*-vxworks*"
fail "objcopy (simple copy)"
}
}
@ -87,19 +93,19 @@ if ![string match "" $got] then {
gets $file line
send_log "$line\n"
verbose $line
if ![string match $line "S0130000746D706469722F636F70792E7372656397\r"] {
if ![string match "S0130000746D706469722F636F70792E7372656397*" $line] {
send_log "bad header\n"
fail "objcopy -O srec"
} else {
while {[gets $file line] != -1 \
&& [regexp "^S\[123\]\[0-9a-fA-F\]+\r$" $line]} {
&& [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} {
send_log "$line\n"
verbose $line
set line "**EOF**"
}
send_log "$line\n"
verbose $line
if ![regexp "^S\[789\]\[0-9a-fA-F\]+\r$" $line] then {
if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then {
send_log "bad trailer\n"
fail "objcopy -O srec"
} else {
@ -177,7 +183,7 @@ set lowname ""
set headers [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/bintest.o"]
set headers_regexp "SECTION\[ 0-9\]+\\\[(\[^\]\]*)\\\]\[^\n\r\]*size\[ \]*(\[0-9a-fA-F\]+)\[0-9a-zA-Z \]*lma\[ \]*(\[0-9a-fA-F\]+)(.*)"
set headers_regexp "\[ 0-9\]+(\[^ \]+)\[ \]*(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+2\[*\]\[*\]\[0-9\]+(.*)"
set got $headers
while {[regexp $headers_regexp $got all name size vma rest]} {
@ -200,7 +206,7 @@ if {$low == "" || $origstart == ""} then {
fail "objcopy --adjust-vma"
} else {
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -fh tmpdir/copy.srec"]
set want "file format srec.*start address\[ \]*(\[0-9a-fA-FxX\]+).*vma\[ \]*(\[0-9a-fA-F\]+)"
set want "file format srec.*start address\[ \]*(\[0-9a-fA-FxX\]+).*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)"
if ![regexp $want $got all start vma] then {
fail "objcopy --adjust-vma"
} else {
@ -234,7 +240,7 @@ if {$low == "" || $origstart == ""} then {
fail "objcopy --adjust-section-vma +"
} else {
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/copy.srec"]
set want "file format srec.*SECTION\[ \]*0\[^\n\r\]*vma\[ \]*(\[0-9a-fA-F\]+)"
set want "file format srec.*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)"
if ![regexp $want $got all vma] then {
fail "objcopy --adjust-section-vma +"
} else {
@ -254,7 +260,7 @@ if {$low == "" || $origstart == ""} then {
fail "objcopy --adjust-section-vma ="
} else {
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/copy.srec"]
set want "file format srec.*SECTION\[ \]*0\[^\n\r\]*vma\[ \]*(\[0-9a-fA-F\]+)"
set want "file format srec.*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)"
if ![regexp $want $got all vma] then {
fail "objcopy --adjust-section-vma ="
} else {

@ -24,10 +24,11 @@ proc gas_version {} {
catch "exec $AS -version < /dev/null" tmp
# Should find a way to discard constant parts, keep whatever's
# left, so the version string could be almost anything at all...
regexp "version (cygnus-|)\[-0-9.a-zA-Z-\]+" $tmp version
set tmp $version
clone_output "[which $AS] $version\n"
unset tmp
regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" $tmp version cyg number
if ![info exists number] then {
return "[which $AS] (no version number)\n"
}
clone_output "[which $AS] $number\n"
unset version
}
@ -37,9 +38,13 @@ proc gas_run { prog as_opts redir } {
global comp_output
global srcdir
global subdir
global host_triplet
verbose "Executing $AS $ASFLAGS $as_opts $prog $redir"
verbose "Executing $srcdir/lib/run $AS $ASFLAGS $as_opts $srcdir/$subdir/$prog $redir"
catch "exec $srcdir/lib/run $AS $ASFLAGS $as_opts $srcdir/$subdir/$prog $redir" comp_output
set comp_output [prune_system_crud $host_triplet $comp_output]
verbose "output was $comp_output"
return [list $comp_output ""];
}
proc all_ones { args } {
@ -181,6 +186,7 @@ proc run_dump_test { name } {
global subdir srcdir
global OBJDUMP NM AS OBJCOPY
global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS
global host_triplet
if [string match "*/*" $name] {
set file $name
@ -258,6 +264,7 @@ proc run_dump_test { name } {
send_log "$AS $ASFLAGS $opts(as) -o dump.o $sourcefile\n"
catch "exec $srcdir/lib/run $AS $ASFLAGS $opts(as) -o dump.o $sourcefile" comp_output
set comp_output [prune_system_crud $host_triplet $comp_output]
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
@ -275,14 +282,18 @@ proc run_dump_test { name } {
verbose "running $binary $progopts $progopts1" 3
if { $program == "objcopy" } {
send_log "$binary $progopts $progopts1 dump.o dump.out\n"
if [catch "exec $binary $progopts $progopts1 dump.o dump.out" comp_output] {
catch "exec $binary $progopts $progopts1 dump.o dump.out" comp_output
set comp_output [prune_system_crud $host_triplet $comp_output]
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
fail $testname
return
}
} else {
send_log "$binary $progopts $progopts1 dump.o > dump.out\n"
if [catch "exec $binary $progopts $progopts1 dump.o > dump.out" comp_output] {
catch "exec $binary $progopts $progopts1 dump.o > dump.out" comp_output
set comp_output [prune_system_crud $host_triplet $comp_output]
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
fail $testname
return
@ -292,6 +303,7 @@ proc run_dump_test { name } {
verbose_eval {[file_contents "dump.out"]} 3
if { [regexp_diff "dump.out" "${file}.d"] } then {
fail $testname
verbose "output is [file_contents "dump.out"]" 2
return
}
@ -328,8 +340,10 @@ proc slurp_options { file } {
proc objdump { opts } {
global OBJDUMP
global comp_output
global host_triplet
catch "exec $OBJDUMP $opts" comp_output
set comp_output [prune_system_crud $host_triplet $comp_output]
verbose "objdump output=$comp_output\n" 3
}
@ -447,3 +461,29 @@ proc verbose_eval { expr { level 1 } } {
global verbose
if $verbose>$level then { eval verbose "$expr" $level }
}
# This definition is taken from an unreleased version of DejaGnu. Once
# that version gets released, and has been out in the world for a few
# months at least, it may be safe to delete this copy.
if ![string length [info proc prune_system_crud]] {
#
# prune_system_crud -- delete various system verbosities from TEXT on SYSTEM
#
# An example is:
# ld.so: warning: /usr/lib/libc.so.1.8.1 has older revision than expected 9
#
# SYSTEM is typical $target_triplet or $host_triplet.
#
# This is useful when trying to do pattern matches on program output.
# Sites with particular verbose os's may wish to override this in site.exp.
#
proc prune_system_crud { system text } {
# This is from sun4's. Do it for all machines for now.
# The "\\1" is to try to preserve a "\n" but only if necessary.
regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
# It might be tempting to get carried away and delete blank lines, etc.
# Just delete *exactly* what we're ask to, and that's it.
return $text
}
}

@ -1,3 +1,51 @@
Tue Jan 28 14:42:31 1997 Bob Manson <manson@charmed.cygnus.com>
Major rewrite for testsuite revision.
* lib/gdb.exp: Remove references to global CC, CXX, B_OPTIONS,
TARGET_INCLUDES, LDFLAGS and target_alias. Use gdb_spawn_id
instead of relying on spawn_id to always contain a valid
spawn id.
(get_compiler_info): New procedure to build the ${binfile}.ci
file, instead of replicating this in N different places.
(gdb_compile): New procedure.
gdb.*/*.exp: Use gdb_compile and get_compiler_info (with
appropriate arguments) instead of compile. Use gdb_test in a lot
more places. Use send_gdb instead of send. Always run gdb_start
at the start of a testcase, as this is no longer done magically.
config/*-gdb.exp: Rename without the -gdb suffix.
config/mips.exp: Use remote_close instead of exit_remote_shell.
config/monitor.exp: Use target_info instead of looking at
baud, timeout, etc.
config/sim.exp: Use gdb_spawn_id instead of relying on spawn_id.
Sat Dec 14 00:43:57 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* gdb.c++/templates.exp (test_ptype_of_templates),
gdb.c++/inherit.exp (test_ptype_si, test_print_anon_union):
Update expect patterns for destructors and assignment operators
to match corresponding c-typeprint.c changes.
* gdb.c++/templates.exp (test_template_breakpoints): Revert change
to destructor breakpoint test, GDB should be able to set the
destructor breakpoint without specifying arguments.
Tue Dec 3 20:17:52 1996 Fred Fish <fnf@ninemoons.com>
* gdb.threads/pthreads.exp: Change result for failure to compile due
to lack of pthreads runtime support from an error to simply an
unsupported test, per dejagnu standards.
Sun Dec 1 00:18:59 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* lib/gdb.exp (gdb_test): Simplify expect pattern for the case
where GDB exits to reduce pattern match time.
(skip_chill_tests): Skip chill tests for mips*-sgi-irix6*.
* gdb.base/nodebug.exp: Add mips*-sgi-irix6* xfails.
Tue Nov 26 18:29:23 1996 Michael Snyder <msnyder@cleaver.cygnus.com>
* gdb.base/callfuncs.exp: Turn on function call tests for h8300.

@ -1,2 +1 @@
push_target mvme135
load_lib ../config/monitor.exp

@ -0,0 +1 @@
load_lib "../config/monitor.exp"

@ -0,0 +1,105 @@
# Test Framework Driver for GDB using the extended gdb remote protocol
# Copyright 1995 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. */
#
# For this to function correctly, you need to set a number of variables
# in your gdb/site.exp file
#
# set noargs 1 -- we can't pass arguments (yet)
# set noinferiorio 1 -- we can't get io to/from the inferior
# set targethost <host> -- name of the remote system (runs gdbserver)
# set debughost <host> -- name of the system running gdb
# set port <number> -- starting port number for communication
# set gdbserver <path> -- path (on the remote side) to find
# gdbserver
# set rsh <path> -- path (on debughost side) to rsh
# set rcp <path> -- path (on debughost side) to rcp
#
# You will need to be able to spawn processes from gdbhost to run on
# targethost via rsh (this is how we start gdbserver); similarly
# you need to be able to rcp files from gdbhost to targethost.
#
# We don't do much error checking, if something goes wrong, you'll probably
# just get a tcl error and everything will die. FIXME
#
# Load the basic gdb testing library
load_lib gdb.exp
load_lib monitor.exp
#
# gdb_load -- load a file into the debugger.
# return a -1 if anything goes wrong.
#
# Loading a file in the gdbsrever framework is a little strange in that
# we also create the inferior (which is stopped at the first instruction
# in the program when we get control).
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global GDB
global prompt
global debughost
global port
# first load the file into gdb
if [gdb_file_cmd $arg] then { return -1 }
# bump the port number to avoid conflicts with hung ports
set targethost [target_info gdb_server_host];
set debughost [target_info gdb_debug_host];
if [target_info exists gdb_server_prog] {
set gdbserver [target_info gdb_server_prog];
} else {
set gdbserver "gdbserver";
}
incr port
set serialport $targethost:$port
# Copy the file down to the remote host.
set file [remote_download host $arg];
# now start gdbserver on the remote side
remote_spawn host "$gdbserver $debughost:$port $file >& /dev/null < /dev/null"
# give it plenty of time to get going (lynx)
sleep 30
# tell gdb we are remote debugging
gdb_target_monitor
return 1
}
#
# gdb_start -- start GDB running.
#
proc gdb_start { } {
global prompt
# do the usual stuff
catch default_gdb_start
# FIXME: This shouldn't be necessary, but lots of PA tests fail
# without it.
send "set remotecache 0\n"
expect {
-re "set remotecache 0\[\r\n\]+.*$prompt $" {}
default { fail "gdb_start"}
}
}

@ -0,0 +1,463 @@
# Copyright (C) 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
# 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:
# DejaGnu@cygnus.com
# This file was written by Michael Snyder <msnyder@cygnus.com>.
# GDB support routines for a board using Mitsubishi M32R remote debugging
# protocol.
load_lib remote.exp
load_lib gdb.exp
#
# M32R remote run command.
#
# This requires that we beep the user and ask him to push the board reset!
# Then we will switch to the monitor target, run the program, use 2 ^C's
# to interrupt the monitor target, and switch back to the remote target.
# Then we have to do a continue to get past the stub breakpoint.
#
proc gdb_run_cmd {} {
global prompt
global gdb_spawn_id
set timeout 60
verbose "Timeout is now $timeout seconds, starting remote stub" 2
send_user "Please reset the board now...\n"
sleep 1
send_user "\n"
sleep 1
send_user "\n"
sleep 1
send_user "\n"
# go back to monitor, run the program, interrupt it, and start remote.
if [target_info exists gdb_protocol] {
set protocol [target_info gdb_protocol];
} else {
set protocol "sparclet"
}
if [target_info exists serial] {
set targetname [target_info serial];
send_gdb "target $protocol [target_info serial]\n";
} else {
if ![target_info exists netport] {
perror "Need either netport or gdb_serial entry for [target_info name].";
return -1;
}
set targetname [target_info netport];
send_gdb "target $protocol udp [target_info netport]\n";
}
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Remote target.*$prompt $" { }
-i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
if $verbose>1 then {
send_user "Set target to $targetname\n"
}
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set M32R target."
return -1
}
}
send_gdb "disable\n";
expect {
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Breakpoints disabled" 2
}
-i $gdb_spawn_id timeout {
perror "(timeout) disabling breakpoints";
return -1
}
-i $gdb_spawn_id default {
perror "error disabling breakpoints";
}
}
send_gdb "run\n";
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*Starting program:.*$" {
verbose "Starting remote stub succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) starting the remote stub" ;
return -1
}
-i $gdb_spawn_id default {
perror "error starting the remote stub";
}
}
sleep 2;
send_gdb ""
sleep 1;
send_gdb ""
verbose "Sent ^C^C"
expect {
-i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "interrupting remote stub succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) interrupting the remote stub";
return -1
}
-i $gdb_spawn_id default {
perror "error interrupting the remote stub";
}
}
if [target_info exists gdb_serial] {
send_gdb "target remote [target_info gdb_serial]\n"
expect {
-i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
send_gdb "y\n";
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "connected to stub at [target_info gdb_serial]" 2
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set remote target."
return -1
}
}
}
send_gdb "enable\n";
expect {
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Breakpoints enabled" 2
}
-i $gdb_spawn_id timeout {
perror "(timeout) enabling breakpoints";
return -1
}
-i $gdb_spawn_id default {
perror "error enabling breakpoints";
}
}
send_gdb "continue\n";
return
}
#
# gdb_load -- load a file into the GDB.
# Returns a 0 if there was an error,
# 1 if it load successfully.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global prompt
global GDB
global expect_out
global gdb_spawn_id
set loadfile [file tail $arg]
set loadpath [file dirname $arg]
if [target_info exists gdb_protocol] {
set protocol [target_info gdb_protocol];
} else {
set protocol "m32r"
}
# get the stub-based loader for faster loading
send_gdb "file [target_info gdb_loader]\n"
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
-i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't find loader" }
-i $gdb_spawn_id timeout {
perror "(timeout) read symbol file" ;
return -1
}
}
if [target_info exists serial] {
set targetname [target_info serial];
send_gdb "target $protocol [target_info serial]\n";
} else {
if ![target_info exists netport] {
perror "Need either netport or gdb_serial entry for [target_info name].";
return -1;
}
set targetname [target_info netport];
send_gdb "target $protocol udp [target_info netport]\n";
}
expect {
-i $gdb_spawn_id -re "Remote target.*$prompt $" { }
-i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
if $verbose>1 then {
send_user "Set target to $targetname\n"
}
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set M32R target."
return -1
}
}
send_gdb "run\n";
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*Starting program:.*loader.*$" {
verbose "Starting loader succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) starting the loader" ;
return -1
}
-i $gdb_spawn_id default {
perror "error starting the loader";
}
}
sleep 2;
send_gdb ""
sleep 1;
send_gdb ""
verbose "Sent ^C^C"
expect {
-i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Running loader succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) interrupting the loader" ;
return -1
}
-i $gdb_spawn_id default {
perror "error interrupting the loader";
}
}
# Now ready to actually load the file:
send_gdb "file $arg\n"
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
-i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" }
-i $gdb_spawn_id timeout {
perror "(timeout) read symbol file" ;
return -1
}
}
if [target_info exists gdb_serial] {
send_gdb "target remote [target_info gdb_serial]\n"
expect {
-i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
send_gdb "y\n";
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Set remote target to [target_info serial]" 2
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set remote target."
return -1
}
}
}
if [target_info exists gdb_load_offset] {
set offset "[target_info gdb_load_offset]";
} else {
set offset "";
}
send_gdb "load $arg $offset\n"
verbose "Loading $arg into $GDB" 2
set timeout 1200
verbose "Timeout is now $timeout seconds" 2
expect {
-i $gdb_spawn_id -re "Loading.*$prompt $" {
verbose "Loaded $arg into $GDB" 1
set timeout 60
verbose "Timeout is now $timeout seconds" 2
}
-i $gdb_spawn_id -re "$prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
-i $gdb_spawn_id timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
send_user "Please reset the board now...\n"
sleep 1
send_user "\n"
sleep 1
send_user "\n"
sleep 1
send_user "\n"
# go back to monitor, run the program, interrupt it, and start remote.
if [target_info exists serial] {
set targetname [target_info serial];
send_gdb "target $protocol [target_info serial]\n";
} else {
if ![target_info exists netport] {
perror "Need either netport or gdb_serial entry for [target_info name].";
return -1;
}
set targetname [target_info netport];
send_gdb "target $protocol udp [target_info netport]\n";
}
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Remote target.*$prompt $" { }
-i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
if $verbose>1 then {
send_user "Set target to $targetname\n"
}
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set M32R target."
return -1
}
}
send_gdb "run\n";
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*Starting program:.*$" {
verbose "Starting remote stub succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) starting the remote stub" ;
return -1
}
-i $gdb_spawn_id default {
perror "error starting the remote stub";
}
}
sleep 2;
send_gdb ""
sleep 1;
send_gdb ""
verbose "Sent ^C^C"
expect {
-i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "interrupting remote stub succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) interrupting the remote stub";
return -1
}
-i $gdb_spawn_id default {
perror "error interrupting the remote stub";
}
}
if [target_info exists gdb_serial] {
send_gdb "target remote [target_info gdb_serial]\n"
expect {
-i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
send_gdb "y\n";
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "connected to stub at [target_info gdb_serial]" 2
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set remote target."
return -1
}
}
}
return 0
}

@ -1,251 +0,0 @@
# Copyright (C) 1993 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:
# DejaGnu@cygnus.com
# This file was written by Ian Lance Taylor <ian@cygnus.com>.
# GDB support routines for a board using the MIPS remote debugging
# protocol. These are actually pretty generic.
# DejaGnu currently assumes that debugging is being done over the main
# console port. It would probably be more convenient for people using
# IDT boards to permit the debugging port and the connected port to be
# different, since an IDT board has two ports. This would require
# extending some of the tests in a fashion similar to that done for
# VxWorks, because the test output would appear on the other port,
# rather than being displayed by gdb.
load_lib remote.exp
load_lib gdb.exp
#
# gdb_version -- extract and print the version number of gdb
#
proc gdb_version {} {
global GDB
global GDBFLAGS
global prompt
set tmp [exec echo "q" | $GDB]
set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]]
set version [string range $version 0 [expr [string length $version]-2]]
clone_output "[which $GDB] version $version $GDBFLAGS\n"
}
#
# gdb_load -- load a file into the GDB.
# Returns a 0 if there was an error,
# 1 if it load successfully.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global prompt
global spawn_id
global GDB
global expect_out
global targetname
set loadfile [file tail $arg]
set loadpath [file dirname $arg]
send "file $arg\n"
expect {
-re "A program is being debugged already..*Kill it.*y or n. $" {
send "y\n"
exp_continue
}
-re "Reading symbols from.*done..*$prompt $" {}
-re "$prompt $" { perror "GDB couldn't read file" }
timeout { perror "(timeout) read symbol file" ; return -1 }
}
send "target mips $targetname\n"
set timeout 60
verbose "Timeout is now $timeout seconds" 2
expect {
-re "Remote MIPS debugging.*$prompt $" {
if $verbose>1 then {
send_user "Set target to $targetname\n"
}
}
timeout {
perror "Couldn't set MIPS target."
set timeout 10
verbose "Timeout is now $timeout seconds" 2
return -1
}
}
send "load $arg\n"
if $verbose>1 then {
send_user "Loading $arg into $GDB\n"
}
set timeout 2400
verbose "Timeout is now $timeout seconds" 2
expect {
-re "Loading.*$prompt $" {
if $verbose>1 then {
send_user "Loaded $arg into $GDB\n"
}
set timeout 30
verbose "Timeout is now $timeout seconds" 2
}
-re "$prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
if [info exists expect_out(buffer)] then {
send_log $expect_out(buffer)
}
return 0
}
#
# gdb_start -- start GDB running.
#
proc gdb_start { } {
global GDB
global GDBFLAGS
global spawn_id
global shell_id
global prompt
global verbose
global targetname
global connectmode
global reboot
global baud
# reboot the board to get a clean start
if $reboot then {
if ![info exists connectmode] then {
set connectmode "kermit"
}
if ![info exists baud] then {
set baud 9600
}
set shell_id [ eval $connectmode "$targetname" ]
send -i $shell_id "\n"
expect {
-i $shell_id -re "<IDT>$" { }
timeout {
send -i $shell_id "\CC"
expect {
-i $shell_id -re "<IDT>$" { }
timeout {
perror "(timeout) board did not come up."; return -1
}
}
}
}
send -i $shell_id "go 0xbfc00000\n"
expect {
-i $shell_id -re "<IDT>$" { }
timeout { perror "(timeout) board did not come up."; return -1 }
}
verbose "about to exit kermit"
exit_remote_shell $shell_id
}
set GDB [which $GDB]
# start GDB
if [ llength $GDBFLAGS ] then {
spawn $GDB $GDBFLAGS
} else {
spawn $GDB
}
expect {
-re ".*\r\n$prompt $" {
verbose "GDB initialized."
}
-re "$prompt $" {
perror "GDB never initialized."
return -1
}
timeout {
perror "(timeout) GDB never initialized."
return -1
}
}
# force the height to "unlimited", so no pagers get used
send "set height 0\n"
expect -re ".*$prompt $" {}
# force the width to "unlimited", so no wraparound occurs
send "set width 0\n"
expect -re ".*$prompt $" {}
# Don't use floating point instructions, in case the board doesn't
# support them.
send "set mipsfpu off\n"
expect -re ".*$prompt $" {}
# if $verbose>1 then {
# send_user "Setting up target, please wait...\n"
# }
# send "target mips $targetname\n"
# set timeout 60
# verbose "Timeout is now $timeout seconds" 2
# expect {
# -re "Remote MIPS debugging.*$prompt $" {
# if $verbose>1 then {
# send_user "Set target to $targetname\n"
# }
# }
# timeout {
# perror "Couldn't set MIPS target."
# set timeout 10
# verbose "Timeout is now $timeout seconds" 2
# return -1
# }
# }
set timeout 10
verbose "Timeout is now $timeout seconds" 2
}
expect_after {
"<return>" { send "\n"; perror "Window too small." }
-re "\(y or n\) " { send "n\n"; perror "Got interactive prompt." }
full_buffer { perror "internal buffer is full." }
eof { perror "eof -- pty is hosed." }
timeout { perror "timeout." }
"virtual memory exhausted" { perror "virtual memory exhausted." }
"Undefined command" { perror "send string probably wrong." }
}
proc gdb_exit { } {
catch default_gdb_exit
}
gdb_start
# make sure gdb has actually started, otherwise if the first test
# timesout, DejaGnu crashes
send "\n"
expect {
-re "$prompt"
}

@ -0,0 +1,22 @@
# Copyright (C) 1993 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:
# DejaGnu@cygnus.com
load_lib ../config/monitor.exp

@ -0,0 +1,22 @@
# Copyright (C) 1993 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:
# DejaGnu@cygnus.com
load_lib ../config/monitor.exp

@ -17,13 +17,6 @@
load_lib gdb.exp
#
# gdb_version -- extract and print the version number of gdb
#
proc gdb_version {} {
default_gdb_version
}
#
# gdb_target_monitor
# Set gdb to target the monitor
@ -31,27 +24,41 @@ proc gdb_version {} {
proc gdb_target_monitor { } {
global prompt
global exit_status
global targetname
global serialport
global baud
global target_info
global timeout
set timeout 60
if {$baud != ""} then {
send "set remotebaud $baud\n"
verbose "Timeout is now $timeout seconds" 2
if [target_info exists gdb_protocol] {
set targetname "[target_info gdb_protocol]"
} else {
perror "No protocol specified for [target_info name].";
return -1;
}
if [info exists target_info(target,cflags)] {
set targetname "$target_info(target,target)"
if [target_info exists baud] {
send_gdb "set remotebaud [target_info baud]\n"
}
if [info exists target_info(target,netport)] {
set serialport "$target_info(target,netport)"
if [target_info exists netport] {
set serialport "[target_info netport]"
} else {
set serialport "[target_info serial]"
}
for {set i 1} {$i <= 3} {incr i} {
send "target $targetname $serialport\n"
expect {
-re "Remote target $targetname connected to.*$prompt $" {
verbose "Set target to $targetname"
return
for {set j 1} {$j <= 2} {incr j} {
for {set i 1} {$i <= 3} {incr i} {
send_gdb "target $targetname $serialport\n"
expect {
-re "Remote MIPS debugging.*" {
verbose "Set target to $targetname"
return
}
-re "Remote debugging using $serialport.*" {
verbose "Set target to $targetname"
return
}
-re "Remote target $targetname connected to.*" {
verbose "Set target to $targetname"
return
}
-re "Connection refused" {
verbose "Connection refused by remote target. Pausing, and trying again."
@ -61,10 +68,14 @@ proc gdb_target_monitor { } {
timeout {
break
}
}
}
if { $j == 1 && ![reboot_target] } {
break;
}
}
perror "Couldn't set target for $targetname."
perror "Couldn't set target for $targetname, port is $serialport."
cleanup
exit $exit_status
}
@ -79,14 +90,23 @@ proc gdb_load { arg } {
global loadfile
global GDB
global prompt
global timeout
if [gdb_file_cmd $arg] then { return -1 }
if { $arg != "" } {
if [gdb_file_cmd $arg] { return -1 }
}
gdb_target_monitor
if [is_remote host] {
# FIXME:
set arg a.out;
}
verbose "Loading $arg"
send "load $arg\n"
set timeout 600
send_gdb "load $arg\n"
set timeout 1000
verbose "Timeout is now $timeout seconds" 2
expect {
-re ".*$prompt $" {
if { $verbose > 1 } {
@ -101,24 +121,22 @@ proc gdb_load { arg } {
}
timeout {
if { $verbose > 1 } {
perror "Timed out trying to load $arg."
perror "Timed out trying to load $arg."
}
}
}
}
#
# gdb_start -- start GDB running.
#
proc gdb_start { } {
default_gdb_start
}
global timeout
global reboot
#
# gdb_exit -- exit gdb
#
proc gdb_exit { } {
catch default_gdb_exit
}
# reboot the board to get a clean start
if $reboot then {
reboot_target;
}
catch default_gdb_start;
gdb_start
set timeout 10
verbose "Timeout is now $timeout seconds" 2
}

@ -23,7 +23,6 @@ load_lib gdb.exp
load_lib remote.exp
global shell_id
global passwd
global LD
if ![info exists LD] then {
@ -55,9 +54,11 @@ proc gdb_load { arg } {
global LD
global NLMCONV
global errorCode
global targetname
global shell_id
# FIXME: this is wrong.
set targetname [target_info name];
set obj [file tail $arg]
set nlm "$obj.nlm"
set lnk "$obj.lnk"
@ -101,21 +102,24 @@ proc gdb_load { arg } {
gdb_file_cmd $nlm
}
proc gdb_start { } {
default_gdb_start
}
proc gdb_exit { } {
catch default_gdb_exit
}
proc gdb_run_cmd { } {
global shell_id
global prompt
global baud serialport
global targetname
global timeout
set connhost [target_info name];
if [board_info $connhost exists serial] {
set serialport [board_info $connhost serial];
} else {
set serialport [board_info $connhost netport];
}
if [board_info $connhost exists baud] {
set baud [board_info $connhost baud];
} else {
set baud 9600;
}
# FIXME: This is wrong.
send "kill\n"
expect {
-re ".*Kill the program being debugged.*y or n. $" {
@ -125,7 +129,7 @@ proc gdb_run_cmd { } {
-re ".*$prompt $" {}
}
verbose "Starting GDB stub on $targetname" 1
verbose "Starting GDB stub on [target_info name]" 1
send -i $shell_id "load nlmstub BAUD=$baud x.nlm\r\n"
send "set remotebaud $baud\n"
@ -148,12 +152,14 @@ proc gdb_run_cmd { } {
}
-re "$prompt" {}
timeout {
set timeout $otimeout
verbose "Timeout restored to $timeout seconds" 2
perror "Couldn't set remote target"
return
}
}
set timeout $otimeout
verbose "Timeout is now $timeout seconds" 2
verbose "Timeout restored to $timeout seconds" 2
send "continue\n"
expect {
@ -170,7 +176,7 @@ proc gdb_run_cmd { } {
#
set shell_prompt "Password:"
set shell_id [ eval $connectmode "$targetname" ]
set shell_id [remote_open target]
if $shell_id<0 then {
warning "Couldn't connect to target"
@ -199,7 +205,8 @@ expect {
}
set shell_prompt "[string toupper $targetname]:"
# FIXME: this is wrong.
set shell_prompt "[string toupper [target_info name]]:"
send -i $shell_id "1\n"
expect {
@ -209,5 +216,3 @@ expect {
return -1
}
}
gdb_start

@ -20,23 +20,7 @@
# This file was written by Rob Savoye. (rob@cygnus.com)
# these need to be initialized only if site.exp doesn't set them
if ![info exists prompt] then {
set prompt "\(gdb\)"
}
#
# gdb_version -- extract and print the version number of gdb
#
proc gdb_version {} {
global GDB
global GDBFLAGS
global prompt
set tmp [exec echo "q" | $GDB]
set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]]
set version [string range $version 0 [expr [string length $version]-2]]
clone_output "[which $GDB] version $version $GDBFLAGS\n"
}
load_lib gdb.exp
#
# gdb_load -- load a file into the debugger.
@ -61,27 +45,5 @@ proc gdb_start { } {
global spawn_id
global prompt
global verbose
global targetname
send_user "Not implememted yet\n" ; return -1
}
expect_after {
"<return>" { send "\n"; clone_output "ERROR: Window too small" }
-re "\(y or n\) " { send "n\n"; clone_output "ERROR: Got interactive prompt" }
full_buffer { clone_output "ERROR: internal buffer is full" }
eof { clone_output "ERROR: eof -- pty is hosed" }
timeout { clone_output "ERROR: timeout" }
"virtual memory exhausted" { clone_output "ERROR: virtual memory exhausted" }
"Undefined command" { clone_output "ERROR: send string probably wrong" }
}
load_lib gdb.exp
gdb_start
# make sure gdb has actually started, otherwise if the first test
# timesout, DejaGnu crashes
send "\n"
expect {
-re "$prompt"
}

@ -17,13 +17,6 @@
load_lib gdb.exp
#
# gdb_version -- extract and print the version number of gdb
#
proc gdb_version {} {
default_gdb_version
}
# The SH simulator by default will allocate 16M of memory, which is
# convenient, but it slows down testing to chew up that much swap;
# so supply an option that makes the simulator allocate 256K.
@ -39,13 +32,14 @@ if [istarget "sh*-*-*"] then {
# Set gdb to target the simulator
#
proc gdb_target_sim { } {
global targetname
global prompt
global verbose
global exit_status
global target_sim_options
global gdb_spawn_id
send "target sim $target_sim_options\n"
set spawn_id $gdb_spawn_id
send_gdb "target sim $target_sim_options\n"
set timeout 60
verbose "Timeout is now $timeout seconds" 2
expect {
@ -72,12 +66,15 @@ proc gdb_load { arg } {
global loadfile
global GDB
global prompt
global gdb_spawn_id
set spawn_id $gdb_spawn_id
if [gdb_file_cmd $arg] then { return -1 }
gdb_target_sim
send "load\n"
send_gdb "load\n"
set timeout 2400
verbose "Timeout is now $timeout seconds" 2
expect {
@ -101,27 +98,3 @@ proc gdb_load { arg } {
}
}
}
#
# gdb_start -- start GDB running.
#
proc gdb_start { } {
default_gdb_start
verbose "Setting up target, Please wait..."
}
#
# gdb_exit -- exit gdb
#
proc gdb_exit { } {
catch default_gdb_exit
}
gdb_start
# make sure gdb has actually started, otherwise if the first test
# timesout, DejaGnu crashes
send "\n"
expect {
-re "$prompt"
}

@ -1,273 +0,0 @@
# Copyright (C) 1993 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:
# DejaGnu@cygnus.com
# This file was written by Ian Lance Taylor <ian@cygnus.com>.
# GDB support routines for a board using the MIPS remote debugging
# protocol. These are actually pretty generic.
# DejaGnu currently assumes that debugging is being done over the main
# console port. It would probably be more convenient for people using
# IDT boards to permit the debugging port and the connected port to be
# different, since an IDT board has two ports. This would require
# extending some of the tests in a fashion similar to that done for
# VxWorks, because the test output would appear on the other port,
# rather than being displayed by gdb.
load_lib remote.exp
load_lib gdb.exp
#
# gdb_version -- extract and print the version number of gdb
#
proc gdb_version {} {
global GDB
global GDBFLAGS
global prompt
set tmp [exec echo "q" | $GDB]
set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]]
set version [string range $version 0 [expr [string length $version]-2]]
clone_output "[which $GDB] version $version $GDBFLAGS\n"
}
#
# gdb_load -- load a file into the GDB.
# Returns a 0 if there was an error,
# 1 if it load successfully.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global prompt
global spawn_id
global GDB
global expect_out
global targetname
set loadfile [file tail $arg]
set loadpath [file dirname $arg]
send "file $arg\n"
expect {
-re "A program is being debugged already..*Kill it.*y or n. $" {
send "y\n"
exp_continue
}
-re "Load new symbol table.*y or n. $" {
send "y\n"
exp_continue
}
-re "Reading symbols from.*done..*$prompt $" {}
-re "$prompt $" { perror "GDB couldn't read file" }
timeout { perror "(timeout) read symbol file" ; return -1 }
}
send "target sparclite $targetname\n"
set timeout 60
verbose "Timeout is now $timeout seconds" 2
expect {
-re ".*SPARClite appears to be alive.*$prompt $" {
if $verbose>1 then {
send_user "Set target to $targetname\n"
}
}
timeout {
perror "Couldn't set SLITE target."
set timeout 10
verbose "Timeout is now $timeout seconds" 2
return -1
}
}
send "load $arg\n"
if $verbose>1 then {
send_user "Loading $arg into $GDB\n"
}
set timeout 2400
verbose "Timeout is now $timeout seconds" 2
expect {
-re "Loading.*$prompt $" {
if $verbose>1 then {
send_user "Loaded $arg into $GDB\n"
}
set timeout 30
verbose "Timeout is now $timeout seconds" 2
}
-re "$prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
send "target remote $targetname\n"
set timeout 60
verbose "Timeout is now $timeout seconds" 2
expect {
-re ".*$prompt $" {
if $verbose>1 then {
send_user "Set remote target to $targetname\n"
}
}
timeout {
perror "Couldn't set remote target."
set timeout 10
verbose "Timeout is now $timeout seconds" 2
return -1
}
}
if [info exists expect_out(buffer)] then {
send_log $expect_out(buffer)
}
return 0
}
#
# gdb_start -- start GDB running.
#
proc gdb_start { } {
global GDB
global GDBFLAGS
global spawn_id
global shell_id
global prompt
global verbose
global targetname
global connectmode
global reboot
global baud
# reboot the board to get a clean start
if $reboot then {
if ![info exists connectmode] then {
set connectmode "kermit"
}
if ![info exists baud] then {
set baud 9600
}
set shell_id [ eval $connectmode "$targetname" ]
send -i $shell_id "\n"
expect {
-i $shell_id -re ">$" { }
timeout {
send -i $shell_id "\CC"
expect {
-i $shell_id -re ">$" { }
timeout {
perror "(timeout) board did not come up."; return -1
}
}
}
}
send -i $shell_id "go 0xbfc00000\n"
expect {
-i $shell_id -re ">$" { }
timeout { perror "(timeout) board did not come up."; return -1 }
}
verbose "about to exit kermit"
exit_remote_shell $shell_id
}
set GDB [which $GDB]
# start GDB
if [ llength $GDBFLAGS ] then {
spawn $GDB $GDBFLAGS
} else {
spawn $GDB
}
expect {
-re ".*\r\n$prompt $" {
verbose "GDB initialized."
}
-re "$prompt $" {
perror "GDB never initialized."
return -1
}
timeout {
perror "(timeout) GDB never initialized."
return -1
}
}
# force the height to "unlimited", so no pagers get used
send "set height 0\n"
expect -re ".*$prompt $" {}
# force the width to "unlimited", so no wraparound occurs
send "set width 0\n"
expect -re ".*$prompt $" {}
# Don't use floating point instructions, in case the board doesn't
# support them.
# send "set mipsfpu off\n"
# expect -re ".*$prompt $" {}
# if $verbose>1 then {
# send_user "Setting up target, please wait...\n"
# }
# send "target mips $targetname\n"
# set timeout 60
# verbose "Timeout is now $timeout seconds" 2
# expect {
# -re "Remote MIPS debugging.*$prompt $" {
# if $verbose>1 then {
# send_user "Set target to $targetname\n"
# }
# }
# timeout {
# perror "Couldn't set MIPS target."
# set timeout 10
# verbose "Timeout is now $timeout seconds" 2
# return -1
# }
# }
set timeout 10
verbose "Timeout is now $timeout seconds" 2
}
expect_after {
"<return>" { send "\n"; perror "Window too small." }
-re "\(y or n\) " { send "n\n"; perror "Got interactive prompt." }
full_buffer { perror "internal buffer is full." }
eof { perror "eof -- pty is hosed." }
timeout { perror "timeout." }
"virtual memory exhausted" { perror "virtual memory exhausted." }
"Undefined command" { perror "send string probably wrong." }
}
proc gdb_exit { } {
catch default_gdb_exit
}
gdb_start
# make sure gdb has actually started, otherwise if the first test
# timesout, DejaGnu crashes
send "\n"
expect {
-re "$prompt"
}

@ -0,0 +1,168 @@
# Copyright (C) 1993 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:
# DejaGnu@cygnus.com
# This file was written by Ian Lance Taylor <ian@cygnus.com>.
# GDB support routines for a board using the MIPS remote debugging
# protocol. These are actually pretty generic.
# DejaGnu currently assumes that debugging is being done over the main
# console port. It would probably be more convenient for people using
# IDT boards to permit the debugging port and the connected port to be
# different, since an IDT board has two ports. This would require
# extending some of the tests in a fashion similar to that done for
# VxWorks, because the test output would appear on the other port,
# rather than being displayed by gdb.
load_lib remote.exp
load_lib gdb.exp
set prompt "\\(gdb\\)"
#
# gdb_load -- load a file into the GDB.
# Returns a 0 if there was an error,
# 1 if it load successfully.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global prompt
global GDB
global expect_out
global gdb_spawn_id
set loadfile [file tail $arg]
set loadpath [file dirname $arg]
send_gdb "file $arg\n"
expect {
-i $gdb_spawn_id -re "A program is being debugged already..*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
-i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" }
-i $gdb_spawn_id timeout { perror "(timeout) read symbol file" ; return -1 }
}
if [target_info exists gdb_protocol] {
set protocol [target_info gdb_protocol];
} else {
set protocol "sparclite"
}
if [target_info exists serial] {
set targetname [target_info serial];
send_gdb "target $protocol [target_info serial]\n";
} else {
if ![target_info exists netport] {
perror "Need either netport or gdb_serial entry for [target_info name].";
return -1;
}
set targetname [target_info netport];
send_gdb "target $protocol udp [target_info netport]\n";
}
set timeout 60
verbose "Timeout is now $timeout seconds" 2
expect {
-i $gdb_spawn_id -re "Remote target.*$prompt $" { }
-i $gdb_spawn_id -re ".*SPARClite appears to be alive.*$prompt $" {
if $verbose>1 then {
send_user "Set target to $targetname\n"
}
}
-i $gdb_spawn_id timeout {
perror "Couldn't set SLITE target."
set timeout 10
verbose "Timeout is now $timeout seconds" 2
return -1
}
}
if [target_info exists gdb_load_offset] {
set offset "[target_info gdb_load_offset]";
} else {
set offset "";
}
if { 1 } {
send_gdb "load $arg $offset\n"
verbose "Loading $arg into $GDB" 2
set timeout 2400
verbose "Timeout is now $timeout seconds" 2
expect {
-i $gdb_spawn_id -re "Loading.*$prompt $" {
verbose "Loaded $arg into $GDB" 1
set timeout 30
verbose "Timeout is now $timeout seconds" 2
}
-i $gdb_spawn_id -re "$prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
-i $gdb_spawn_id timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
}
set timeout 10
verbose "Timeout is now $timeout seconds, doing monitor run" 2
send_gdb "monitor run\n";
sleep 2;
send_gdb "";
expect {
-i $gdb_spawn_id -re ".*$prompt $" { verbose "Run command succeded" }
-i $gdb_spawn_id default {
perror "error sending monitor run command";
}
}
if [target_info exists gdb_serial] {
send_gdb "target remote [target_info gdb_serial]\n"
set timeout 60
verbose "Timeout is now $timeout seconds" 2
expect {
-i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
send_gdb "y\n";
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Set remote target to [target_info serial]" 2
}
-i $gdb_spawn_id timeout {
perror "Couldn't set remote target."
set timeout 10
verbose "Timeout is now $timeout seconds" 2
return -1
}
}
}
if [info exists expect_out(buffer)] then {
send_log $expect_out(buffer)
}
return 0
}

@ -0,0 +1,463 @@
# Copyright (C) 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
# 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:
# DejaGnu@cygnus.com
# This file was written by Michael Snyder <msnyder@cygnus.com>.
# GDB support routines for a board using the sparclet remote debugging
# protocol.
load_lib remote.exp
load_lib gdb.exp
set prompt "\\(gdbslet\\)"
#
# Sparclet remote run command.
#
# This requires that we beep the user and ask him to push the board reset!
# Then we will switch to the monitor target, run the program, use 2 ^C's
# to interrupt the monitor target, and switch back to the remote target.
# Then we have to do a continue to get past the stub breakpoint.
#
proc gdb_run_cmd {} {
global prompt
global gdb_spawn_id
set timeout 60
verbose "Timeout is now $timeout seconds, starting remote stub" 2
send_user "Please reset the board now...\n"
sleep 1
send_user "\n"
sleep 1
send_user "\n"
sleep 1
send_user "\n"
# go back to monitor, run the program, interrupt it, and start remote.
if [target_info exists gdb_protocol] {
set protocol [target_info gdb_protocol];
} else {
set protocol "sparclet"
}
if [target_info exists serial] {
set targetname [target_info serial];
send_gdb "target $protocol [target_info serial]\n";
} else {
if ![target_info exists netport] {
perror "Need either netport or gdb_serial entry for [target_info name].";
return -1;
}
set targetname [target_info netport];
send_gdb "target $protocol udp [target_info netport]\n";
}
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Remote target.*$prompt $" { }
-i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
if $verbose>1 then {
send_user "Set target to $targetname\n"
}
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set SPARCLET target."
return -1
}
}
send_gdb "disable\n";
expect {
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Breakpoints disabled" 2
}
-i $gdb_spawn_id timeout {
perror "(timeout) disabling breakpoints";
return -1
}
-i $gdb_spawn_id default {
perror "error disabling breakpoints";
}
}
send_gdb "run\n";
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*Starting program:.*$" {
verbose "Starting remote stub succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) starting the remote stub" ;
return -1
}
-i $gdb_spawn_id default {
perror "error starting the remote stub";
}
}
sleep 2;
send_gdb ""
sleep 1;
send_gdb ""
verbose "Sent ^C^C"
expect {
-i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "interrupting remote stub succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) interrupting the remote stub";
return -1
}
-i $gdb_spawn_id default {
perror "error interrupting the remote stub";
}
}
if [target_info exists gdb_serial] {
send_gdb "target remote [target_info gdb_serial]\n"
expect {
-i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
send_gdb "y\n";
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "connected to stub at [target_info gdb_serial]" 2
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set remote target."
return -1
}
}
}
send_gdb "enable\n";
expect {
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Breakpoints enabled" 2
}
-i $gdb_spawn_id timeout {
perror "(timeout) enabling breakpoints";
return -1
}
-i $gdb_spawn_id default {
perror "error enabling breakpoints";
}
}
send_gdb "continue\n";
return
}
#
# gdb_load -- load a file into the GDB.
# Returns a 0 if there was an error,
# 1 if it load successfully.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global prompt
global GDB
global expect_out
global gdb_spawn_id
set loadfile [file tail $arg]
set loadpath [file dirname $arg]
if [target_info exists gdb_protocol] {
set protocol [target_info gdb_protocol];
} else {
set protocol "sparclet"
}
# get the stub-based loader for faster loading
send_gdb "file [target_info gdb_loader]\n"
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
-i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't find loader" }
-i $gdb_spawn_id timeout {
perror "(timeout) read symbol file" ;
return -1
}
}
if [target_info exists serial] {
set targetname [target_info serial];
send_gdb "target $protocol [target_info serial]\n";
} else {
if ![target_info exists netport] {
perror "Need either netport or gdb_serial entry for [target_info name].";
return -1;
}
set targetname [target_info netport];
send_gdb "target $protocol udp [target_info netport]\n";
}
expect {
-i $gdb_spawn_id -re "Remote target.*$prompt $" { }
-i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
if $verbose>1 then {
send_user "Set target to $targetname\n"
}
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set SPARCLET target."
return -1
}
}
send_gdb "run\n";
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*Starting program:.*loader.*$" {
verbose "Starting loader succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) starting the loader" ;
return -1
}
-i $gdb_spawn_id default {
perror "error starting the loader";
}
}
sleep 2;
send_gdb ""
sleep 1;
send_gdb ""
verbose "Sent ^C^C"
expect {
-i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Running loader succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) interrupting the loader" ;
return -1
}
-i $gdb_spawn_id default {
perror "error interrupting the loader";
}
}
# Now ready to actually load the file:
send_gdb "file $arg\n"
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
-i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" }
-i $gdb_spawn_id timeout {
perror "(timeout) read symbol file" ;
return -1
}
}
if [target_info exists gdb_serial] {
send_gdb "target remote [target_info gdb_serial]\n"
expect {
-i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
send_gdb "y\n";
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Set remote target to [target_info serial]" 2
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set remote target."
return -1
}
}
}
if [target_info exists gdb_load_offset] {
set offset "[target_info gdb_load_offset]";
} else {
set offset "";
}
send_gdb "load $arg $offset\n"
verbose "Loading $arg into $GDB" 2
set timeout 1200
verbose "Timeout is now $timeout seconds" 2
expect {
-i $gdb_spawn_id -re "Loading.*$prompt $" {
verbose "Loaded $arg into $GDB" 1
set timeout 60
verbose "Timeout is now $timeout seconds" 2
}
-i $gdb_spawn_id -re "$prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
-i $gdb_spawn_id timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
send_user "Please reset the board now...\n"
sleep 1
send_user "\n"
sleep 1
send_user "\n"
sleep 1
send_user "\n"
# go back to monitor, run the program, interrupt it, and start remote.
if [target_info exists serial] {
set targetname [target_info serial];
send_gdb "target $protocol [target_info serial]\n";
} else {
if ![target_info exists netport] {
perror "Need either netport or gdb_serial entry for [target_info name].";
return -1;
}
set targetname [target_info netport];
send_gdb "target $protocol udp [target_info netport]\n";
}
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Remote target.*$prompt $" { }
-i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
if $verbose>1 then {
send_user "Set target to $targetname\n"
}
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set SPARCLET target."
return -1
}
}
send_gdb "run\n";
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*Starting program:.*$" {
verbose "Starting remote stub succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) starting the remote stub" ;
return -1
}
-i $gdb_spawn_id default {
perror "error starting the remote stub";
}
}
sleep 2;
send_gdb ""
sleep 1;
send_gdb ""
verbose "Sent ^C^C"
expect {
-i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "interrupting remote stub succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) interrupting the remote stub";
return -1
}
-i $gdb_spawn_id default {
perror "error interrupting the remote stub";
}
}
if [target_info exists gdb_serial] {
send_gdb "target remote [target_info gdb_serial]\n"
expect {
-i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
send_gdb "y\n";
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "connected to stub at [target_info gdb_serial]" 2
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set remote target."
return -1
}
}
}
return 0
}

@ -0,0 +1,332 @@
# Copyright (C) 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
# 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:
# DejaGnu@cygnus.com
# This file was written by Michael Snyder <msnyder@cygnus.com>.
# GDB support routines for a board using the sparclet remote debugging
# protocol.
load_lib remote.exp
load_lib gdb.exp
set prompt "\\(gdbslet\\)"
#
# Sparclet remote run command.
#
# This requires that we beep the user and ask him to push the board reset!
# Then we will switch to the monitor target, run the program, use 2 ^C's
# to interrupt the monitor target, and switch back to the remote target.
# Then we have to do a continue to get past the stub breakpoint.
#
proc gdb_start { } {
global gdb_spawn_id;
global prompt
global GDB
if { [default_gdb_start] != 0 } {
return -1;
}
if [target_info exists baud] {
send_gdb "set remotebaud [target_info baud]\n"
expect {
-i $gdb_spawn_id -re ".*$prompt" { }
-i $gdb_spawn_id default {
perror "Error setting baud rate."
return -1;
}
}
}
for {set x 1;} { $x < 4 } {incr x} {
if { [gdb_sparclet_startup] > 0 } {
break;
}
reboot_target;
}
return 1;
}
proc gdb_sparclet_startup { } {
global gdb_spawn_id;
global prompt
global GDB
set timeout 5;
set is_running_stub 0;
send_gdb "target sparclet [target_info serial]\n";
expect {
-i $gdb_spawn_id -re ".*already.*y or n." {
gdb_send "y\n";
exp_continue;
}
-i $gdb_spawn_id -re "Remote target.*connected to.*$prompt" { }
-i $gdb_spawn_id timeout {
verbose "timed out, checking if stub is already running"
set timeout 10
send_gdb "\003";
expect {
-i $gdb_spawn_id -re ".*$prompt" {
}
-i $gdb_spawn_id default {
perror "sparclet board isn't responding";
return -1;
}
}
send_gdb "target remote [target_info gdb_serial]\n";
expect {
-i $gdb_spawn_id -re ".*Remote debugging.*$prompt" {
verbose "stub is already running"
set is_running_stub 1;
}
-i $gdb_spawn_id default {
perror "sparclet board isn't responding";
return -1;
}
}
}
}
if { $is_running_stub == 0 } {
global srcdir
if ![file exists loader] {
set result [target_compile "${srcdir}/config/sparclet-loader.c" "loader" executable "libs=-Wl,-Ttext,[target_info gdb_stub_offset]"];
}
set loader "loader";
send_gdb "file $loader\n";
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
-i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't find loader" }
-i $gdb_spawn_id timeout {
perror "(timeout) read symbol file" ;
return -1
}
}
send_gdb "target [target_info gdb_protocol] [target_info serial]\n";
expect {
-i $gdb_spawn_id -re "Remote target.*connected to.*$prompt" { }
-i $gdb_spawn_id default {
perror "Error reconnecting to sparclet.";
return -1;
}
}
send_gdb "load $loader [target_info gdb_stub_offset]\n"
verbose "Loading $loader into $GDB" 2
set timeout 1200
verbose "Timeout is now $timeout seconds" 2
expect {
-i $gdb_spawn_id -re "Loading.*$prompt $" {
verbose "Loaded $loader into $GDB" 1
set timeout 60
verbose "Timeout is now $timeout seconds" 2
}
-i $gdb_spawn_id -re "$prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
-i $gdb_spawn_id timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
send_gdb "run\n";
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*Starting program:.*loader.*$" {
verbose "Starting loader succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) starting the loader" ;
return -1
}
-i $gdb_spawn_id default {
perror "error starting the loader";
}
}
sleep 2;
send_gdb ""
sleep 1;
send_gdb ""
verbose "Sent ^C^C"
expect {
-i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Running loader succeeded"
}
-i $gdb_spawn_id timeout {
perror "(timeout) interrupting the loader" ;
return -1
}
-i $gdb_spawn_id default {
perror "error interrupting the loader";
}
}
gdb_exit;
return [gdb_start];
}
return 1;
}
proc gdb_run_cmd { args } {
global gdb_spawn_id
global prompt
gdb_breakpoint exit;
send_gdb "set \$fp=0\n";
expect {
-i $gdb_spawn_id -re ".*$prompt" { }
}
send_gdb "jump start\n";
expect {
-i $gdb_spawn_id -re ".*y or n. $" {
send_gdb "y\n"
}
-i $gdb_spawn_id -re "Continuing at.*\[\r\n\]" { }
-i $gdb_spawn_id default {
return "failed"
}
}
return "";
}
#
# gdb_load -- load a file into the GDB.
# Returns a 0 if there was an error,
# 1 if it load successfully.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global prompt
global GDB
global expect_out
global gdb_spawn_id
set loadfile [file tail $arg]
set loadpath [file dirname $arg]
if [target_info exists gdb_protocol] {
set protocol [target_info gdb_protocol];
} else {
set protocol "sparclet"
}
send_gdb "file $arg\n"
expect {
-i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
-i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" }
-i $gdb_spawn_id timeout {
perror "(timeout) read symbol file" ;
return -1
}
}
if [target_info exists gdb_serial] {
send_gdb "target remote [target_info gdb_serial]\n"
expect {
-i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
send_gdb "y\n";
exp_continue
}
-i $gdb_spawn_id -re ".*$prompt $" {
verbose "Set remote target to [target_info serial]" 2
}
-i $gdb_spawn_id timeout {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
perror "Couldn't set remote target."
return -1
}
}
}
if [target_info exists gdb_load_offset] {
set offset "[target_info gdb_load_offset]";
} else {
set offset "";
}
send_gdb "load $arg $offset\n"
verbose "Loading $arg into $GDB" 2
set timeout 1200
verbose "Timeout is now $timeout seconds" 2
expect {
-i $gdb_spawn_id -re "Loading.*$prompt $" {
verbose "Loaded $arg into $GDB" 1
set timeout 60
verbose "Timeout is now $timeout seconds" 2
}
-i $gdb_spawn_id -re "$prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
-i $gdb_spawn_id timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
send_gdb "list main\n";
expect {
-i $gdb_spawn_id -re ".*$prompt" { }
-i $gdb_spawn_id default {
perror "command for list main never completed";
return -1;
}
}
return 0
}

@ -20,30 +20,18 @@
# This file was written by Rob Savoye. (rob@cygnus.com)
#
# NOTE: these test assume that there is a udi_soc file in th
#
load_lib gdb.exp
load_lib udi.exp
#
# gdb_version -- extract and print the version number of gdb
#
proc gdb_version {} {
default_gdb_version
}
#
# gdb_target_udi
# Set gdb to the desired UDI target
#
proc gdb_target_udi { } {
global targetname
global prompt
global verbose
global exit_status
set targetname [target_info remote_host];
# set targets hostname
send "target udi $targetname\n"
set timeout 60
@ -79,6 +67,7 @@ proc gdb_target_udi { } {
# gdb_load -- load a file into the debugger.
# return a -1 if anything goes wrong.
#
proc gdb_load { arg } {
global verbose
global loadpath
@ -86,7 +75,9 @@ proc gdb_load { arg } {
global GDB
global prompt
if [gdb_file_cmd $arg] then { return -1 }
if [gdb_file_cmd $arg] {
return -1
}
gdb_target_udi
}
@ -117,12 +108,3 @@ proc gdb_exit { } {
}
close $in
}
gdb_start
# make sure gdb has actually started, otherwise if the first test
# timesout, DejaGnu crashes
send "\n"
expect {
-re "$prompt"
}

@ -27,57 +27,3 @@ set timeout 60
verbose "Timeout is now $timeout seconds" 2
load_lib gdb.exp
# variables that need to set up
#
if ![info exists prompt] then {
set prompt "\[(\]gdb\[)\]"
}
# some convenience abbreviations
#
if ![info exists hex] then {
set hex "0x\[0-9A-Fa-f\]+"
}
if ![info exists decimal] then {
set decimal "\[0-9\]+"
}
#
# gdb_version -- extract and print the version number of gcc
#
proc gdb_version {} {
default_gdb_version
}
#
# gdb_unload -- unload a file if one is loaded
#
#
# gdb_load -- load a file into the debugger.
# return a -1 if anything goes wrong.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global GDB
global prompt
upvar timeout timeout
return [gdb_file_cmd $arg]
}
proc gdb_start { } {
default_gdb_start
}
proc gdb_exit { } {
catch default_gdb_exit
}
set binpath /s1/users/rob/vxworks/bin/somewhere-bogus-that-needs-configuring
global GDB
set bin $GDB
gdb_start

@ -43,13 +43,9 @@ proc gdb_version {} {
# take precedence. Returns -1 on error, else 0.
#
proc gdb_load { arg } {
global shell_id
# gdb_exit
# spawn_vxgdb
set result 0
if { [vxworks_ld $shell_id $arg] != 0 } {
if { [vxworks_ld target $arg] != 0 } {
perror "Couldn't load $arg"
return -1
}
@ -58,20 +54,18 @@ proc gdb_load { arg } {
}
#
# gdb_start -- start gdb running and
# gdb_start -- start gdb running
#
proc gdb_start { } {
global prompt
global verbose
global targetname
global connectmode
global reboot
global shell_id
# get a connection to the board
set shell_id [ eval $connectmode "$targetname" ]
set shell_id [remote_open target]
if { $shell_id < 0 } then {
perror "Couldn't connect to $targetname."
perror "Couldn't connect to target."
return -1
}
verbose "Spawn id for remote shell is $shell_id"
@ -108,7 +102,6 @@ proc gdb_start { } {
proc spawn_vxgdb { } {
global prompt
global verbose
global targetname
default_gdb_start
@ -119,15 +112,15 @@ proc spawn_vxgdb { } {
verbose "Setting up target, Please wait..."
# set targets hostname
send "target vxworks $targetname\n"
send "target vxworks [target_info netport]\n"
set timeout 60
verbose "Timeout is now $timeout seconds" 2
expect {
-re "Done\..*$prompt $" {
verbose "Set target to $targetname" 1
verbose "Set target to [target_info netport]" 1
}
-re "net_connect: RPC: Program not registered.*$" {
perror "Couldn't set GDB to target $targetname."
perror "Couldn't set GDB to target [target_info netport]."
exit 1
}
timeout {
@ -142,10 +135,7 @@ proc spawn_vxgdb { } {
}
proc gdb_exit { } {
global shell_id
if [info exists shell_id] then {
exit_remote_shell $shell_id
}
remote_close target;
catch default_gdb_exit
}
@ -159,5 +149,3 @@ proc gdb_exit { } {
# "Undefined command" { perror "send string probably wrong." }
#}
gdb_start

@ -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
}

@ -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 $" {}
}

@ -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.

@ -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 $" {}
}

@ -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"

@ -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"

@ -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 $" {

@ -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

@ -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

@ -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)" }

@ -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

@ -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;
}
if { $arg <= 0 } {
set arg "unlimited";
}
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 [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 {

@ -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"

@ -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 {

@ -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;.*

@ -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
}

@ -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

@ -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
}

@ -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

@ -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"

@ -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.

@ -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

@ -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" }
}

@ -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 {

@ -42,20 +42,20 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
send "show language\n"
send_gdb "show language\n"
expect {
-re ".* source language is \"chill\".*$prompt $" {
pass "set language to \"chill\""
send "break xx_\n"
send_gdb "break xx_\n"
expect {
-re ".*$prompt $" {
send "run\n"
send_gdb "run\n"
expect -re ".*$prompt $" {}
return 1
}
@ -85,7 +85,7 @@ proc set_lang_chill {} {
#
# Args are:
#
# First one is string to send to gdb
# First one is string to send_gdb to gdb
# Second one is string to match gdb result to
# Third one is an optional message to be printed
@ -427,7 +427,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if [set_lang_chill] then {
# test builtins as described in chapter 6.20.3 Z.200

@ -46,10 +46,10 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ;
send_gdb "set language chill\n" ;
send "break callch.ch:48\n"; expect -re "$prompt $"
send "run\n"; expect -re "Breakpoint .*callch.ch:48.*$prompt $"
gdb_test "break callch.ch:48 ""
send_gdb "run\n"; expect -re "Breakpoint .*callch.ch:48.*$prompt $"
gdb_test {set fred(10, i)} {a is '10'; b is '12'.}
gdb_test_exact "call klaus()" {here's klaus calling.}
gdb_test_exact "call fred()" {too few arguments in function call}

@ -32,13 +32,13 @@ set bug_id 0
proc set_lang_chill {} {
global prompt
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
send "show language\n"
send_gdb "show language\n"
expect {
-re ".* source language is \"chill\".*$prompt $" {
pass "set language to \"chill\""
@ -248,19 +248,19 @@ proc test_float_literals_accepted {} {
proc test_convenience_variables {} {
global prompt
gdb_test "set \$foo := 101" " := 101\[\r\n\]*" \
gdb_test "set \$foo := 101" " := 101\[\r\]*" \
"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" " := 301\[\r\]*" \
"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" " := 11\[\r\]*" \
"Set convenience variable \$_"
gdb_test "print \$_" " = 11" \
@ -432,7 +432,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings" ""
if [set_lang_chill] then {
test_value_history

@ -46,16 +46,16 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
# This is needed (at least on SunOS4) to make sure the
# the symbol table is read.
send "break chillvars.ch:3\n" ; expect -re "$prompt $"
send "delete 1\n" ; expect -re "$prompt $"
gdb_test "break chillvars.ch:3 ""
gdb_test "delete 1 ""
send "set width 0\n" ; expect -re "$prompt $"
send "set print sevenbit-strings\n" ; expect -re "$prompt $"
send "set print address off\n" ; expect -re "$prompt $"
gdb_test "set width 0 ""
gdb_test "set print sevenbit-strings ""
gdb_test "set print address off ""
test_BOOL
test_CHAR

@ -44,7 +44,7 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
@ -63,12 +63,12 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if ![set_lang_chill] then {
runto hugo_
send "set var \$i := d\n"
send_gdb "set var \$i := d\n"
expect -re ".*$prompt $"
gdb_test "print \$i" { = d}
gdb_test "print size (\$i)" { = 1}
@ -80,6 +80,6 @@ if ![set_lang_chill] then {
gdb_test "print a/=\$i" { = TRUE}
# This is PR 8870:
send "break malloc\n"; expect -re ".*$prompt $"
gdb_test "break malloc ".*"
gdb_test {set var $j := m_set[b]} ".*invalid.*tuple.*"
}

@ -54,12 +54,12 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
send "set var \$i := m_x\[\]\n" ; expect -re "$prompt $"
gdb_test "set var \$i := m_x\[\] ""
gdb_test "print \$i" { = \[.i: 0, .ar: \[\(5:6\): \[.f1: 0, .f2: NULL, .f3: \[\(2:3\): 0\]\]\]\]}
send "set var \$j := m_y\[\]\n" ; expect -re "$prompt $"
gdb_test "set var \$j := m_y\[\] ""
gdb_test "print \$j" { = \[.i: 0, .ar: \[\(7:8\): \[\(9:10\): \[.f1: 0, .f2: NULL, .f3: \[\(2:3\): 0\]\]\]\]\]}
}

@ -45,7 +45,7 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
@ -64,7 +64,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if ![set_lang_chill] then {
runto arr_

@ -44,7 +44,7 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
@ -63,19 +63,19 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if ![set_lang_chill] then {
runto brrr
# check foo
gdb_test {print foo} { = \[\(0:99\): 222\]}
send "set var foo := m_array\[\(\*\):44\]\n" ; expect -re ".*$prompt $"
gdb_test "set var foo := m_array\[\(\*\):44\] ".*"
gdb_test {print foo} { = \[\(0:99\): 44\]}
# check bar
gdb_test {print bar} { = \[\(-10:20\): \[.i: 0, .b: FALSE\]\]}
send "set var bar := m_bar\[\(\*\): \[42, TRUE\]\]\n" ; expect -re ".*$prompt $"
gdb_test "set var bar := m_bar\[\(\*\): \[42, TRUE\]\] ".*"
gdb_test {print bar} { = \[\(-10:20\): \[.i: 42, .b: TRUE\]\]}
# some failues

@ -44,7 +44,7 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
@ -63,14 +63,14 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if ![set_lang_chill] then {
runto doit
send "next\n" ; expect -re "$prompt $"
gdb_test "next ""
# check too many array elements
gdb_test {set var v_x := [1,2,3,4,5]} {Too many array elements}
gdb_test {set var $i := m_x[(3): 22, 25]} {Too many array elements}
send "set var \$i := m_x\[\(2\): 22, 25\]\n" ; expect -re "$prompt $"
gdb_test "set var \$i := m_x\[\(2\): 22, 25\] ""
gdb_test {print $i} { = \[\(1\): 0, \(2\): 22, \(3\): 25\]}
}

@ -46,20 +46,20 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
send "show language\n"
send_gdb "show language\n"
expect {
-re ".* source language is \"chill\".*$prompt $" {
pass "set language to \"chill\""
send "break xx_\n"
send_gdb "break xx_\n"
expect {
-re ".*$prompt $" {
send "run\n"
send_gdb "run\n"
expect -re ".*$prompt $" {}
return 1
}
@ -89,7 +89,7 @@ proc set_lang_chill {} {
#
# Args are:
#
# First one is string to send to gdb
# First one is string to send_gdb to gdb
# Second one is string to match gdb result to
# Third one is an optional message to be printed
@ -122,30 +122,30 @@ proc test_chars {} {
test_print_accept "print c" {'a'<repeats 70 times>//"\^\(0,5\)Jason"//'b'<repeats 70 times>}
test_print_accept "print d" {'\^\(11\)'}
send "set var a := (100)'\^(0,255)'\n" ; expect -re "$prompt $"
gdb_test "set var a := (100)'\^(0,255)' ""
test_print_accept "print a" {"\^\(0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255\)"}
send "set var a := (10)'\^(1)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\" \n" ; expect -re "$prompt $"
send_gdb "set var a := (10)'\^(1)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\" \n" ; expect -re "$prompt $"
test_print_accept "print a" {"\^\(1,1,1,1,1,1,1,1,1,1\)BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC I am Hugo"}
send "set var b := \"Hugo \"\"\^(3,4)\"\"Otto\^(17)\" \n" ; expect -re "$prompt $"
send_gdb "set var b := \"Hugo \"\"\^(3,4)\"\"Otto\^(17)\" \n" ; expect -re "$prompt $"
test_print_accept "print b" {"Hugo ""\^\(3,4\)""Otto\^\(17\)"}
send "set var c := (70)'b' // \"\^(2,3)Hugo \" // (70)'c' \n" ; expect -re "$prompt $"
send_gdb "set var c := (70)'b' // \"\^(2,3)Hugo \" // (70)'c' \n" ; expect -re "$prompt $"
test_print_accept "print c" {'b'<repeats 70 times>//"\^\(2,3\)Hugo "//'c'<repeats 70 times>}
send "set var d := '\^(199)'\n" ; expect -re "$prompt $"
gdb_test "set var d := '\^(199)' ""
test_print_accept "print d" {'\^\(199\)'}
test_print_accept "print (10)'\^(0)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\"" {"\^\(0,0,0,0,0,0,0,0,0,0\)BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC I am Hugo"}
test_print_accept "print \"Jason\"\"\^(0,5)\"\"Hugo\^(10)\"" {"Jason""\^\(0,5\)""Hugo\^\(10\)"}
send "set var a := \"\" \n" ; expect -re "$prompt $"
send_gdb "set var a := \"\" \n" ; expect -re "$prompt $"
test_print_accept "print a" {""}
send "set var a := \"\"\"\" \n" ; expect -re "$prompt $"
send_gdb "set var a := \"\"\"\" \n" ; expect -re "$prompt $"
test_print_accept "print a" {""""}
send "set var a := \" \"\"\" \n" ; expect -re "$prompt $"
send_gdb "set var a := \" \"\"\" \n" ; expect -re "$prompt $"
test_print_accept "print a" {" """}
send "set var a := \"\^\^\" \n" ; expect -re "$prompt $"
send_gdb "set var a := \"\^\^\" \n" ; expect -re "$prompt $"
test_print_accept "print a" {"\^\^"}
send "set var a := \"'\" \n" ; expect -re "$prompt $"
send_gdb "set var a := \"'\" \n" ; expect -re "$prompt $"
test_print_accept "print a" {"'"}
}
@ -170,7 +170,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if [set_lang_chill] then {

@ -46,20 +46,20 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
send "show language\n"
send_gdb "show language\n"
expect {
-re ".* source language is \"chill\".*$prompt $" {
pass "set language to \"chill\""
send "break xx_\n"
send_gdb "break xx_\n"
expect {
-re ".*$prompt $" {
send "run\n"
send_gdb "run\n"
expect -re ".*$prompt $" {}
return 1
}
@ -89,7 +89,7 @@ proc set_lang_chill {} {
#
# Args are:
#
# First one is string to send to gdb
# First one is string to send_gdb to gdb
# Second one is string to match gdb result to
# Third one is an optional message to be printed
@ -120,105 +120,105 @@ proc test_power {} {
test_print_accept "print v2_power1" {\[\]}
test_print_accept "print SIZE(v1_power1)" "1"
send "set v1_power1 := \[b1\] \n" ; expect -re "$prompt $"
gdb_test "set v1_power1 := \[b1\] ""
# if GDB has rejected the improper values, we have to expect the same!
test_print_accept "print v1_power1" {\[e1:e5\]}
send "set v1_power1 := \[a1,a2\] \n" ; expect -re "$prompt $"
gdb_test "set v1_power1 := \[a1,a2\] ""
test_print_accept "print v1_power1" {\[e1:e5\]}
send "set v1_power1 := \[b1,b2,b3,e4\] \n" ; expect -re "$prompt $"
gdb_test "set v1_power1 := \[b1,b2,b3,e4\] ""
test_print_accept "print v1_power1" {\[e1:e5\]}
send "set v1_power1 := \[e4:e5\] \n" ; expect -re "$prompt $"
gdb_test "set v1_power1 := \[e4:e5\] ""
test_print_accept "print v1_power1" {\[e4:e5\]}
send "set v1_power1 := \[e1, e2:e3, e5\] \n" ; expect -re "$prompt $"
gdb_test "set v1_power1 := \[e1, e2:e3, e5\] ""
test_print_accept "print v1_power1" {\[e1:e3, e5\]}
send "set v1_power1 := \[e1, e2:e4, e4:e5\] \n" ; expect -re "$prompt $"
gdb_test "set v1_power1 := \[e1, e2:e4, e4:e5\] ""
test_print_accept "print v1_power1" {\[e1:e5\]}
send "set v1_power1 := \[e1, e1:e3, e1:e2, e2:e3\] \n" ; expect -re "$prompt $"
gdb_test "set v1_power1 := \[e1, e1:e3, e1:e2, e2:e3\] ""
test_print_accept "print v1_power1" {\[e1:e3\]}
send "set v_power2 := \[e2\] \n" ; expect -re "$prompt $"
gdb_test "set v_power2 := \[e2\] ""
test_print_accept "print v_power2" {\[\]}
send "set v_power2 := \[1,2,3\] \n" ; expect -re "$prompt $"
gdb_test "set v_power2 := \[1,2,3\] ""
test_print_accept "print v_power2" {\[\]}
send "set v_power2 := \[e2, b2, b1\] \n" ; expect -re "$prompt $"
gdb_test "set v_power2 := \[e2, b2, b1\] ""
test_print_accept "print v_power2" {\[\]}
# Note, that this is a numbered SET, so a1:a3 contains all elements (exept a6)
send "set v_power2 := \[a1:a3, a6:a4, a7:a9\] \n" ; expect -re "$prompt $"
gdb_test "set v_power2 := \[a1:a3, a6:a4, a7:a9\] ""
test_print_accept "print v_power2" {\[a6:a3\]}
send "set v_power2 := \[a1, a4:a6, a9\] \n" ; expect -re "$prompt $"
gdb_test "set v_power2 := \[a1, a4:a6, a9\] ""
test_print_accept "print v_power2" {\[a1, a9\]}
send "set v_power2 := \[a1:a2, a6, a9\] \n" ; expect -re "$prompt $"
gdb_test "set v_power2 := \[a1:a2, a6, a9\] ""
test_print_accept "print v_power2" {\[a6:a2, a9\]}
send "set v_power2 := \[a1, a4, a7:a8, a9:a3\] \n" ; expect -re "$prompt $"
gdb_test "set v_power2 := \[a1, a4, a7:a8, a9:a3\] ""
test_print_accept "print v_power2" {\[a1, a4, a9:a8\]}
send "set v_power2 := \[a1, a4:a8\] \n" ; expect -re "$prompt $"
gdb_test "set v_power2 := \[a1, a4:a8\] ""
test_print_accept "print v_power2" {\[a1, a4:a8\]}
send "set v_power2 := \[a8,a3,a7,a9,a5,a6\] \n" ; expect -re "$prompt $"
gdb_test "set v_power2 := \[a8,a3,a7,a9,a5,a6\] ""
test_print_accept "print v_power2" {\[a6, a5, a9, a7, a3, a8\]}
send "set v_power3 := \[b1:b2,e1\] \n" ; expect -re "$prompt $"
gdb_test "set v_power3 := \[b1:b2,e1\] ""
test_print_accept "print v_power3" {\[b1:b2\]}
send "set v_power3 := \[b1, b3, b6:b7\] \n" ; expect -re "$prompt $"
gdb_test "set v_power3 := \[b1, b3, b6:b7\] ""
test_print_accept "print v_power3" {\[b1, b3, b6:b7\]}
send "set v_power3 := \[b1, b3:b4, b7\] \n" ; expect -re "$prompt $"
gdb_test "set v_power3 := \[b1, b3:b4, b7\] ""
test_print_accept "print v_power3" {\[b1, b3:b4, b7\]}
send "set v_power3 := \[b1, b4:b6, b7\] \n" ; expect -re "$prompt $"
gdb_test "set v_power3 := \[b1, b4:b6, b7\] ""
test_print_accept "print v_power3" {\[b1, b4:b7\]}
send "set v_power3 := \[b1:b7\] \n" ; expect -re "$prompt $"
gdb_test "set v_power3 := \[b1:b7\] ""
test_print_accept "print v_power3" {\[b1:b7\]}
send "set v_power3 := \[b5:b7, b1\] \n" ; expect -re "$prompt $"
gdb_test "set v_power3 := \[b5:b7, b1\] ""
test_print_accept "print v_power3" {\[b1, b5:b7\]}
send "set v_power4 := \[\"b\"\] \n" ; expect -re "$prompt $"
send_gdb "set v_power4 := \[\"b\"\] \n" ; expect -re "$prompt $"
test_print_accept "print v_power4" {\['b':'x'\]}
send "set v_power4 := \[5\] \n" ; expect -re "$prompt $"
gdb_test "set v_power4 := \[5\] ""
test_print_accept "print v_power4" {\['b':'x'\]}
send "set v_power4 := \['c':'f','g':'h','o':'t'\]\n"; expect -re "$prompt $"
gdb_test "set v_power4 := \['c':'f','g':'h','o':'t'\] ""
test_print_accept "print v_power4" {\['c':'h', 'o':'t'\]}
send "set v_power4 := \['a','b','c','d','e','f'\]\n"; expect -re "$prompt $"
gdb_test "set v_power4 := \['a','b','c','d','e','f'\] ""
test_print_accept "print v_power4" {\['a':'f'\]}
send "set v_power4 := \['\^(0)':'\^(200)'\]\n"; expect -re "$prompt $"
gdb_test "set v_power4 := \['\^(0)':'\^(200)'\] ""
test_print_accept "print v_power4" {\['\^\(0\)':'\^\(200\)'\]}
send "set v_power5 := \[a8\] \n" ; expect -re "$prompt $"
gdb_test "set v_power5 := \[a8\] ""
test_print_accept "print v_power5" {\[2:100\]}
send "set v_power5 := \[4\] \n" ; expect -re "$prompt $"
gdb_test "set v_power5 := \[4\] ""
test_print_accept "print v_power5" {\[4\]}
send "set v_power5 := \[3:95,9:100,10:107,200:250\]\n" ; expect -re "$prompt $"
gdb_test "set v_power5 := \[3:95,9:100,10:107,200:250\] ""
test_print_accept "print v_power5" {\[3:107, 200:250\]}
send "set v_power5 := \[2, 100:120, 350:400\] \n" ; expect -re "$prompt $"
gdb_test "set v_power5 := \[2, 100:120, 350:400\] ""
test_print_accept "print v_power5" {\[2, 100:120, 350:400\]}
send "set v_power5 := \[2:64,65:127,128:256,256:399,400\]\n" ; expect -re "$prompt $"
gdb_test "set v_power5 := \[2:64,65:127,128:256,256:399,400\] ""
test_print_accept "print v_power5" {\[2:400\]}
send "set v_power5 := \[3:95, 99:100, 101:107, 200:250\] \n" ; expect -re "$prompt $"
gdb_test "set v_power5 := \[3:95, 99:100, 101:107, 200:250\] ""
test_print_accept "print v_power5" {\[3:95, 99:107, 200:250\]}
send "set v_power6 := \[a8\] \n" ; expect -re "$prompt $"
gdb_test "set v_power6 := \[a8\] ""
test_print_accept "print v_power6" {\[\]}
send "set v_power6 := \[4\] \n" ; expect -re "$prompt $"
gdb_test "set v_power6 := \[4\] ""
test_print_accept "print v_power6" {\[4\]}
send "set v_power6 := \[3:95, 99:100, 101:107, 200:250\] \n" ; expect -re "$prompt $"
gdb_test "set v_power6 := \[3:95, 99:100, 101:107, 200:250\] ""
test_print_accept "print v_power6" {\[3:95, 99:107, 200:250\]}
send "set v_power6 := \[-111:0, 1:112, 11111:22222\] \n" ; expect -re "$prompt $"
gdb_test "set v_power6 := \[-111:0, 1:112, 11111:22222\] ""
test_print_accept "print v_power6" {\[-111:112, 11111:22222\]}
send "set v_power6 := \[0, 200:4000, 6666:9999\] \n" ; expect -re "$prompt $"
gdb_test "set v_power6 := \[0, 200:4000, 6666:9999\] ""
test_print_accept "print v_power6" {\[0, 200:4000, 6666:9999\]}
# send "set v_power7 := \[a8\] \n" ; expect -re "$prompt $"
# gdb_test "set v_power7 := \[a8\] ""
# test_print_accept "print v_power7" {\[2:100\]}
# send "set v_power7 := \[4\] \n" ; expect -re "$prompt $"
# gdb_test "set v_power7 := \[4\] ""
# test_print_accept "print v_power7" {\[4\]}
# send "set v_power7 := \[3:95, 99:100, 101:107, 200:250\]\n" ; expect -re "$prompt $"
# gdb_test "set v_power7 := \[3:95, 99:100, 101:107, 200:250\] ""
# test_print_accept "print v_power7" {\[3:95, 99:107, 200:250\]}
# send "set v_power7 := \[0, 1000, 1000000, 10000000000\] \n" ; expect -re "$prompt $"
# gdb_test "set v_power7 := \[0, 1000, 1000000, 10000000000\] ""
# test_print_accept "print v_power7" {\[0, 1000, 1000000, 1000000000\]}
# send "set v_power7 := \[-20000:100000, 111111:2222222\] \n" ; expect -re "$prompt $"
# gdb_test "set v_power7 := \[-20000:100000, 111111:2222222\] ""
# test_print_accept "print v_power7" {\[-20000:100000, 111111:2222222\]}
# send "set v_power7 := \[\] \n" ; expect -re "$prompt $"
# gdb_test "set v_power7 := \[\] ""
# test_print_accept "print v_power7" {\[3:95, 99:107, 200:250\]}
# send "set v_power7 := \[2:-500, -501:1, 20:370, -888:-920, 1000:2000, 1800:2500\]\ \n" ; expect -re "$prompt $"
# gdb_test "set v_power7 := \[2:-500, -501:1, 20:370, -888:-920, 1000:2000, 1800:2500\]\ ""
# test_print_accept "print v_power7" {\[-920:-888, -501:2, 20:370, 1000:2500\]}
# test_print_accept "print SIZE(v_power7)" ""
@ -237,7 +237,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if [set_lang_chill] then {

@ -45,7 +45,7 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
@ -64,7 +64,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if ![set_lang_chill] then {
runto dummyfunc
@ -78,7 +78,7 @@ if ![set_lang_chill] then {
gdb_test "print NULL" " = NULL" "print emptiness literal"
# This tests PR 8496.
gdb_test {printf "%d %d.\n", 3+4,2} "7 2." "printf with 2 arguments"
gdb_test {printf "%d %d.", 3+4,2} "7 2." "printf with 2 arguments"
# This tests GCH/924
gdb_test {print (h'23)} { = 35} "print parantised integer literal"
@ -93,7 +93,7 @@ if ![set_lang_chill] then {
setup_xfail "m68*-*-hpux*"
gdb_test "print array () ubyte (foo)" { = \[\(0:11\): 0\]}
send "set var \$i := foo\n"
send_gdb "set var \$i := foo\n"
expect -re ".*$prompt $"
setup_xfail "m68*-*-hpux*"
gdb_test "print/x array () byte (\$i)" { = \[\(0:11\): H'0\]}

@ -42,20 +42,20 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
send "show language\n"
send_gdb "show language\n"
expect {
-re ".* source language is \"chill\".*$prompt $" {
pass "set language to \"chill\""
send "break xx_\n"
send_gdb "break xx_\n"
expect {
-re ".*$prompt $" {
send "run\n"
send_gdb "run\n"
expect -re ".*$prompt $" {}
return 1
}
@ -85,7 +85,7 @@ proc set_lang_chill {} {
#
# Args are:
#
# First one is string to send to gdb
# First one is string to send_gdb to gdb
# Second one is string to match gdb result to
# Third one is an optional message to be printed
@ -175,7 +175,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if [set_lang_chill] then {
# test builtins as described in chapter 6.20.3 Z.200

@ -54,7 +54,7 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
# This is needed (at least on SunOS4) to make sure the
# the symbol table is read.

@ -46,7 +46,7 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
runto dump
# Linux thinks type is "_cint" (and so does sparc-sun-sunos4, alpha-dec-osf2.0)
@ -55,7 +55,7 @@ proc do_tests {} {
gdb_test_exact "ptype m_index" "type = RANGE (1:10)" "ptype m_index"
gdb_test_exact "whatis a" "type = /*LOC*/ vector"
gdb_test "ptype a" "type = /\\*LOC\\*/ ARRAY \\(1:10\\) (INT|int)"
send "step\n"; expect -re "$prompt $"
gdb_test "step ""
gdb_test_exact "whatis i" "type = long" "whatis loop counter i"
}

@ -46,16 +46,16 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
# This is needed (at least on SunOS4) to make sure the
# the symbol table is read.
send "break chillvars.ch:3\n" ; expect -re "$prompt $"
send "delete 1\n" ; expect -re "$prompt $"
gdb_test "break chillvars.ch:3 ""
gdb_test "delete 1 ""
send "set width 0\n" ; expect -re "$prompt $"
send "set print sevenbit-strings\n" ; expect -re "$prompt $"
send "set print address off\n" ; expect -re "$prompt $"
gdb_test "set width 0 ""
gdb_test "set print sevenbit-strings ""
gdb_test "set print address off ""
test_pr_5020
}
@ -71,7 +71,7 @@ proc test_pr_5020 {} {
{= [(10): [.l: 10, .b: TRUE], (11): [.l: 111, .b: FALSE]]}
gdb_test_exact "print setarr" \
{= [(aa): [.l: 10, .b: TRUE], (bb): [.l: 111, .b: FALSE]]}
send "set print pretty\n" ; expect -re "$prompt $"
gdb_test "set print pretty ""
gdb_test_exact "print y" \
{= [('a'): [
.l: 10,

@ -46,15 +46,15 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
# This is needed (at least on SunOS4) to make sure the
# the symbol table is read.
send "break gdbme.ch:3\n" ; expect -re "$prompt $"
send "delete 1\n" ; expect -re "$prompt $"
gdb_test "break gdbme.ch:3 ""
gdb_test "delete 1 ""
send "set width 0\n" ; expect -re "$prompt $"
send "set print sevenbit-strings\n" ; expect -re "$prompt $"
gdb_test "set width 0 ""
gdb_test "set print sevenbit-strings ""
test_pr_5022
}
@ -63,7 +63,7 @@ proc test_pr_5022 {} {
global prompt
runto dummy_pr_5022
gdb_test "p p" " = NULL" "print NULL pointer"
send "continue\n" ; expect -re "$prompt $"
gdb_test "continue ""
gdb_test "p p" {= PTR\(H'[0-9a-fA-F]+\)} "print non-NULL pointer"
}

@ -54,10 +54,10 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
runto p
send "next\n" ; expect -re "$prompt $"
gdb_test "next ""
gdb_test_exact "print xx" {= [a:b]}
}

@ -46,10 +46,10 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ;
send_gdb "set language chill\n" ;
send "break pr-5984.ch:6\n"; expect -re "$prompt $"
send "run\n"; expect -re "Breakpoint .*pr-5984.ch:6"
gdb_test "break pr-5984.ch:6 ""
send_gdb "run\n"; expect -re "Breakpoint .*pr-5984.ch:6"
expect -re "$prompt $"
gdb_test "next" "Jason Dark.*" "next over Jason Dark"
}

@ -46,10 +46,10 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ;
send_gdb "set language chill\n" ;
send "break pr-6292.ch:15\n"; expect -re "$prompt $"
send "run\n"; expect -re "Breakpoint .*pr-6292.ch:15.*$prompt $"
gdb_test "break pr-6292.ch:15 ""
send_gdb "run\n"; expect -re "Breakpoint .*pr-6292.ch:15.*$prompt $"
gdb_test_exact "call klaus()" {here's klaus calling.}
gdb_test {set fred(10, i)} {a was '10'; b was '12'.}
gdb_test "print i" { = 13} "print i after call"

@ -55,7 +55,7 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
runto p
gdb_test "whatis x" {type = m_dummy_range}

@ -55,7 +55,7 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
runto p1
gdb_test "print first" "= 1"

@ -54,7 +54,7 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
runto p1
gdb_test "print ps" {= \[e3, e7:e9\]}

@ -35,8 +35,8 @@ proc do_tests {} {
gdb_start
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
send "set var \$i:=xx\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
gdb_test "set var \$i:=xx ""
gdb_test "print \$i" {= \[.c: "", .b: B'00000000', .boo: FALSE\]}
}

@ -46,7 +46,7 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
runto dummy

@ -52,7 +52,7 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
gdb_test "print size(m_byte)" { = 2}
gdb_test "print size(m_struct)" { = 6}

@ -35,7 +35,7 @@ proc do_tests {} {
gdb_start
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
runto pr-9095.ch:12
gdb_test {p v_arr2(5)->.p(5)} "reference value used as function" \
"bad call using pointer"

@ -45,7 +45,7 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
@ -64,11 +64,11 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if ![set_lang_chill] then {
runto x_
send "next\n" ; expect -re "$prompt $"
gdb_test "next ""
# check comparison of SET's
gdb_test {print xyz=moving} { = TRUE}
gdb_test {print xyz/=moving} { = FALSE}

@ -46,31 +46,31 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
send "set width 0\n" ; expect -re "$prompt $"
send "set print sevenbit-strings\n" ; expect -re "$prompt $"
send "set print address off\n" ; expect -re "$prompt $"
gdb_test "set width 0 ""
gdb_test "set print sevenbit-strings ""
gdb_test "set print address off ""
# simple function
runto simple_func
send "step 2\n" ; expect -re "$prompt $"
gdb_test "step 2 ""
gdb_test "print j" "= 5"
gdb_test "p RESULT" "= 10"
send "continue\n" ; expect -re "$prompt $"
gdb_test "continue ""
gdb_test "print i" "= 7"
send "step 4\n" ; expect -re "$prompt $"
send "set RESULT := 50\n" ; expect -re "$prompt $"
send "finish\n" ; expect -re "$prompt $"
send "step\n" ; expect -re "$prompt $"
gdb_test "step 4 ""
gdb_test "set RESULT := 50 ""
gdb_test "finish ""
gdb_test "step ""
gdb_test "print i" "= 50"
# returning a structure
runto ret_struct
send "step 2\n"; expect -re "$prompt $"
gdb_test "step 2 ""
gdb_test "p result" {\[.l: 33, .b: FALSE\]}
send "set var result := \[383, TRUE\]\n"; expect -re "$prompt $"
send "finish\n"; expect -re "$prompt $"
gdb_test "set var result := \[383, TRUE\] ""
gdb_test "finish ""
gdb_test "p v_struct" {\[.l: 383, .b: TRUE\]}
}

@ -44,7 +44,7 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
# These tests based on Cygnus PR chill/5696.
runto string.ch:22

@ -42,20 +42,20 @@ proc set_lang_chill {} {
verbose "loading file '$binfile'"
gdb_load $binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
send "show language\n"
send_gdb "show language\n"
expect {
-re ".* source language is \"chill\".*$prompt $" {
pass "set language to \"chill\""
send "break dummyfunc\n"
send_gdb "break dummyfunc\n"
expect {
-re ".*$prompt $" {
send "run\n"
send_gdb "run\n"
expect -re ".*$prompt $" {}
return 1
}
@ -85,7 +85,7 @@ proc set_lang_chill {} {
#
# Args are:
#
# First one is string to send to gdb
# First one is string to send_gdb to gdb
# Second one is string to match gdb result to
# Third one is an optional message to be printed
@ -811,7 +811,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if [set_lang_chill] then {
test_modes

@ -54,20 +54,20 @@ proc set_lang_chill {} {
verbose "loading file '$objdir/$subdir/$binfile'"
gdb_load $objdir/$subdir/$binfile
send "set language chill\n"
send_gdb "set language chill\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
send "show language\n"
send_gdb "show language\n"
expect {
-re ".* source language is \"chill\".*$prompt $" {
pass "set language to \"chill\""
send "break dummyfunc\n"
send_gdb "break dummyfunc\n"
expect {
-re ".*$prompt $" {
send "run\n"
send_gdb "run\n"
expect -re ".*$prompt $" {}
return 1
}
@ -116,7 +116,7 @@ proc test_write { args } {
verbose "loc: $location, val: $value, msg: $message, ext: $extended, match: $matchval"
verbose "setting var $value..."
send "set var $location.m$extended := $value\n"
send_gdb "set var $location.m$extended := $value\n"
expect -re ".*$prompt $" {}
gdb_test "print $location" \
".*= \[\[\]\\.p1: 2863311530, \\.m: $matchval, \\.p2: 1431655765\[\]\]"\
@ -262,7 +262,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings ".*"
if [set_lang_chill] then {
write_access

@ -46,7 +46,7 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
send "set language chill\n" ; expect -re "$prompt $"
gdb_test "set language chill ""
runto tuples.ch:40
@ -109,8 +109,8 @@ proc do_tests {} {
gdb_test_exact "print vstr.ch1" {= 'x'} "vstr.ch1 after assignment"
# These tests are from Cygnus PR chill/5024:
send "break printdow\n" ; expect -re "$prompt $"
send "continue\n" ; expect -re "$prompt $"
gdb_test "break printdow ""
gdb_test "continue ""
gdb_test_exact "set var w:= dow\[monday\]" {}
gdb_test "print w" " = \\\[monday\\\]" \
"print bitstring after assignment"

@ -1,3 +1,4 @@
# Copyright (C) 1992 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@ -12,7 +13,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
@ -23,20 +24,36 @@ if $tracelevel then {
strace $tracelevel
}
if ![istarget "hppa*-*-*"] {
verbose "Tests ignored for all but hppa based targets."
return
}
global exec_output
set prms_id 0
set bug_id 0
set binfile "hppa"
set srcfile $binfile.s
set testfile "hppa"
set srcfile ${srcdir}/${subdir}/${testfile}.s
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } {
if [ regexp "Opcode not defined - DIAG" $exec_output] {
warning "HP assembler in use--skipping disasm tests"
return
} else {
perror "Couldn't compile ${srcfile}"
return -1
}
}
proc all_integer_memory_tests { } {
global prompt
global hex
global decimal
send "x/8i integer_memory_tests\n"
send_gdb "x/8i integer_memory_tests\n"
expect {
-re ".*
-re "
.*ldw 0\\(sr0,r4\\),r26.*
.*ldh 0\\(sr0,r4\\),r26.*
.*ldb 0\\(sr0,r4\\),r26.*
@ -50,9 +67,9 @@ proc all_integer_memory_tests { } {
timeout { fail "(timeout) integer memory_tests" }
}
send "x/20i integer_indexing_load\n"
send_gdb "x/20i integer_indexing_load\n"
expect {
-re ".*
-re "
.*ldwx r5\\(sr0,r4\\),r26.*
.*ldwx,s r5\\(sr0,r4\\),r26.*
.*ldwx,m r5\\(sr0,r4\\),r26.*
@ -78,9 +95,9 @@ proc all_integer_memory_tests { } {
timeout { fail "(timeout) integer_indexing" }
}
send "x/15i integer_load_short_memory\n"
send_gdb "x/15i integer_load_short_memory\n"
expect {
-re ".*
-re "
.*ldws 0\\(sr0,r4\\),r26.*
.*ldws,mb 0\\(sr0,r4\\),r26.*
.*ldws,ma 0\\(sr0,r4\\),r26.*
@ -102,9 +119,9 @@ proc all_integer_memory_tests { } {
}
send "x/17i integer_store_short_memory\n"
send_gdb "x/17i integer_store_short_memory\n"
expect {
-re ".*
-re "
.*stws r26,0\\(sr0,r4\\).*
.*stws,mb r26,0\\(sr0,r4\\).*
.*stws,ma r26,0\\(sr0,r4\\).*
@ -133,9 +150,9 @@ proc all_immediate_tests { } {
global hex
global decimal
send "x/3i immediate_tests\n"
send_gdb "x/3i immediate_tests\n"
expect {
-re ".*
-re "
.*ldo 5\\(r26\\),r26.*
.*ldil -21524800,r26.*
.*addil -21524800,r5.*
@ -150,9 +167,9 @@ proc all_branch_tests { } {
global hex
global decimal
send "x/10i branch_tests_1\n"
send_gdb "x/10i branch_tests_1\n"
expect {
-re ".*
-re "
.*bl.*,rp.*
.*bl,n.*,rp.*
.*b.*
@ -168,9 +185,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) branch_tests_1" }
}
send "x/6i branch_tests_2\n"
send_gdb "x/6i branch_tests_2\n"
expect {
-re ".*
-re "
.*bv r0\\(rp\\).*
.*bv,n r0\\(rp\\).*
.*be 1234\\(sr1,rp\\).*
@ -183,9 +200,9 @@ proc all_branch_tests { } {
}
send "x/8i movb_tests\n"
send_gdb "x/8i movb_tests\n"
expect {
-re ".*
-re "
.*movb r4,r26,.* <movb_tests>.*
.*movb,= r4,r26,.* <movb_tests>.*
.*movb,< r4,r26,.* <movb_tests>.*
@ -199,9 +216,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) movb_tests " }
}
send "x/8i movb_nullified_tests\n"
send_gdb "x/8i movb_nullified_tests\n"
expect {
-re ".*
-re "
.*movb,n.*r4,r26,.* <movb_tests>.*
.*movb,=,n.*r4,r26,.* <movb_tests>.*
.*movb,<,n.*r4,r26,.* <movb_tests>.*
@ -215,9 +232,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) movb_nullified_tests " }
}
send "x/8i movib_tests\n"
send_gdb "x/8i movib_tests\n"
expect {
-re ".*
-re "
.*movib 5,r26,.* <movib_tests>.*
.*movib,= 5,r26,.* <movib_tests>.*
.*movib,< 5,r26,.* <movib_tests>.*
@ -231,9 +248,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) movib_tests " }
}
send "x/8i movib_nullified_tests\n"
send_gdb "x/8i movib_nullified_tests\n"
expect {
-re ".*
-re "
.*movib,n.*5,r26,.* <movib_tests>.*
.*movib,=,n.*5,r26,.* <movib_tests>.*
.*movib,<,n.*5,r26,.* <movib_tests>.*
@ -247,9 +264,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) movib_nullified_tests " }
}
send "x/8i comb_tests_1\n"
send_gdb "x/8i comb_tests_1\n"
expect {
-re ".*
-re "
.*comb r0,r4,.* <comb_tests_1>.*
.*comb,= r0,r4,.* <comb_tests_1>.*
.*comb,< r0,r4,.* <comb_tests_1>.*
@ -263,9 +280,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) comb_tests_1" }
}
send "x/8i comb_tests_2\n"
send_gdb "x/8i comb_tests_2\n"
expect {
-re ".*
-re "
.*combf r0,r4,.* <comb_tests_2>.*
.*combf,= r0,r4,.* <comb_tests_2>.*
.*combf,< r0,r4,.* <comb_tests_2>.*
@ -279,9 +296,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) comb_tests_2" }
}
send "x/8i comb_nullified_tests_1\n"
send_gdb "x/8i comb_nullified_tests_1\n"
expect {
-re ".*
-re "
.*comb,n r0,r4,.* <comb_tests_1>.*
.*comb,=,n r0,r4,.* <comb_tests_1>.*
.*comb,<,n r0,r4,.* <comb_tests_1>.*
@ -295,9 +312,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) comb_nullified_tests_1" }
}
send "x/8i comb_nullified_tests_2\n"
send_gdb "x/8i comb_nullified_tests_2\n"
expect {
-re ".*
-re "
.*combf,n r0,r4,.* <comb_tests_2>.*
.*combf,=,n r0,r4,.* <comb_tests_2>.*
.*combf,<,n r0,r4,.* <comb_tests_2>.*
@ -311,9 +328,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) comb_nullified_tests_2" }
}
send "x/8i comib_tests_1\n"
send_gdb "x/8i comib_tests_1\n"
expect {
-re ".*
-re "
.*comib 0,r4,.* <comib_tests_1>.*
.*comib,= 0,r4,.* <comib_tests_1>.*
.*comib,< 0,r4,.* <comib_tests_1>.*
@ -327,9 +344,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) comib_tests_1" }
}
send "x/8i comib_tests_2\n"
send_gdb "x/8i comib_tests_2\n"
expect {
-re ".*
-re "
.*comibf 0,r4,.* <comib_tests_2>.*
.*comibf,= 0,r4,.* <comib_tests_2>.*
.*comibf,< 0,r4,.* <comib_tests_2>.*
@ -343,9 +360,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) comib_tests_2" }
}
send "x/8i comib_nullified_tests_1\n"
send_gdb "x/8i comib_nullified_tests_1\n"
expect {
-re ".*
-re "
.*comib,n 0,r4,.* <comib_tests_1>.*
.*comib,=,n 0,r4,.* <comib_tests_1>.*
.*comib,<,n 0,r4,.* <comib_tests_1>.*
@ -359,9 +376,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) comib_nullified_tests_1" }
}
send "x/8i comib_nullified_tests_2\n"
send_gdb "x/8i comib_nullified_tests_2\n"
expect {
-re ".*
-re "
.*comibf,n 0,r4,.* <comib_tests_2>.*
.*comibf,=,n 0,r4,.* <comib_tests_2>.*
.*comibf,<,n 0,r4,.* <comib_tests_2>.*
@ -375,9 +392,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) comib_nullified_tests_2" }
}
send "x/8i addb_tests_1\n"
send_gdb "x/8i addb_tests_1\n"
expect {
-re ".*
-re "
.*addb r1,r4,.* <addb_tests_1>.*
.*addb,= r1,r4,.* <addb_tests_1>.*
.*addb,< r1,r4,.* <addb_tests_1>.*
@ -391,9 +408,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) addb_tests_1" }
}
send "x/8i addb_tests_2\n"
send_gdb "x/8i addb_tests_2\n"
expect {
-re ".*
-re "
.*addbf r1,r4,.* <addb_tests_2>.*
.*addbf,= r1,r4,.* <addb_tests_2>.*
.*addbf,< r1,r4,.* <addb_tests_2>.*
@ -407,9 +424,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) addb_tests_2" }
}
send "x/8i addb_nullified_tests_1\n"
send_gdb "x/8i addb_nullified_tests_1\n"
expect {
-re ".*
-re "
.*addb,n r1,r4,.* <addb_tests_1>.*
.*addb,=,n r1,r4,.* <addb_tests_1>.*
.*addb,<,n r1,r4,.* <addb_tests_1>.*
@ -423,9 +440,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) addb_nullified_tests_1" }
}
send "x/8i addb_nullified_tests_2\n"
send_gdb "x/8i addb_nullified_tests_2\n"
expect {
-re ".*
-re "
.*addbf,n r1,r4,.* <addb_tests_2>.*
.*addbf,=,n r1,r4,.* <addb_tests_2>.*
.*addbf,<,n r1,r4,.* <addb_tests_2>.*
@ -439,9 +456,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) addb_nullified_tests_2" }
}
send "x/8i addib_tests_1\n"
send_gdb "x/8i addib_tests_1\n"
expect {
-re ".*
-re "
.*addib -1,r4,.* <addib_tests_1>.*
.*addib,= -1,r4,.* <addib_tests_1>.*
.*addib,< -1,r4,.* <addib_tests_1>.*
@ -455,9 +472,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) addib_tests_1" }
}
send "x/8i addib_tests_2\n"
send_gdb "x/8i addib_tests_2\n"
expect {
-re ".*
-re "
.*addibf -1,r4,.* <addib_tests_2>.*
.*addibf,= -1,r4,.* <addib_tests_2>.*
.*addibf,< -1,r4,.* <addib_tests_2>.*
@ -471,9 +488,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) addib_tests_2" }
}
send "x/8i addib_nullified_tests_1\n"
send_gdb "x/8i addib_nullified_tests_1\n"
expect {
-re ".*
-re "
.*addib,n -1,r4,.* <addib_tests_1>.*
.*addib,=,n -1,r4,.* <addib_tests_1>.*
.*addib,<,n -1,r4,.* <addib_tests_1>.*
@ -487,9 +504,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) addb_nullified_tests_1" }
}
send "x/8i addib_nullified_tests_2\n"
send_gdb "x/8i addib_nullified_tests_2\n"
expect {
-re ".*
-re "
.*addibf,n -1,r4,.* <addib_tests_2>.*
.*addibf,=,n -1,r4,.* <addib_tests_2>.*
.*addibf,<,n -1,r4,.* <addib_tests_2>.*
@ -503,9 +520,9 @@ proc all_branch_tests { } {
timeout { fail "(timeout) addb_nullified_tests_2" }
}
send "x/8i bb_tests\n"
send_gdb "x/8i bb_tests\n"
expect {
-re ".*
-re "
.*bvb,< r4,.* <bb_tests>.*
.*bvb,>= r4,.* <bb_tests>.*
.*bvb,<,n r4,.* <bb_tests>.*
@ -531,9 +548,9 @@ proc all_integer_computational_tests { } {
{sh3add} {sh3addl} {sh3addo} ]
foreach i $add_insns {
send "x/16i $i"; send "_tests\n"
send_gdb "x/16i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i r4,r5,r6.*
.*$i,= r4,r5,r6.*
.*$i,< r4,r5,r6.*
@ -560,9 +577,9 @@ proc all_integer_computational_tests { } {
{ds} {comclr} ]
foreach i $sub_insns {
send "x/16i $i"; send "_tests\n"
send_gdb "x/16i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i r4,r5,r6.*
.*$i,= r4,r5,r6.*
.*$i,< r4,r5,r6.*
@ -588,9 +605,9 @@ proc all_integer_computational_tests { } {
set logical_insns [list {or} {xor} {and} {andcm} ]
foreach i $logical_insns {
send "x/10i $i"; send "_tests\n"
send_gdb "x/10i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i r4,r5,r6.*
.*$i,= r4,r5,r6.*
.*$i,< r4,r5,r6.*
@ -610,9 +627,9 @@ proc all_integer_computational_tests { } {
set unit_insns1 [list {uxor} {uaddcm} {uaddcmt} ]
foreach i $unit_insns1 {
send "x/12i $i"; send "_tests\n"
send_gdb "x/12i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i r4,r5,r6.*
.*$i,sbz r4,r5,r6.*
.*$i,shz r4,r5,r6.*
@ -634,9 +651,9 @@ proc all_integer_computational_tests { } {
set unit_insns2 [list {dcor} {idcor} ]
foreach i $unit_insns2 {
send "x/12i $i"; send "_tests\n"
send_gdb "x/12i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i r4,r5.*
.*$i,sbz r4,r5.*
.*$i,shz r4,r5.*
@ -658,9 +675,9 @@ proc all_integer_computational_tests { } {
set addi_insns [list {addi} {addio} {addit} {addito} ]
foreach i $addi_insns {
send "x/16i $i"; send "_tests\n"
send_gdb "x/16i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i 7b,r5,r6.*
.*$i,= 7b,r5,r6.*
.*$i,< 7b,r5,r6.*
@ -686,9 +703,9 @@ proc all_integer_computational_tests { } {
set subi_insns [list {subi} {subio} {comiclr} ]
foreach i $subi_insns {
send "x/16i $i"; send "_tests\n"
send_gdb "x/16i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i 7b,r5,r6.*
.*$i,= 7b,r5,r6.*
.*$i,< 7b,r5,r6.*
@ -711,9 +728,9 @@ proc all_integer_computational_tests { } {
}
}
send "x/8i vshd_tests\n"
send_gdb "x/8i vshd_tests\n"
expect {
-re ".*
-re "
.*vshd r4,r5,r6.*
.*vshd,= r4,r5,r6.*
.*vshd,< r4,r5,r6.*
@ -727,9 +744,9 @@ proc all_integer_computational_tests { } {
timeout { fail "(timeout) "vshd tests" }
}
send "x/8i shd_tests\n"
send_gdb "x/8i shd_tests\n"
expect {
-re ".*
-re "
.*shd r4,r5,5,r6.*
.*shd,= r4,r5,5,r6.*
.*shd,< r4,r5,5,r6.*
@ -746,9 +763,9 @@ proc all_integer_computational_tests { } {
set extract_insns1 [list {extru} {extrs} {zdep} {dep} ]
foreach i $extract_insns1 {
send "x/8i $i"; send "_tests\n"
send_gdb "x/8i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i r4,5,10,r6.*
.*$i,= r4,5,10,r6.*
.*$i,< r4,5,10,r6.*
@ -766,9 +783,9 @@ proc all_integer_computational_tests { } {
set extract_insns2 [list {vextru} {vextrs} {zvdep} {vdep} ]
foreach i $extract_insns2 {
send "x/8i $i"; send "_tests\n"
send_gdb "x/8i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i r4,5,r6.*
.*$i,= r4,5,r6.*
.*$i,< r4,5,r6.*
@ -786,9 +803,9 @@ proc all_integer_computational_tests { } {
set extract_insns3 [list {vdepi} {zvdepi} ]
foreach i $extract_insns3 {
send "x/8i $i"; send "_tests\n"
send_gdb "x/8i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i -1,5,r6.*
.*$i,= -1,5,r6.*
.*$i,< -1,5,r6.*
@ -806,9 +823,9 @@ proc all_integer_computational_tests { } {
set extract_insns4 [list {depi} {zdepi} ]
foreach i $extract_insns4 {
send "x/8i $i"; send "_tests\n"
send_gdb "x/8i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i -1,4,10,r6.*
.*$i,= -1,4,10,r6.*
.*$i,< -1,4,10,r6.*
@ -829,9 +846,9 @@ proc all_system_control_tests { } {
global hex
global decimal
send "x/13i system_control_tests\n"
send_gdb "x/14i system_control_tests\n"
expect {
-re ".*
-re "
.*break 5,c.*
.*rfi.*
.*rfir.*
@ -844,15 +861,16 @@ proc all_system_control_tests { } {
.*mfsp sr0,r4.*
.*mfctl ccr,r4.*
.*sync.*
.*syncdma.*
.*diag 4d2.*
.*$prompt $" { pass "system_constrol_tests" }
-re "$prompt $" { fail "system_control_tests" }
timeout { file "(timeout) system_control_tests" }
}
send "x/4i probe_tests\n"
send_gdb "x/4i probe_tests\n"
expect {
-re ".*
-re "
.*prober \\(sr0,r5\\),r6,r7.*
.*proberi \\(sr0,r5\\),1,r7.*
.*probew \\(sr0,r5\\),r6,r7.*
@ -862,21 +880,23 @@ proc all_system_control_tests { } {
timeout { file "(timeout) probe_tests" }
}
send "x/4i lpa_tests\n"
# lci uses the same bit pattern as lha, so accept lha.
send_gdb "x/5i lpa_tests\n"
expect {
-re ".*
-re "
.*lpa r4\\(sr0,r5\\),r6.*
.*lpa,m r4\\(sr0,r5\\),r6.*
.*lha r4\\(sr0,r5\\),r6.*
.*lha,m r4\\(sr0,r5\\),r6.*
.*lha r4\\(sr0,r5\\),r6.*
.*$prompt $" { pass "lpa_tests" }
-re "$prompt $" { fail "lpa_tests" }
timeout { file "(timeout) lpa_tests" }
}
send "x/18i purge_tests\n"
send_gdb "x/18i purge_tests\n"
expect {
-re ".*
-re "
.*pdtlb r4\\(sr0,r5\\).*
.*pdtlb,m r4\\(sr0,r5\\).*
.*pitlb r4\\(sr0,r5\\).*
@ -900,9 +920,9 @@ proc all_system_control_tests { } {
timeout { file "(timeout) purge_tests" }
}
send "x/4i insert_tests\n"
send_gdb "x/4i insert_tests\n"
expect {
-re ".*
-re "
.*idtlba r4,\\(sr0,r5\\).*
.*iitlba r4,\\(sr0,r5\\).*
.*idtlbp r4,\\(sr0,r5\\).*
@ -919,9 +939,9 @@ proc all_fpu_memory_tests { } {
global hex
global decimal
send "x/20i fpu_memory_indexing_tests\n"
send_gdb "x/20i fpu_memory_indexing_tests\n"
expect {
-re ".*
-re "
.*fldwx r4\\(sr0,r5\\),fr6.*
.*fldwx,s r4\\(sr0,r5\\),fr6.*
.*fldwx,m r4\\(sr0,r5\\),fr6.*
@ -947,9 +967,9 @@ proc all_fpu_memory_tests { } {
timeout { file "(timeout) fpu_memory_indexing_tests" }
}
send "x/15i fpu_short_memory_tests\n"
send_gdb "x/15i fpu_short_memory_tests\n"
expect {
-re ".*
-re "
.*fldws 0\\(sr0,r5\\),fr6.*
.*fldws,mb 0\\(sr0,r5\\),fr6.*
.*fldws,ma 0\\(sr0,r5\\),fr6.*
@ -977,9 +997,9 @@ proc all_fpu_computational_tests { } {
global hex
global decimal
send "x/1i fpu_misc_tests\n"
send_gdb "x/1i fpu_misc_tests\n"
expect {
-re ".*
-re "
.*ftest.*
.*$prompt $" { pass "fpu_misc_tests" }
-re "$prompt $" { fail "fpu_misc_tests" }
@ -989,9 +1009,9 @@ proc all_fpu_computational_tests { } {
set fpu_two_op_insns [list {fcpy} {fabs} {fsqrt} {frnd} ]
foreach i $fpu_two_op_insns {
send "x/5i $i"; send "_tests\n"
send_gdb "x/5i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i,sgl fr5,fr10.*
.*$i,dbl fr5,fr10.*
.*$i,quad fr5,fr10.*
@ -1006,9 +1026,9 @@ proc all_fpu_computational_tests { } {
set fpu_conversions [list {fcnvff} {fcnvxf} {fcnvfx} {fcnvfxt} ]
foreach i $fpu_conversions {
send "x/18i $i"; send "_tests\n"
send_gdb "x/18i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i,sgl,sgl fr5,fr10.*
.*$i,sgl,dbl fr5,fr10.*
.*$i,sgl,quad fr5,fr10.*
@ -1036,9 +1056,9 @@ proc all_fpu_computational_tests { } {
set fpu_three_op_insns [list {fadd} {fsub} {fmpy} {fdiv} {frem} ]
foreach i $fpu_three_op_insns {
send "x/6i $i"; send "_tests\n"
send_gdb "x/6i $i"; send_gdb "_tests\n"
expect {
-re ".*
-re "
.*$i,sgl fr4,fr8,fr12.*
.*$i,dbl fr4,fr8,fr12.*
.*$i,quad fr4,fr8,fr12.*
@ -1051,9 +1071,9 @@ proc all_fpu_computational_tests { } {
}
}
send "x/4i fmpy_addsub_tests\n"
send_gdb "x/4i fmpy_addsub_tests\n"
expect {
-re ".*
-re "
.*fmpyadd,sgl fr16,fr17,fr18,fr19,fr20.*
.*fmpyadd,dbl fr16,fr17,fr18,fr19,fr20.*
.*fmpysub,sgl fr16,fr17,fr18,fr19,fr20.*
@ -1063,9 +1083,9 @@ proc all_fpu_computational_tests { } {
timeout { fail "(timeout) fmpy_addsub_tests" }
}
send "x/i xmpyu_tests\n"
send_gdb "x/i xmpyu_tests\n"
expect {
-re ".*
-re "
.*xmpyu fr4,fr5,fr6.*
.*$prompt $" {pass "xmpyu_tests" }
-re "$prompt $" {fail "xmpyu_tests" }
@ -1082,9 +1102,9 @@ proc all_fpu_comparison_tests { } {
set fpu_comparison_formats [list {sgl} {dbl} {quad} ]
foreach i $fpu_comparison_formats {
send "x/8i fcmp_$i"; send "_tests_1\n"
send_gdb "x/8i fcmp_$i"; send_gdb "_tests_1\n"
expect {
-re ".*
-re "
.*fcmp,$i,false\\? fr4,fr5.*
.*fcmp,$i,false fr4,fr5.*
.*fcmp,$i,\\? fr4,fr5.*
@ -1098,9 +1118,9 @@ proc all_fpu_comparison_tests { } {
timeout { fail "(timeout) fcmp_$i tests (part1) " }
}
send "x/8i fcmp_$i"; send "_tests_2\n"
send_gdb "x/8i fcmp_$i"; send_gdb "_tests_2\n"
expect {
-re ".*
-re "
.*fcmp,$i,!\\?>= fr4,fr5.*
.*fcmp,$i,< fr4,fr5.*
.*fcmp,$i,\\?< fr4,fr5.*
@ -1114,9 +1134,9 @@ proc all_fpu_comparison_tests { } {
timeout { fail "(timeout) fcmp_$i tests (part2) " }
}
send "x/8i fcmp_$i"; send "_tests_3\n"
send_gdb "x/8i fcmp_$i"; send_gdb "_tests_3\n"
expect {
-re ".*
-re "
.*fcmp,$i,!\\?<= fr4,fr5.*
.*fcmp,$i,> fr4,fr5.*
.*fcmp,$i,\\?> fr4,fr5.*
@ -1130,9 +1150,9 @@ proc all_fpu_comparison_tests { } {
timeout { fail "(timeout) fcmp_$i tests (part3) " }
}
send "x/16i fcmp_$i"; send "_tests_4\n"
send_gdb "x/8i fcmp_$i"; send_gdb "_tests_4\n"
expect {
-re ".*
-re "
.*fcmp,$i,!\\?= fr4,fr5.*
.*fcmp,$i,<> fr4,fr5.*
.*fcmp,$i,!= fr4,fr5.*
@ -1153,9 +1173,9 @@ proc all_special_tests { } {
global hex
global decimal
send "x/4i special_tests\n"
send_gdb "x/4i special_tests\n"
expect {
-re ".*
-re "
.*gfw r4\\(sr0,r5\\).*
.*gfw,m r4\\(sr0,r5\\).*
.*gfr r4\\(sr0,r5\\).*
@ -1172,9 +1192,9 @@ proc all_sfu_tests { } {
global hex
global decimal
send "x/16i sfu_tests\n"
send_gdb "x/16i sfu_tests\n"
expect {
-re ".*
-re "
.*spop0,4,5.*
.*spop0,4,73.*
.*spop0,4,5,n.*
@ -1202,9 +1222,9 @@ proc all_copr_tests { } {
global hex
global decimal
send "x/4i copr_tests\n"
send_gdb "x/4i copr_tests\n"
expect {
-re ".*
-re "
.*copr,4,5.*
.*copr,4,73.*
.*copr,4,5,n.*
@ -1220,9 +1240,9 @@ proc all_copr_mem_tests { } {
global hex
global decimal
send "x/8i copr_indexing_load\n"
send_gdb "x/8i copr_indexing_load\n"
expect {
-re ".*
-re "
.*cldwx,4 r5\\(sr0,r4\\),r26.*
.*cldwx,4,s r5\\(sr0,r4\\),r26.*
.*cldwx,4,m r5\\(sr0,r4\\),r26.*
@ -1236,9 +1256,9 @@ proc all_copr_mem_tests { } {
timeout { fail "(timeout) copr indexed load tests " }
}
send "x/8i copr_indexing_store\n"
send_gdb "x/8i copr_indexing_store\n"
expect {
-re ".*
-re "
.*cstwx,4 r26,r5\\(sr0,r4\\).*
.*cstwx,4,s r26,r5\\(sr0,r4\\).*
.*cstwx,4,m r26,r5\\(sr0,r4\\).*
@ -1252,9 +1272,9 @@ proc all_copr_mem_tests { } {
timeout { fail "(timeout) copr indexed load tests " }
}
send "x/12i copr_short_memory\n"
send_gdb "x/12i copr_short_memory\n"
expect {
-re ".*
-re "
.*cldws,4 0\\(sr0,r4\\),r26.*
.*cldws,4,mb 0\\(sr0,r4\\),r26.*
.*cldws,4,ma 0\\(sr0,r4\\),r26.*
@ -1278,9 +1298,9 @@ proc fmemLRbug_tests { } {
global hex
global decimal
send "x/12i fmemLRbug_tests_1\n"
send_gdb "x/12i fmemLRbug_tests_1\n"
expect {
-re ".*
-re "
.*fstws fr6R,0\\(sr0,r26\\).*
.*fstws fr6,4\\(sr0,r26\\).*
.*fstws fr6,8\\(sr0,r26\\).*
@ -1298,9 +1318,9 @@ proc fmemLRbug_tests { } {
timeout { fail "(timeout) fmem LR register selector tests (part1)" }
}
send "x/12i fmemLRbug_tests_2\n"
send_gdb "x/12i fmemLRbug_tests_2\n"
expect {
-re ".*
-re "
.*fstws fr6R,0\\(sr0,r26\\).*
.*fstws fr6,4\\(sr0,r26\\).*
.*fstws fr6,8\\(sr0,r26\\).*
@ -1318,9 +1338,9 @@ proc fmemLRbug_tests { } {
timeout { fail "(timeout) fmem LR register selector tests (part2)" }
}
send "x/12i fmemLRbug_tests_3\n"
send_gdb "x/12i fmemLRbug_tests_3\n"
expect {
-re ".*
-re "
.*fstwx fr6R,r25\\(sr0,r26\\).*
.*fstwx fr6,r25\\(sr0,r26\\).*
.*fstwx fr6,r25\\(sr0,r26\\).*
@ -1338,9 +1358,9 @@ proc fmemLRbug_tests { } {
timeout { fail "(timeout) fmem LR register selector tests (part3)" }
}
send "x/12i fmemLRbug_tests_4\n"
send_gdb "x/12i fmemLRbug_tests_4\n"
expect {
-re ".*
-re "
.*fstwx fr6R,r25\\(sr0,r26\\).*
.*fstwx fr6,r25\\(sr0,r26\\).*
.*fstwx fr6,r25\\(sr0,r26\\).*
@ -1359,31 +1379,25 @@ proc fmemLRbug_tests { } {
}
}
if ![file exists $objdir/$subdir/$binfile] then {
if $all_flag then {
warning "$objdir/$subdir/$binfile does not exist; tests suppressed"
}
} else {
# Start with a fresh gdb.
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
all_integer_memory_tests
all_immediate_tests
all_branch_tests
all_integer_computational_tests
all_system_control_tests
all_fpu_memory_tests
all_fpu_computational_tests
all_fpu_comparison_tests
all_special_tests
all_sfu_tests
all_copr_tests
all_copr_mem_tests
all_integer_memory_tests
all_immediate_tests
all_branch_tests
all_integer_computational_tests
all_system_control_tests
all_fpu_memory_tests
all_fpu_computational_tests
all_fpu_comparison_tests
all_special_tests
all_sfu_tests
all_copr_tests
all_copr_mem_tests
# Regression test for a bug Tege found.
fmemLRbug_tests
}
# Regression test for a bug Tege found.
fmemLRbug_tests

@ -23,18 +23,28 @@ if $tracelevel then {
strace $tracelevel
}
if ![istarget "sh3*-*-*"] {
verbose "Tests ignored for all but sh3 based targets."
return
}
set prms_id 0
set bug_id 0
set binfile "sh3"
set srcfile $binfile.s
set testfile "sh3"
set srcfile ${srcdir}/${subdir}/${testfile}.s
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } {
perror "Couldn't link ${binfile}"
return -1
}
proc all_fp_move_and_load_tests { } {
global prompt
global hex
global decimal
send "x/9i fp_move_and_load_tests\n"
send_gdb "x/9i fp_move_and_load_tests\n"
expect {
-re "
.*fmov.s\t@r0,fr0.*
@ -57,14 +67,14 @@ proc all_fp_arithmetic_tests { } {
global hex
global decimal
send "x/13i fp_arithmetic_tests\n"
send_gdb "x/13i fp_arithmetic_tests\n"
expect {
-re "
.*fadd\tfr0,fr1.*
.*fsub\tfr0,fr1.*
.*fmul\tfr0,fr1.*
.*fdiv\tfr0,fr1.*
.*fmac\tfr0,fr1.*
.*fmac\tfr0,fr0,fr1.*
.*fcmp/eq\tfr0,fr1.*
.*fcmp/gt\tfr0,fr1.*
.*ftst/nan\tfr0.*
@ -84,7 +94,7 @@ proc all_fp_misc_tests { } {
global hex
global decimal
send "x/10i fp_misc_tests\n"
send_gdb "x/10i fp_misc_tests\n"
expect {
-re "
.*fsts\tfpul,fr0.*
@ -103,19 +113,12 @@ proc all_fp_misc_tests { } {
}
}
if ![file exists $objdir/$subdir/$binfile] then {
if $all_flag then {
warning "$objdir/$subdir/$binfile does not exist; tests suppressed"
}
} else {
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
all_fp_move_and_load_tests
all_fp_arithmetic_tests
all_fp_misc_tests
all_fp_move_and_load_tests
all_fp_arithmetic_tests
all_fp_misc_tests
}

@ -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
@ -32,26 +32,14 @@ set bug_id 0
proc set_lang_fortran {} {
global prompt
send "set language fortran\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language fortran (timeout)" ; return 0 }
if [gdb_test "set language fortran" ""] {
return 0;
}
send "show language\n"
expect {
-re ".* source language is \"fortran\".*$prompt $" {
pass "set language to \"fortran\""
return 1
}
-re ".*$prompt $" {
fail "setting language to \"fortran\""
return 0
}
timeout {
fail "can't show language (timeout)"
return 0
}
if ![gdb_test "show language" ".* source language is \"fortran\".*"] {
return 1;
} else {
return 0;
}
}
@ -92,72 +80,72 @@ proc test_float_literals_accepted {} {
# Test various floating point formats
gdb_test "p .44 .LT. .45" " = 1"
gdb_test "p .44 .GT. .45" " = 0"
gdb_test "p 0.44 .LT. 0.45" " = 1"
gdb_test "p 0.44 .GT. 0.45" " = 0"
gdb_test "p 44. .LT. 45." " = 1"
gdb_test "p 44. .GT. 45." " = 0"
gdb_test "p 44.0 .LT. 45.0" " = 1"
gdb_test "p 44.0 .GT. 45.0" " = 0"
gdb_test "p 10D20 .LT. 10D21" " = 1"
gdb_test "p 10D20 .GT. 10D21" " = 0"
gdb_test "p 10d20 .LT. 10d21" " = 1"
gdb_test "p 10d20 .GT. 10d21" " = 0"
gdb_test "p 10E20 .LT. 10E21" " = 1"
gdb_test "p 10E20 .GT. 10E21" " = 0"
gdb_test "p 10e20 .LT. 10e21" " = 1"
gdb_test "p 10e20 .GT. 10e21" " = 0"
gdb_test "p 10.D20 .LT. 10.D21" " = 1"
gdb_test "p 10.D20 .GT. 10.D21" " = 0"
gdb_test "p 10.d20 .LT. 10.d21" " = 1"
gdb_test "p 10.d20 .GT. 10.d21" " = 0"
gdb_test "p 10.E20 .LT. 10.E21" " = 1"
gdb_test "p 10.E20 .GT. 10.E21" " = 0"
gdb_test "p 10.e20 .LT. 10.e21" " = 1"
gdb_test "p 10.e20 .GT. 10.e21" " = 0"
gdb_test "p 10.0D20 .LT. 10.0D21" " = 1"
gdb_test "p 10.0D20 .GT. 10.0D21" " = 0"
gdb_test "p 10.0d20 .LT. 10.0d21" " = 1"
gdb_test "p 10.0d20 .GT. 10.0d21" " = 0"
gdb_test "p 10.0E20 .LT. 10.0E21" " = 1"
gdb_test "p 10.0E20 .GT. 10.0E21" " = 0"
gdb_test "p 10.0e20 .LT. 10.0e21" " = 1"
gdb_test "p 10.0e20 .GT. 10.0e21" " = 0"
gdb_test "p 10.0D+20 .LT. 10.0D+21" " = 1"
gdb_test "p 10.0D+20 .GT. 10.0D+21" " = 0"
gdb_test "p 10.0d+20 .LT. 10.0d+21" " = 1"
gdb_test "p 10.0d+20 .GT. 10.0d+21" " = 0"
gdb_test "p 10.0E+20 .LT. 10.0E+21" " = 1"
gdb_test "p 10.0E+20 .GT. 10.0E+21" " = 0"
gdb_test "p 10.0e+20 .LT. 10.0e+21" " = 1"
gdb_test "p 10.0e+20 .GT. 10.0e+21" " = 0"
gdb_test "p 10.0D-11 .LT. 10.0D-10" " = 1"
gdb_test "p 10.0D-11 .GT. 10.0D-10" " = 0"
gdb_test "p 10.0d-11 .LT. 10.0d-10" " = 1"
gdb_test "p 10.0d-11 .GT. 10.0d-10" " = 0"
gdb_test "p 10.0E-11 .LT. 10.0E-10" " = 1"
gdb_test "p 10.0E-11 .GT. 10.0E-10" " = 0"
gdb_test "p 10.0e-11 .LT. 10.0e-10" " = 1"
gdb_test "p 10.0e-11 .GT. 10.0e-10" " = 0"
gdb_test "p .44 .LT. .45" " = .TRUE."
gdb_test "p .44 .GT. .45" " = .FALSE."
gdb_test "p 0.44 .LT. 0.45" " = .TRUE."
gdb_test "p 0.44 .GT. 0.45" " = .FALSE."
gdb_test "p 44. .LT. 45." " = .TRUE."
gdb_test "p 44. .GT. 45." " = .FALSE."
gdb_test "p 44.0 .LT. 45.0" " = .TRUE."
gdb_test "p 44.0 .GT. 45.0" " = .FALSE."
gdb_test "p 10D20 .LT. 10D21" " = .TRUE."
gdb_test "p 10D20 .GT. 10D21" " = .FALSE."
gdb_test "p 10d20 .LT. 10d21" " = .TRUE."
gdb_test "p 10d20 .GT. 10d21" " = .FALSE."
gdb_test "p 10E20 .LT. 10E21" " = .TRUE."
gdb_test "p 10E20 .GT. 10E21" " = .FALSE."
gdb_test "p 10e20 .LT. 10e21" " = .TRUE."
gdb_test "p 10e20 .GT. 10e21" " = .FALSE."
gdb_test "p 10.D20 .LT. 10.D21" " = .TRUE."
gdb_test "p 10.D20 .GT. 10.D21" " = .FALSE."
gdb_test "p 10.d20 .LT. 10.d21" " = .TRUE."
gdb_test "p 10.d20 .GT. 10.d21" " = .FALSE."
gdb_test "p 10.E20 .LT. 10.E21" " = .TRUE."
gdb_test "p 10.E20 .GT. 10.E21" " = .FALSE."
gdb_test "p 10.e20 .LT. 10.e21" " = .TRUE."
gdb_test "p 10.e20 .GT. 10.e21" " = .FALSE."
gdb_test "p 10.0D20 .LT. 10.0D21" " = .TRUE."
gdb_test "p 10.0D20 .GT. 10.0D21" " = .FALSE."
gdb_test "p 10.0d20 .LT. 10.0d21" " = .TRUE."
gdb_test "p 10.0d20 .GT. 10.0d21" " = .FALSE."
gdb_test "p 10.0E20 .LT. 10.0E21" " = .TRUE."
gdb_test "p 10.0E20 .GT. 10.0E21" " = .FALSE."
gdb_test "p 10.0e20 .LT. 10.0e21" " = .TRUE."
gdb_test "p 10.0e20 .GT. 10.0e21" " = .FALSE."
gdb_test "p 10.0D+20 .LT. 10.0D+21" " = .TRUE."
gdb_test "p 10.0D+20 .GT. 10.0D+21" " = .FALSE."
gdb_test "p 10.0d+20 .LT. 10.0d+21" " = .TRUE."
gdb_test "p 10.0d+20 .GT. 10.0d+21" " = .FALSE."
gdb_test "p 10.0E+20 .LT. 10.0E+21" " = .TRUE."
gdb_test "p 10.0E+20 .GT. 10.0E+21" " = .FALSE."
gdb_test "p 10.0e+20 .LT. 10.0e+21" " = .TRUE."
gdb_test "p 10.0e+20 .GT. 10.0e+21" " = .FALSE."
gdb_test "p 10.0D-11 .LT. 10.0D-10" " = .TRUE."
gdb_test "p 10.0D-11 .GT. 10.0D-10" " = .FALSE."
gdb_test "p 10.0d-11 .LT. 10.0d-10" " = .TRUE."
gdb_test "p 10.0d-11 .GT. 10.0d-10" " = .FALSE."
gdb_test "p 10.0E-11 .LT. 10.0E-10" " = .TRUE."
gdb_test "p 10.0E-11 .GT. 10.0E-10" " = .FALSE."
gdb_test "p 10.0e-11 .LT. 10.0e-10" " = .TRUE."
gdb_test "p 10.0e-11 .GT. 10.0e-10" " = .FALSE."
}
proc test_convenience_variables {} {
global prompt
gdb_test "set \$foo = 101" " = 101\[\r\n\]+" \
gdb_test "set \$foo = 101" " = 101\[\r\n\]*" \
"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" " = 301\[\r\n\]*" \
"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" " = 11\[\r\n\]*" \
"Set convenience variable \$_"
gdb_test "print \$_" " = 11" \
@ -269,7 +257,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings" ""
if [set_lang_fortran] then {
test_value_history
@ -281,5 +269,5 @@ if [set_lang_fortran] then {
test_float_literals_accepted
test_arithmetic_expressions
} else {
warning "$test_name tests suppressed."
warning "$test_name tests suppressed." 0
}

@ -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
@ -32,212 +32,63 @@ set bug_id 0
proc set_lang_fortran {} {
global prompt
send "set language fortran\n"
expect {
-re ".*$prompt $" {}
timeout { fail "set language fortran (timeout)" ; return 0 }
if [gdb_test "set language fortran" ""] {
return 0;
}
send "show language\n"
expect {
-re ".* source language is \"fortran\".*$prompt $" {
pass "set language to \"fortran\""
return 1
}
-re ".*$prompt $" {
fail "setting language to \"fortran\""
return 0
}
timeout {
fail "can't show language (timeout)"
return 0
}
}
}
# Testing printing of a specific value. Increment passcount for
# success or issue fail message for failure. In both cases, return
# a 1 to indicate that more tests can proceed. However a timeout
# is a serious error, generates a special fail message, and causes
# a 0 to be returned to indicate that more tests are likely to fail
# as well.
#
# Args are:
#
# First one is string to send to gdb
# Second one is string to match gdb result to
# Third one is an optional message to be printed
proc test_print_accept { args } {
global prompt
global passcount
global verbose
if [llength $args]==3 then {
set message [lindex $args 2]
if ![gdb_test "show language" ".* source language is \"fortran\".*"] {
return 1;
} else {
set message [lindex $args 0]
}
set sendthis [lindex $args 0]
set expectthis [lindex $args 1]
if $verbose>2 then {
send_user "Sending \"$sendthis\" to gdb\n"
send_user "Looking to match \"$expectthis\"\n"
send_user "Message is \"$message\"\n"
}
send "$sendthis\n"
expect {
-re ".* = $expectthis\r\n$prompt $" {
incr passcount
return 1
}
-re ".*$prompt $" {
if ![string match "" $message] then {
fail "$sendthis ($message)"
} else {
fail "$sendthis"
}
return 1
}
timeout {
fail "$sendthis (timeout)"
return 0
}
}
}
# Testing printing of a specific value. Increment passcount for
# success or issue fail message for failure. In both cases, return
# a 1 to indicate that more tests can proceed. However a timeout
# is a serious error, generates a special fail message, and causes
# a 0 to be returned to indicate that more tests are likely to fail
# as well.
proc test_print_reject { args } {
global prompt
global passcount
global verbose
if [llength $args]==2 then {
set expectthis [lindex $args 1]
} else {
set expectthis "should never match this bogus string"
}
set sendthis [lindex $args 0]
if $verbose>2 then {
send_user "Sending \"$sendthis\" to gdb\n"
send_user "Looking to match \"$expectthis\"\n"
}
send "$sendthis\n"
expect {
-re ".*A .* in expression.*\\.*$prompt $" {
incr passcount
return 1
}
-re ".*Junk after end of expression.*$prompt $" {
incr passcount
return 1
}
-re ".*No symbol table is loaded.*$prompt $" {
incr passcount
return 1
}
-re ".*$expectthis.*$prompt $" {
incr passcount
return 1
}
-re ".*$prompt $" {
fail "$sendthis not properly rejected"
return 1
}
timeout {
fail "$sendthis (timeout)"
return 0
}
return 0;
}
}
proc test_integer_literal_types_accepted {} {
global prompt
global passcount
set passcount 0
# Test various decimal values.
test_print_accept "pt 123" "integer"
if $passcount then {
pass "$passcount correct integer literal types printed"
}
gdb_test "pt 123" "type = int" # Should be integer*4 probably
}
proc test_character_literal_types_accepted {} {
global prompt
global passcount
set passcount 0
# Test various character values.
test_print_accept "pt 'a'" "character*1"
if $passcount then {
pass "$passcount correct character literal types printed"
}
gdb_test "pt 'a'" "type = character\\*1"
}
proc test_integer_literal_types_rejected {} {
global prompt
global passcount
set passcount 0
test_print_reject "pt _"
if $passcount then {
pass "$passcount incorrect integer literal types rejected"
}
}
proc test_logical_literal_types_accepted {} {
global prompt
global passcount
set passcount 0
# Test the only possible values for a logical, TRUE and FALSE.
test_print_accept "pt .TRUE." "logical*2"
test_print_accept "pt .FALSE." "logical*2"
if $passcount then {
pass "$passcount correct logical literal types printed"
}
gdb_test "pt .TRUE." "type = logical\\*2"
gdb_test "pt .FALSE." "type = logical\\*2"
}
proc test_float_literal_types_accepted {} {
global prompt
global passcount
set passcount 0
# Test various floating point formats
test_print_accept "pt .44" "real*8"
test_print_accept "pt 44.0" "real*8"
test_print_accept "pt 10D20" "1"
test_print_accept "pt 10D20" "0"
test_print_accept "pt 10d20" "1"
test_print_accept "pt 10d20" "0"
test_print_accept "pt 10E20" "real*8"
test_print_accept "pt 10E20" "real*8"
test_print_accept "pt 10e20" "real*8"
test_print_accept "pt 10e20" "real*8"
if $passcount then {
pass "$passcount correct float literal comparisons"
}
gdb_test "pt .44" "type = real\\*8"
gdb_test "pt 44.0" "type = real\\*8"
gdb_test "pt 10D20" "type = real\\*8"
gdb_test "pt 10D20" "type = real\\*8"
gdb_test "pt 10d20" "type = real\\*8"
gdb_test "pt 10d20" "type = real\\*8"
gdb_test "pt 10E20" "type = real\\*8"
gdb_test "pt 10E20" "type = real\\*8"
gdb_test "pt 10e20" "type = real\\*8"
gdb_test "pt 10e20" "type = real\\*8"
}
# Start with a fresh gdb.
@ -246,7 +97,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
gdb_test "set print sevenbit-strings" ""
if [set_lang_fortran] then {
test_integer_literal_types_accepted
@ -255,5 +106,5 @@ if [set_lang_fortran] then {
test_character_literal_types_accepted
test_float_literal_types_accepted
} else {
warning "$test_name tests suppressed."
warning "$test_name tests suppressed." 0
}

@ -5,6 +5,16 @@ if $tracelevel then {
strace $tracelevel
}
# If the test directory was not created by configure then skip
# this test.
if ![file isdirectory ${objdir}/${subdir}] then {
return 0
}
if ![file exists ${objdir}/${subdir}/weird.s] {
return 0
}
set prms_id 0
set bug_id 0
@ -17,7 +27,7 @@ proc do_tests {} {
# file is then processed with native cc, all stabs directives
# will be lost.
# Skip the rest of the stabs tests for this case.
send "ptype inttype\n"
send_gdb "ptype inttype\n"
expect {
-re "^ptype inttype\r*\ntype = inttype.*$prompt $" {
pass "stabs found"
@ -179,8 +189,6 @@ field3 = 0x77888877\}" "print struct constant"
gdb_test "p common0var2" "= 22"
# this long line must be continous, not with "/" escaping the newline
# This apparently worked at one time and is now broken on some configs
setup_xfail "sparc-sun-sunos4*" "sparc-sun-solaris*" "hppa*-*-*"
gdb_test "p v_comb" "{<> = {<> = {x = 42}, \[_a-zA-Z$.\]* = \[0-9xa-fA-F\]*, a = 43}, <> = {\[_a-zA-Z$.\]* = \[0-9xa-fA-F\]*, b = 44}, comb = 45}"
}
@ -189,7 +197,7 @@ proc print_weird_var { var } {
# Make sure that the variable gets printed out correctly, without
# any sort of warning message.
send "print $var\n"
send_gdb "print $var\n"
expect {
-re "^print $var\r*\n.\[0-9\]* = 42.*$prompt $" {
pass "variable $var printed properly"
@ -223,7 +231,7 @@ gdb_reinitialize_dir $srcdir/$subdir
# error messages during symbol reading.
set testfile weird
set srcfile ${objdir}/${subdir}/weird.s
set binfile ${objdir}/${subdir}/weird.o
set binfile ${objdir}/${subdir}/weirdx.o
global target_os
set sedscript ${srcdir}/${subdir}/aout.sed
@ -252,19 +260,21 @@ switch -glob ${target_triplet} {
}
set exec_output [execute_anywhere "sed -f ${sedscript} < ${srcdir}/${subdir}/weird.def > ${srcfile}"]
if { $exec_output != "" } {
perror "Couldn't make test case."
# Hope this is a Unix box.
set exec_output [remote_exec build "sed" "-f ${sedscript}" "${srcdir}/${subdir}/weird.def" "${srcfile}"]
if { [lindex $exec_output 0] != 0 } {
perror "Couldn't make test case. $exec_output"
return -1
}
if { [compile "${srcfile} -c -o ${binfile}"] != "" } {
if { [gdb_compile "${srcfile}" "${binfile}" object ""] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
set exec_output [execute_anywhere "rm -f ${srcfile}"]
exp_send "file $binfile\n"
remote_file build delete ${srcfile}
set binfile [remote_download host ${binfile} object.o]
send_gdb "file $binfile\n"
# If $binfile is very long, a \r (but not a \n) will echo in the
# middle of the echo of the command. So to match the echo, we
# would like to match anything not containing \n
@ -274,22 +284,24 @@ exp_send "file $binfile\n"
# But spaces following by backspaces aren't really spaces.
expect {
-re "^file (\[^ \]| +\008)*\r*\nReading symbols from $binfile\.\.\.done\.\r*\n$prompt $" {
pass "weird.o read without error"
pass "weirdx.o read without error"
}
-re "A program is being debugged already. Kill it\? \(y or n\)" {
send "y\n"
send_gdb "y\n"
exp_continue
}
-re ".*$prompt $" {
fail "Errors reading weird.o"
fail "Errors reading weirdx.o"
}
timeout {
perror "couldn't load $binfile into $GDB (timed out)."
return -1
}
eof { fail "(eof) cannot read weird.o" }
eof { fail "(eof) cannot read weirdx.o" }
}
do_tests
remote_file host delete ${binfile}
return 0

@ -26,15 +26,49 @@ if $tracelevel then {
set prms_id 0
set bug_id 0
# This only works with native configurations
if ![isnative] then {
return
}
set testfile "pthreads"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set ccout [compile "${srcdir}/${subdir}/${srcfile} -I${objdir}/${subdir} -g -o ${binfile} -lpthread"]
switch -regexp -- $ccout {
".*no posix threads support.*" { return 0 }
{^$} { pass "successfully compiled posix threads test case" }
default { perror "Couldn't compile ${srcfile}" ; return -1 }
set built_binfile 0
if [istarget "*-*-linux"] then {
set target_cflags "-D_MIT_POSIX_THREADS"
} else {
set target_cflags ""
}
set why_msg "unrecognized error"
foreach lib {-lpthreads -lpthread} {
set options "debug"
lappend options "incdir=${objdir}/${subdir}"
lappend options "libs=$lib"
set ccout [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $options]
switch -regexp -- $ccout {
".*no posix threads support.*" {
set why_msg "missing threads include file"
break
}
".*cannot open -lpthread.*" {
set why_msg "missing runtime threads library"
}
".*Can't find library for -lpthread.*" {
set why_msg "missing runtime threads library"
}
{^$} {
pass "successfully compiled posix threads test case"
set built_binfile 1
break
}
}
}
if {$built_binfile == "0"} {
unsupported "Couldn't compile ${srcfile}, ${why_msg}"
return -1
}
# Now we can proceed with the real testing.
@ -45,16 +79,16 @@ 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" ""
# We'll need this when we send a ^C to GDB. Need to do it before we
# We'll need this when we send_gdb a ^C to GDB. Need to do it before we
# run the program and gdb starts saving and restoring tty states.
# On Ultrix, we don't need it and it is really slow (because shell_escape
# doesn't use vfork).
if ![istarget "*-*-ultrix*"] then {
send "shell stty intr '^C'\n" ; expect -re "$prompt $"
gdb_test "shell stty intr '^C'" ""
}
proc all_threads_running {} {
@ -62,26 +96,26 @@ proc all_threads_running {} {
global srcfile
# Reset all the counters to zero.
send "set var common_routine::hits=0\n" ; expect -re "$prompt $"
send "set var common_routine::from_thread1=0\n" ; expect -re "$prompt $"
send "set var common_routine::from_thread2=0\n" ; expect -re "$prompt $"
send "set var common_routine::from_main=0\n" ; expect -re "$prompt $"
send "set var common_routine::full_coverage=0\n" ; expect -re "$prompt $"
gdb_test "set var common_routine::hits=0" ""
gdb_test "set var common_routine::from_thread1=0" ""
gdb_test "set var common_routine::from_thread2=0" ""
gdb_test "set var common_routine::from_main=0" ""
gdb_test "set var common_routine::full_coverage=0" ""
# Disable all breakpoints.
send "disable\n" ; expect -re "$prompt $"
gdb_test "disable" ""
# Set up a breakpoint that will cause us to stop when we have
# been called 15 times. This should be plenty of time to allow
# every thread to run at least once, since each thread sleeps for
# one second between calls to common_routine.
send "tbreak common_routine if hits == 15\n"; expect -re "$prompt $"
gdb_test "tbreak common_routine if hits == 15" ""
# Start all the threads running again and wait for the inferior
# to stop. Since no other breakpoints are set at this time
# we should stop only when we have been previously called 15 times.
send "continue\n"
send_gdb "continue\n"
expect {
-re "Continuing.*common_routine.*at.*$srcfile.*$prompt $" {}
default {
@ -97,13 +131,17 @@ proc all_threads_running {} {
# Check that we stopped when we actually expected to stop, by
# verifying that there have been 15 previous hits.
send "p common_routine::hits\n"
send_gdb "p common_routine::hits\n"
expect {
-re ".*= 15\r\n$prompt $" {}
default {
fail "stopped before calling common_routine 15 times"
return 0
}
-re ".*$prompt $" {
fail "stopped before clling common_routine 15 times"
return 0
}
timeout {
fail "stopped before calling common_routine 15 times (timeout)"
return 0
@ -113,7 +151,7 @@ proc all_threads_running {} {
# Also check that all of the threads have run, which will only be true
# if the full_coverage variable is set.
send "p common_routine::full_coverage\n"
send_gdb "p common_routine::full_coverage\n"
expect {
-re ".*= 1\r\n$prompt $" {}
default {
@ -135,10 +173,21 @@ proc test_startup {} {
global main_id thread1_id thread2_id
# We should be able to do an info threads before starting any others.
gdb_test "info threads" ".*Thread.*LWP.*main.*"
send_gdb "info threads\n"
expect {
-re ".*Thread.*LWP.*main.*" {
pass "info threads"
}
-re "\r\n$prompt $" {
pass "info threads"
setup_xfail "*-*-*"
fail "gdb does not support pthreads for this machine"
return 0
}
}
# Extract the thread id number of main thread from "info threads" output.
send "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*main.*)($prompt $)"
send_gdb "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*main.*)($prompt $)"
set main_id $expect_out(1,string)
# Check that we can continue and create the first thread.
@ -146,10 +195,10 @@ proc test_startup {} {
gdb_test "continue" \
"Continuing.*Breakpoint .*, thread1 \\(arg=0xfeedface\\).*at.*$srcfile.*" \
"Continue to creation of first thread"
send "disable\n" ; expect -re "$prompt $"
gdb_test "disable" ""
# Extract the thread id number of thread 1 from "info threads" output.
send "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*thread1.*)($prompt $)"
send_gdb "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*thread1.*)($prompt $)"
set thread1_id $expect_out(1,string)
# Check that we can continue and create the second thread,
@ -160,8 +209,10 @@ proc test_startup {} {
"Continue to creation of second thread"
# Extract the thread id number of thread 2 from "info threads" output.
send "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*thread2.*)($prompt $)"
send_gdb "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*thread2.*)($prompt $)"
set thread2_id $expect_out(1,string)
return 1
}
proc check_control_c {} {
@ -173,9 +224,9 @@ proc check_control_c {} {
}
# Send a continue followed by ^C to the process to stop it.
send "continue\n"
send_gdb "continue\n"
set description "Stopped with a ^C"
after 1000 [send "\003"]
after 1000 [send_gdb "\003"]
expect {
-re "Program received signal SIGINT.*$prompt $" {
pass $description
@ -187,7 +238,7 @@ proc check_control_c {} {
fail "$description (timeout)"
}
}
send "bt\n" ; expect -re "$prompt $"
gdb_test "bt" ""
# Verify that all threads can be run again after a ^C stop.
if [all_threads_running] then {
@ -224,10 +275,10 @@ proc check_backtraces {} {
"Breakpoint .* at 0x.* file .* line .*" \
"set break at common_routine in thread 2"
send "continue\n"
send_gdb "continue\n"
expect {
-re "Breakpoint .* common_routine \\(arg=2\\).*" {
send "backtrace\n"
send_gdb "backtrace\n"
expect {
-re "#0.*common_routine \\(arg=2\\).*#1.*thread2.*" {
pass "backtrace from thread 2 bkpt in common_routine"
@ -246,18 +297,24 @@ proc check_backtraces {} {
-re "Breakpoint .* common_routine \\(arg=1\\).*" {
fail "stopped in main thread at breakpoint for thread 1"
}
-re ".*$prompt" {
fail "continue to bkpt at common_routine in thread 2"
}
default {
fail "continue to bkpt at common_routine in thread 2"
}
timeout {
fail "continue to bkpt at common_routine in thread 2 (timeout)"
}
}
}
setup_xfail "alpha-*-osf*"
if [runto_main] then {
test_startup
check_control_c
check_backtraces
clear_xfail "alpha-*-osf*"
if [test_startup] then {
check_control_c
check_backtraces
}
}
clear_xfail "alpha-*-osf*"

@ -0,0 +1,200 @@
# step.exp -- Expect script to test gdb with step.c
# Copyright (C) 1992 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 Hiro Sugawara. (hiro@lynx.com)
#
# This test really needs some major surgery to be acceptable, but
# I'm just about burnt out on lynx work, so I'm not doing it now.
#
# * The test has an indeterminate number of pass/fails
# for each run (it runs a small group of tests until
# it's timer kicks off). This is very bad for nightly
# automated regression testing.
#
# * It tries to "step" from withint he prologue of a
# function. This isn't support in gdb (it's going
# to act like a continue).
#
# * This test rarely check that it stopped in sensible
# places. (see previous bullet -- this test doesn't
# catch the fact it continued rather than stepped)
if $tracelevel then {
strace $tracelevel
}
set program_exited 0
proc set_bp { where } {
global prompt
send_gdb "break $where\n"
# The first regexp is what we get with -g, the second without -g.
expect {
-re "Break.* at .*: file .*, line \[0-9\]*.*$prompt $" {}
-re "Breakpoint \[0-9\]* at 0x\[0-9a-f\]*.*$prompt $" {}
-re "$prompt $" { fail "setting breakpoint at $where" ; return 0 }
timeout { fail "setting breakpoint at $where (timeout)" ; return 0 }
}
pass "set_bp"
}
proc step_it { cmd } {
global prompt
global program_exited
send_gdb "$cmd\n"
expect {
-re "0x\[0-9A-Fa-f\]* *in.*\r\n$prompt $" { pass "step_it"; return 0 }
-re "0x\[0-9A-Fa-f\]* *\[0-9\]*.*\r\n$prompt $" { pass "step_it"; return 1 }
-re "Program exited .*\n$prompt $" {
set program_exited 1
return -1
}
-re "$prompt $" { fail "single-stepping ($cmd).\n" ; return -1 }
timeout { fail "single-stepping ($cmd) timout.\n" ; return -1 }
}
}
proc step_inst {} {
step_it "stepi"
}
proc step_source {} {
step_it "step"
}
proc continue_all {} {
global prompt
send_gdb "continue\n"
expect {
-re "Breakpoint \[0-9\]*, thread\[0-9\]* .*$prompt $" {
pass "continue_all"
return 0
}
-re "Program exited .*\n$prompt $" {
set program_exited 1
return 1;
}
-re "$prompt $" { fail "continue" ; return -1 }
timeout { fail "continue (timeout)" ; return -1 }
}
}
proc check_threads { num_threads } {
global prompt
set curr_thread 0
send_gdb "info threads\n"
while { $num_threads > 0 } {
expect {
-re "\\* *\[0-9\]* process \[0-9\]* thread \[0-9\]* .*\n" {
incr curr_thread
set num_threads [expr $num_threads - 1]
}
-re " *\[0-9\]* process \[0-9\]* thread \[0-9\]* .*\n" {
set num_threads [expr $num_threads - 1]
}
-re "$prompt $" {
if { $num_threads < 0 } {
fail "check_threads (too many)" ; return -1
}
break
}
timeout { fail "check_threads (timeout)" ; return -1 }
}
}
if { $curr_thread == 0 } {
fail "check_threads (no current thread)\n"
return -1
}
if { $curr_thread > 1 } {
fail "check_threads (more than one current thread)\n"
return -1
}
return 0
}
proc test_cond_wait {} {
global program_exited
set_bp 135
runto 179
while { 1 } {
set stepi_counter 0
while { [step_inst] } {
if { $program_exited } { break }
incr stepi_counter
if { $stepi_counter > 30 } {
fail "too many stepi's per line\n"
return -1
}
}
if { $program_exited } { break }
step_source
if { $program_exited } { break }
continue_all
if { $program_exited } { break }
check_threads 3
}
}
proc do_tests {} {
global prms_id
global bug_id
global subdir
global objdir
global srcdir
global binfile
global prompt
set prms_id 0
set bug_id 0
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
send_gdb "set width 0\n"
expect -re "$prompt $"
test_cond_wait
}
# Check to see if we have an executable to test. If not, then either we
# haven't tried to compile one, or the compilation failed for some reason.
# In either case, just notify the user and skip the tests in this file.
set binfile "step"
set srcfile "step.c"
if ![file exists $objdir/$subdir/$binfile] then {
if $all_flag then {
warning "$binfile does not exist; tests suppressed."
}
} else {
do_tests
}

@ -0,0 +1,150 @@
# step2.exp -- Expect script to test gdb step.c
# Copyright (C) 1992 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 Jeff Law. (law@cygnus.com)
#
if $tracelevel then {
strace $tracelevel
}
set program_exited 0
# A simple and crude test to see that we can step two threads independently
proc test_multi_threaded_stepping {} {
global prompt
global hex
global srcfile
global decimal
# Set breakpoints in code that we know is executed in only
# thread of control.
gdb_test "break thread1" \
"Break.* at $hex: file .*$srcfile, line $decimal\\."
gdb_test "break thread2" \
"Break.* at $hex: file .*$srcfile, line $decimal\\."
# the order in which things happen is indeterminate. So we basically
# look for a set of events and note that each one happens and that
# all of the required events have happened when we're done.
#
# Right now we only verify that both threads start and that they
# both call pthread_cond_wait twice.
set thread1started 0
set thread1condwait 0
set thread2started 0
set thread2condwait 0
send_gdb "run\n"
expect {
-re "The program .* has been started already.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-re ".*Breakpoint \[0-9\]+,.*thread1.* at .*$srcfile:.*\[\t \].*$prompt $" {
if { $thread1started != 0 } then {
fail "thread1 started"
return
} else {
set thread1started 1
pass "thread1 started"
}
send_gdb "step\n"
exp_continue
}
-re ".*Breakpoint \[0-9\]+,.*thread2.* at .*$srcfile:.*\[\t \].*$prompt $" {
if { $thread2started != 0 } then {
fail "thread2 started"
return
} else {
set thread2started 1
pass "thread2 started"
}
send_gdb "step\n"
exp_continue
}
-re ".*pthread_cond_wait.*cv_a.*$prompt" {
if { $thread1started == 0 } then {
fail "thread1 condwait"
return
}
if { $thread1condwait < 2 } then {
pass "thread1 condwait"
incr thread1condwait
}
if { $thread2condwait == 2 } then {
pass "multi threaded stepping"
return
}
send_gdb "step\n"
exp_continue
}
-re ".*pthread_cond_wait.*cv_b.*$prompt" {
if { $thread2started == 0 } then {
fail "thread2 condwait"
return
}
if { $thread2condwait < 2 } then {
pass "thread2 condwait"
incr thread2condwait
}
if { $thread1condwait == 2 } then {
pass "multi threaded stepping"
return
}
send_gdb "step\n"
exp_continue
}
-re "$prompt" {
send_gdb "step\n"
exp_continue
}
default { fail "multi threaded stepping" }
}
}
# Check to see if we have an executable to test. If not, then either we
# haven't tried to compile one, or the compilation failed for some reason.
# In either case, just notify the user and skip the tests in this file.
set binfile "step"
set srcfile "step.c"
if ![file exists $objdir/$subdir/$binfile] then {
if $all_flag then {
warning "$binfile does not exist; tests suppressed."
}
return
}
set prms_id 0
set bug_id 0
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
test_multi_threaded_stepping

@ -26,21 +26,9 @@
load_lib libgloss.exp
global GDB
global CC
global CXX
global CFLAGS
global CXXFLAGS
global CHILL_LIB
global CHILL_RT0
if ![info exists CC] {
set CC [findfile $base_dir/../../gcc/xgcc "$base_dir/../../gcc/xgcc -B$base_dir/../../gcc/" [transform gcc]]
}
verbose "using CC = $CC" 2
if ![info exists CXX] {
set CXX [findfile $base_dir/../../gcc/xgcc "$base_dir/../../gcc/xgcc -B$base_dir/../../gcc/" [transform g++]]
}
verbose "using CXX = $CXX" 2
if ![info exists CHILL_LIB] {
set CHILL_LIB [findfile $base_dir/../../gcc/ch/runtime/libchill.a "$base_dir/../../gcc/ch/runtime/libchill.a" [transform -lchill]]
}
@ -50,21 +38,17 @@ if ![info exists CHILL_RT0] {
}
verbose "using CHILL_RT0 = $CHILL_RT0" 2
if ![info exists LDFLAGS] {
if [is3way] {
append LDFLAGS " [libgloss_flags] [newlib_flags]"
if ![info exists GDB] {
if ![is_remote host] {
set GDB [findfile $base_dir/../../gdb/gdb "$base_dir/../../gdb/gdb" [transform gdb]]
} else {
set GDB gdb
}
set LDFLAGS ""
}
verbose "using LDFLAGS = $LDFLAGS" 2
if ![info exists GDB] then {
set GDB [findfile $base_dir/../../gdb/gdb "$base_dir/../../gdb/gdb" [transform gdb]]
}
verbose "using GDB = $GDB" 2
global GDBFLAGS
if ![info exists GDBFLAGS] then {
if ![info exists GDBFLAGS] {
set GDBFLAGS "-nx"
}
verbose "using GDBFLAGS = $GDBFLAGS" 2
@ -73,14 +57,7 @@ verbose "using GDBFLAGS = $GDBFLAGS" 2
# is not already set.
global prompt
if ![info exists prompt] then {
set prompt "\\(gdb\\)"
}
global usestubs
if [istarget "sparclite-*-*"] then {
set usestubs 1
} else {
set usestubs 0
set prompt "\[(\]gdb\[)\]"
}
if ![info exists noargs] then {
@ -105,15 +82,28 @@ if ![info exists noresults] then {
proc default_gdb_version {} {
global GDB
global GDBFLAGS
if {[which $GDB] != 0} then {
set tmp [exec echo "q" | $GDB -nw $GDBFLAGS]
regexp " \[0-9\]\[^ \t\n\]+" $tmp version
clone_output "[which $GDB] version$version -nw $GDBFLAGS \n"
global prompt
set fileid [open "gdb_cmd" w];
puts $fileid "q";
close $fileid;
set cmdfile [remote_download host "gdb_cmd"];
set output [remote_exec host "$GDB -nw --command $cmdfile"]
remote_file build delete "gdb_cmd";
remote_file host delete "$cmdfile";
set tmp [lindex $output 1];
set version ""
regexp " \[0-9\]\[^ \t\n\r\]+" "$tmp" version
if ![is_remote host] {
clone_output "[which $GDB] version $version $GDBFLAGS\n"
} else {
warning "$GDB does not exist"
clone_output "$GDB on remote host version $version $GDBFLAGS\n"
}
}
proc gdb_version { } {
return [default_gdb_version];
}
#
# gdb_unload -- unload a file if one is loaded
#
@ -122,17 +112,17 @@ proc gdb_unload {} {
global verbose
global GDB
global prompt
send "file\n"
send_gdb "file\n"
expect {
-re "No exec file now.*\r" { exp_continue }
-re "No symbol file now.*\r" { exp_continue }
-re "A program is being debugged already..*Kill it.*y or n. $"\
{ send "y\n"
{ send_gdb "y\n"
verbose "\t\tKilling previous program being debugged"
exp_continue
}
-re "Discard symbol table from .*y or n. $" {
send "y\n"
send_gdb "y\n"
exp_continue
}
-re "$prompt $" {}
@ -151,23 +141,27 @@ proc gdb_unload {} {
proc delete_breakpoints {} {
global prompt
global gdb_spawn_id
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.*y or n.*$" {
send_gdb "y\n";
exp_continue
}
-re "y\r\n$prompt $" {}
-re ".*$prompt $" { # This happens if there were no breakpoints
-i $gdb_spawn_id -re ".*$prompt $" { # This happens if there were no breakpoints
}
timeout { perror "Delete all breakpoints (timeout)" ; return }
-i $gdb_spawn_id timeout { perror "Delete all breakpoints in delete_breakpoints (timeout)" ; return }
}
send "info breakpoints\n"
send_gdb "info breakpoints\n"
expect {
-re "No breakpoints or watchpoints..*$prompt $" {}
-re ".*$prompt $" { perror "breakpoints not deleted" ; return }
timeout { perror "info breakpoints (timeout)" ; return }
-i $gdb_spawn_id -re "No breakpoints or watchpoints..*$prompt $" {}
-i $gdb_spawn_id -re ".*$prompt $" { perror "breakpoints not deleted" ; return }
-i $gdb_spawn_id -re "Delete all breakpoints.*or n.*$" {
send_gdb "y\n";
exp_continue
}
-i $gdb_spawn_id timeout { perror "info breakpoints (timeout)" ; return }
}
}
@ -179,35 +173,60 @@ proc delete_breakpoints {} {
# Using ``.*$'' could swallow up output that we attempt to match
# elsewhere.
#
proc gdb_run_cmd {} {
global usestubs
proc gdb_run_cmd {args} {
global prompt
global gdb_spawn_id
if $usestubs!=0 {
send "jump *start\n"
set spawn_id $gdb_spawn_id
if [target_info exists use_gdb_stub] {
send_gdb "jump *start\n"
expect {
-re "Line.* Jump anyway.*y or n. $" {
send "y\n"
send_gdb "y\n"
expect {
-re "Continuing.*$prompt $" {}
timeout { perror "Jump to start() failed (timeout)"; return }
}
}
-re "No symbol.*context.*$prompt $" {}
-re "The program is not being run.*$prompt $" {
gdb_load "";
}
timeout { perror "Jump to start() failed (timeout)"; return }
}
send "continue\n"
send_gdb "continue\n"
return
}
send "run\n"
send_gdb "run $args\n"
# This doesn't work quite right yet.
expect {
-re "The program .* has been started already.*y or n. $" {
send "y\n"
send_gdb "y\n"
exp_continue
}
-re "Starting program: \[^\n\]*" {}
}
}
proc gdb_breakpoint { function } {
global prompt
global decimal
global gdb_spawn_id
set spawn_id $gdb_spawn_id
send_gdb "break $function\n"
# The first two regexps are what we get with -g, the third is without -g.
expect {
-re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$prompt $" {}
-re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$prompt $" {}
-re "Breakpoint \[0-9\]* at .*$prompt $" {}
-re "$prompt $" { fail "setting breakpoint at $function" ; return 0 }
timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
}
return 1;
}
# Set breakpoint at function and run gdb until it breaks there.
# Since this is the only breakpoint that will be set, if it stops
@ -218,28 +237,14 @@ proc gdb_run_cmd {} {
proc runto { function } {
global prompt
global decimal
global gdb_spawn_id
send "delete\n"
expect {
-re "delete.*Delete all breakpoints.*y or n. $" {
send "y\n"
expect {
-re "$prompt $" {}
timeout { fail "deleting breakpoints (timeout)" ; return 0 }
}
}
-re ".*$prompt $" {}
timeout { fail "deleting breakpoints (timeout)" ; return 0 }
}
set spawn_id $gdb_spawn_id
send "break $function\n"
# The first two regexps are what we get with -g, the third is without -g.
expect {
-re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$prompt $" {}
-re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$prompt $" {}
-re "Breakpoint \[0-9\]* at .*$prompt $" {}
-re "$prompt $" { fail "setting breakpoint at $function" ; return 0 }
timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
delete_breakpoints
if ![gdb_breakpoint $function] {
return 0;
}
gdb_run_cmd
@ -254,61 +259,53 @@ proc runto { function } {
return 1
}
-re "$prompt $" {
fail "running to $function"
fail "running to $function in runto"
return 0
}
timeout {
fail "running to $function (timeout)"
fail "running to $function in runto (timeout)"
return 0
}
}
}
#
# runto_main -- ask gdb to run and untill hit break point at main.
# if it uses stubs, assuming we hit breakpoint() and just
# step out of the function.
# runto_main -- ask gdb to run until we hit a breakpoint at main.
# The case where the target uses stubs has to be handled
# specially--if it uses stubs, assuming we hit
# breakpoint() and just step out of the function.
#
proc runto_main {} {
global prompt
global decimal
global usestubs
if $usestubs==0 {
if ![target_info exists gdb_stub] {
return [runto main]
}
send "delete\n"
expect {
-re "delete.*Delete all breakpoints.*y or n. $" {
send "y\n"
expect {
-re "$prompt $" {}
timeout { fail "deleting breakpoints (timeout)" ; return 0 }
}
}
-re ".*$prompt $" {}
timeout { fail "deleting breakpoints (timeout)" ; return 0 }
}
delete_breakpoints
send "step\n"
send_gdb "step\n"
# if use stubs step out of the breakpoint() function.
expect {
-re "main.* at .*$prompt $" {}
-re "_start.*$prompt $" {}
timeout { fail "single step at breakpoint() (timeout)" ; return 0 }
}
return 1
}
#
# gdb_test -- send a command to gdb and test the result.
# gdb_test -- send_gdb a command to gdb and test the result.
# Takes three parameters.
# Parameters:
# First one is the command to execute,
# First one is the command to execute. If this is the null string
# then no command is sent.
# Second one is the pattern to match for a PASS, and must NOT include
# the \r\n sequence immediately before the gdb prompt.
# Third one is an optional message to be printed. If this
# a null string "", then the pass/fail messages are not printed.
# a null string "", then the pass/fail messages use the command
# string as the message.
# Returns:
# 1 if the test failed,
# 0 if the test passes,
@ -318,11 +315,10 @@ proc gdb_test { args } {
global verbose
global prompt
global GDB
global spawn_id
global expect_out
upvar timeout timeout
if [llength $args]==3 then {
if [llength $args]>2 then {
set message [lindex $args 2]
} else {
set message [lindex $args 0]
@ -330,6 +326,13 @@ proc gdb_test { args } {
set command [lindex $args 0]
set pattern [lindex $args 1]
if [llength $args]==5 {
set question_string [lindex $args 3];
set response_string [lindex $args 4];
} else {
set question_string "^FOOBAR$"
}
if $verbose>2 then {
send_user "Sending \"$command\" to gdb\n"
send_user "Looking to match \"$pattern\"\n"
@ -338,7 +341,7 @@ proc gdb_test { args } {
set result -1
if ![string match $command ""] {
send "$command\n"
send_gdb "$command\n"
}
expect {
@ -350,12 +353,16 @@ proc gdb_test { args } {
gdb_start
set result -1
}
-re "$pattern\r\n$prompt $" {
-re "\[\r\n\]*$pattern\[\r\n\]+$prompt $" {
if ![string match "" $message] then {
pass "$message"
}
set result 0
}
-re "${question_string}$" {
send_gdb "$response_string\n";
exp_continue;
}
-re "Undefined command:.*$prompt" {
perror "Undefined command \"$command\"."
set result 1
@ -364,13 +371,13 @@ proc gdb_test { args } {
perror "\"$command\" is not a unique command name."
set result 1
}
-re "(.*)(Program exited with code \[0-9\]+)(.*$prompt $)" {
-re ".*Program exited with code \[0-9\]+.*$prompt $" {
if ![string match "" $message] then {
set errmsg "$message: $expect_out(2,string)"
set errmsg "$message: the program exited"
} else {
set errmsg "$command: $expect_out(2,string)"
set errmsg "$command: the program exited"
}
perror "$errmsg"
fail "$errmsg"
return -1
}
-re "The program is not being run.*$prompt $" {
@ -379,7 +386,7 @@ proc gdb_test { args } {
} else {
set errmsg "$command: the program is no longer running"
}
perror "$errmsg"
fail "$errmsg"
return -1
}
-re ".*$prompt $" {
@ -389,11 +396,11 @@ proc gdb_test { args } {
set result 1
}
"<return>" {
send "\n"
send_gdb "\n"
perror "Window too small."
}
-re "\\(y or n\\) " {
send "n\n"
send_gdb "n\n"
perror "Got interactive prompt."
}
eof {
@ -433,7 +440,7 @@ proc test_print_reject { args } {
send_user "Sending \"$sendthis\" to gdb\n"
send_user "Looking to match \"$expectthis\"\n"
}
send "$sendthis\n"
send_gdb "$sendthis\n"
expect {
-re ".*A .* in expression.*\\.*$prompt $" {
pass "reject $sendthis"
@ -494,7 +501,20 @@ proc gdb_test_exact { args } {
upvar timeout timeout
set command [lindex $args 0]
set pattern [string_to_regexp [lindex $args 1]]
# This applies a special meaning to a null string pattern. Without
# this, "$pattern\r\n$prompt $" will match anything, including error
# messages from commands that should have no output except a new
# prompt. With this, only results of a null string will match a null
# string pattern.
set pattern [lindex $args 1]
if [string match $pattern ""] {
set pattern [string_to_regexp [lindex $args 0]]
} else {
set pattern [string_to_regexp [lindex $args 1]]
}
# It is most natural to write the pattern argument with only
# embedded \n's, especially if you are trying to avoid Tcl quoting
# problems. But expect really wants to see \r\n in patterns. So
@ -507,19 +527,25 @@ proc gdb_test_exact { args } {
} else {
set message $command
}
return [gdb_test $command $pattern $message]
}
proc gdb_reinitialize_dir { subdir } {
global prompt
global gdb_spawn_id
set spawn_id $gdb_spawn_id
send "dir\n"
if [is_remote host] {
return "";
}
send_gdb "dir\n"
expect {
-re "Reinitialize source path to empty.*y or n. " {
send "y\n"
send_gdb "y\n"
expect {
-re "Source directories searched.*$prompt $" {
send "dir $subdir\n"
send_gdb "dir $subdir\n"
expect {
-re "Source directories searched.*$prompt $" {
verbose "Dir set to $subdir"
@ -547,6 +573,11 @@ proc default_gdb_exit {} {
global GDB
global GDBFLAGS
global verbose
global gdb_spawn_id
if ![info exists gdb_spawn_id] {
return;
}
verbose "Quitting $GDB $GDBFLAGS"
@ -554,13 +585,27 @@ proc default_gdb_exit {} {
set timeout 5
verbose "Timeout is now $timeout seconds" 2
# We used to try to send "quit" to GDB, and wait for it to die.
# Dealing with all the cases and errors got pretty hairy. Just close it,
# that is simpler.
close
if [is_remote host] {
send_gdb "quit\n";
expect {
-i $gdb_spawn_id -re ".*and kill it.*y or n. " {
send_gdb "y\n";
exp_continue;
}
-i $gdb_spawn_id timeout { }
}
remote_close host;
} else {
# We used to try to send_gdb "quit" to GDB, and wait for it to die.
# Dealing with all the cases and errors got pretty hairy. Just close it,
# that is simpler.
close -i $gdb_spawn_id
# Omitting this probably would cause strange timing-dependent failures.
wait
# Omitting this probably would cause strange timing-dependent failures.
wait -i $gdb_spawn_id
}
unset gdb_spawn_id
}
#
@ -573,10 +618,19 @@ proc gdb_file_cmd { arg } {
global loadfile
global GDB
global prompt
global spawn_id
upvar timeout timeout
global gdb_spawn_id
set spawn_id $gdb_spawn_id
send "file $arg\n"
if [is_remote host] {
set arg [remote_download host $arg];
if { $arg == "" } {
error "download failed"
return -1;
}
}
send_gdb "file $arg\n"
expect {
-re "Reading symbols from.*done.*$prompt $" {
verbose "\t\tLoaded $arg into the $GDB"
@ -587,12 +641,12 @@ proc gdb_file_cmd { arg } {
return -1
}
-re "A program is being debugged already.*Kill it.*y or n. $" {
send "y\n"
send_gdb "y\n"
verbose "\t\tKilling previous program being debugged"
exp_continue
}
-re "Load new symbol table from \".*\".*y or n. $" {
send "y\n"
send_gdb "y\n"
expect {
-re "Reading symbols from.*done.*$prompt $" {
verbose "\t\tLoaded $arg with new symbol table into $GDB"
@ -639,30 +693,40 @@ proc default_gdb_start { } {
global GDB
global GDBFLAGS
global prompt
global spawn_id
global timeout
global gdb_spawn_id
global spawn_id
verbose "Spawning $GDB -nw $GDBFLAGS"
if { [which $GDB] == 0 } then {
perror "$GDB does not exist."
exit 1
if [info exists gdb_spawn_id] {
return 0;
}
set oldtimeout $timeout
set timeout [expr "$timeout + 180"]
verbose "Timeout increased to $timeout seconds" 2
eval "spawn $GDB -nw $GDBFLAGS"
if [is_remote host] {
set shell_id [remote_spawn host "$GDB -nw $GDBFLAGS --command gdbinit"]
} else {
if { [which $GDB] == 0 } then {
perror "$GDB does not exist."
exit 1
}
set shell_id [remote_spawn host "$GDB -nw $GDBFLAGS"]
}
verbose $shell_id
set timeout 10
expect {
-re ".*\r\n$prompt $" {
-i $shell_id -re ".*\[\r\n\]$prompt $" {
verbose "GDB initialized."
}
-re "$prompt $" {
-i $shell_id -re "$prompt $" {
perror "GDB never initialized."
set timeout $oldtimeout
verbose "Timeout restored to $timeout seconds" 2
return -1
}
timeout {
-i $shell_id timeout {
perror "(timeout) GDB never initialized after $timeout seconds."
set timeout $oldtimeout
verbose "Timeout restored to $timeout seconds" 2
@ -671,32 +735,35 @@ proc default_gdb_start { } {
}
set timeout $oldtimeout
verbose "Timeout restored to $timeout seconds" 2
set gdb_spawn_id $shell_id
set spawn_id $gdb_spawn_id
# force the height to "unlimited", so no pagers get used
send "set height 0\n"
send_gdb "set height 0\n"
expect {
-re ".*$prompt $" {
-i $shell_id -re ".*$prompt $" {
verbose "Setting height to 0." 2
}
timeout {
warning "Couldn't set the height to 0."
-i $shell_id timeout {
warning "Couldn't set the height to 0"
}
}
# force the width to "unlimited", so no wraparound occurs
send "set width 0\n"
send_gdb "set width 0\n"
expect {
-re ".*$prompt $" {
-i $shell_id -re ".*$prompt $" {
verbose "Setting width to 0." 2
}
timeout {
-i $shell_id timeout {
warning "Couldn't set the width to 0."
}
}
return 0;
}
#
# FIXME: this is a copy of the new library procedure, but it's here too
# till the new dejagnu gets installed everywhere. I'd hate to break the
# gdb tests suite.
# gdb testsuite.
#
global argv0
if ![info exists argv0] then {
@ -717,7 +784,74 @@ if ![info exists argv0] then {
# chill target at the moment, don't run the chill tests.
proc skip_chill_tests {} {
eval set skip_chill [expr ![isnative] || [istarget "*-*-aix*"] || [istarget "*-*-irix5*"] || [istarget "alpha-*-osf*"] || [istarget "hppa*-*-*"]]
if ![info exists do_chill_tests] {
return 1;
}
eval set skip_chill [expr ![isnative] || [istarget "*-*-aix*"] || [istarget "*-*-irix5*"] || [istarget "*-*-irix6*"] || [istarget "alpha-*-osf*"] || [istarget "hppa*-*-*"]]
verbose "Skip chill tests is $skip_chill"
return $skip_chill
}
proc get_compiler_info {binfile} {
# Create and source the file that provides information about the compiler
# used to compile the test case.
global srcdir
global subdir
# These two come from compiler.c.
global signed_keyword_not_used
global gcc_compiled
if { [gdb_compile "${srcdir}/${subdir}/compiler.c" "${binfile}.ci" preprocess {}] != "" } {
perror "Couldn't make ${binfile}.ci file"
return 1;
}
source ${binfile}.ci
return 0;
}
proc gdb_compile {source dest type options} {
if [target_info exists gdb_stub] {
set options2 { "additional_flags=-Dusestubs" }
lappend options "libs=[target_info gdb_stub]";
set options [concat $options2 $options]
}
verbose "options are $options"
verbose "source is $source $dest $type $options"
set result [target_compile $source $dest $type $options];
regsub "\[\r\n\]*$" "$result" "" result;
regsub "^\[\r\n\]*" "$result" "" result;
if { $result != "" } {
clone_output "gdb compile failed, $result"
}
return $result;
}
proc send_gdb { string } {
return [remote_send host "$string"];
}
proc gdb_start { } {
default_gdb_start
}
proc gdb_exit { } {
catch default_gdb_exit
}
#
# gdb_load -- load a file into the debugger.
# return a -1 if anything goes wrong.
#
proc gdb_load { arg } {
return [gdb_file_cmd $arg]
}
proc gdb_continue { function } {
global decimal
return [gdb_test "continue" ".*Breakpoint $decimal, $function .*" "continue to $function"];
}
proc gdb_finish { } {
gdb_exit;
}

@ -13,7 +13,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.
#
# Written by Jeffrey Wheat (cassidy@cygnus.com)
# Rewritten by Ian Lance Taylor (ian@cygnus.com)
@ -29,9 +29,15 @@ if ![isnative] {
return
}
if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
|| ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
|| ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
if { [which $CXX] == 0 } {
untested $test1
untested $test2
return
}
if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
|| ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
|| ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
unresolved $test1
unresolved $test2
return
@ -48,9 +54,9 @@ if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/c
verbose "$exec_output" 1
fail $test1
} else {
send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
send_log "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat\n"
verbose "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat"
catch "exec diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" exec_output
set exec_output [prune_system_crud $host_triplet $exec_output]
if [string match "" $exec_output] then {
@ -77,9 +83,9 @@ if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.
verbose "$exec_output" 1
fail $test2
} else {
send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
send_log "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat\n"
verbose "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat"
catch "exec diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" exec_output
set exec_output [prune_system_crud $host_triplet $exec_output]
if [string match "" $exec_output] then {

@ -38,15 +38,15 @@ if { [which $CC] == 0 } {
# (by experimentation) to force the linker to relax twice--that is,
# the first relaxation pass will force another call to be out of
# range, requiring a second relaxation pass.
if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax1.c tmpdir/relax1.o]
|| ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax2.c tmpdir/relax2.o]
|| ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax3.c tmpdir/relax3.o]
|| ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax4.c tmpdir/relax4.o] } {
if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax1.c tmpdir/relax1.o]
|| ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax2.c tmpdir/relax2.o]
|| ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax3.c tmpdir/relax3.o]
|| ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax4.c tmpdir/relax4.o] } {
unresolved $testname
return
}
if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/relax1.o tmpdir/relax2.o tmpdir/relax3.o tmpdir/relax4.o"] {
if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir/$subdir/relax.t tmpdir/relax1.o tmpdir/relax2.o tmpdir/relax3.o tmpdir/relax4.o"] {
fail $testname
} else {
# Check that the relaxation produced the correct result. Check
@ -227,9 +227,9 @@ set testname "run embedded PIC code"
# Compile the program which will run the test. This code must be
# compiled for the host, not the target.
send_log "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c\n"
verbose "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c"
catch "exec $CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c" exec_output
send_log "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c\n"
verbose "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c"
catch "exec $CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c" exec_output
if ![string match "" $exec_output] {
send_log "$exec_output\n"
verbose "$exec_output"
@ -238,9 +238,9 @@ if ![string match "" $exec_output] {
}
# Compile and link the test.
if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtesti.s tmpdir/runtesti.o]
|| ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtest1.c tmpdir/runtest1.o]
|| ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtest2.c tmpdir/runtest2.o] } {
if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtesti.s tmpdir/runtesti.o]
|| ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest1.c tmpdir/runtest1.o]
|| ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest2.c tmpdir/runtest2.o] } {
unresolved $testname
return
}

143
ld/testsuite/ld-sh/sh.exp Normal file

@ -0,0 +1,143 @@
# Expect script for ld-sh tests
# Copyright (C) 1995, 1996 Free Software Foundation
#
# This file 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.
#
# Written by Ian Lance Taylor (ian@cygnus.com)
#
# Test SH relaxing. This tests the compiler and assembler as well as
# the linker.
if ![istarget sh*-*-*] {
return
}
set testsimple "SH simple relaxing"
if ![ld_assemble $as "-relax $srcdir/$subdir/sh1.s" tmpdir/sh1.o] {
unresolved $testsimple
} else { if ![ld_simple_link $ld tmpdir/sh1 "-relax tmpdir/sh1.o"] {
fail $testsimple
} else {
if ![ld_nm $nm tmpdir/sh1] {
unresolved $testsimple
} else {
if {![info exists nm_output(bar)] \
|| ![info exists nm_output(foo)]} {
send_log "bad output from nm\n"
verbose "bad output from nm"
fail $testsimple
} else {
if {$nm_output(bar) != $nm_output(foo) + 4} {
send_log "foo == $nm_output(foo)\n"
verbose "foo == $nm_output(foo)"
send_log "bar == $nm_output(bar)\n"
verbose "bar == $nm_output(bar)"
fail $testsimple
} else {
pass $testsimple
}
}
}
} }
set testsrec "SH relaxing to S-records"
if ![ld_simple_link $ld tmpdir/sh1.s1 "-relax -oformat srec tmpdir/sh1.o"] {
fail $testsrec
} else {
# The file name is embedded in the S-records, so create both
# files with the same name.
catch "exec rm -f tmpdir/sh1.s2" exec_output
send_log "mv tmpdir/sh1.s1 tmpdir/sh1.s2\n"
verbose "mv tmpdir/sh1.s1 tmpdir/sh1.s2"
catch "exec mv tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
if ![string match "" $exec_output] {
send_log "$exec_output\n"
verbose "$exec_output"
unresolved $testsrec
} else {
send_log "$objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1"
verbose "$objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1"
catch "exec $objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1" exec_output
if ![string match "" $exec_output] {
send_log "$exec_output\n"
verbose "$exec_output"
unresolved $testsrec
} else {
send_log "cmp tmpdir/sh1.s1 tmpdir/sh1.s2\n"
verbose "cmp tmpdir/sh1.s1 tmpdir/sh1.s2"
catch "exec cmp tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
set exec_output [prune_system_crud $host_triplet $exec_output]
if ![string match "" $exec_output] {
send_log "$exec_output\n"
verbose "$exec_output"
fail $testsrec
} else {
pass $testsrec
}
}
}
}
set testlink "SH relaxing"
set testjsr "SH confirm relaxing"
set testrun "SH relaxing execution"
if { [which $CC] == 0 } {
untested $testlink
untested $testjsr
untested $testrun
return
}
if {![ld_assemble $as "-relax $srcdir/$subdir/start.s" tmpdir/start.o] \
|| ![ld_compile $CC "-O -mrelax $srcdir/$subdir/sh2.c" tmpdir/sh2.o]} {
unresolved $testlink
unresolved $testjsr
unresolved $testrun
return
}
if ![ld_simple_link $ld tmpdir/sh2 "-relax tmpdir/start.o tmpdir/sh2.o"] {
fail $testlink
unresolved $testjsr
unresolved $testrun
return
}
pass $testlink
send_log "$objdump -d tmpdir/sh2\n"
verbose "$objdump -d tmpdir/sh2"
catch "exec $objdump -d tmpdir/sh2" exec_output
if [string match "*jsr*" $exec_output] {
fail $testjsr
} else {
pass $testjsr
}
if { ![info exists SIM] || [which $SIM] == 0 } {
untested $testrun
return
}
set status [catch "exec $SIM tmpdir/sh2" exec_output]
if { $status == 0 } {
pass $testrun
} else {
fail $testrun
}

@ -124,9 +124,9 @@ proc default_ld_compile { cc source object } {
catch "exec rm -f $object" exec_output
verbose -log "$cc -I$srcdir$subdir -c $CFLAGS $source -o $object"
verbose -log "$cc -I$srcdir/$subdir -c $CFLAGS $source -o $object"
catch "exec $cc -I$srcdir$subdir -c $CFLAGS $source -o $object" exec_output
catch "exec $cc -I$srcdir/$subdir -c $CFLAGS $source -o $object" exec_output
set exec_output [prune_system_crud $host_triplet $exec_output]
if [string match "" $exec_output] then {
if {![file exists $object]} then {