* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
1995-01-20 22:26:33 +00:00
|
|
|
|
# Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
|
1993-02-21 20:03:55 +00:00
|
|
|
|
|
|
|
|
|
# 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
|
|
|
|
|
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
1993-08-30 23:08:02 +00:00
|
|
|
|
# bug-gdb@prep.ai.mit.edu
|
1993-02-21 20:03:55 +00:00
|
|
|
|
|
|
|
|
|
# This file was written by Fred Fish. (fnf@cygnus.com)
|
|
|
|
|
|
|
|
|
|
# Generic gdb subroutines that should work for any target. If these
|
|
|
|
|
# need to be modified for any target, it can be done with a variable
|
|
|
|
|
# or by passing arguments.
|
|
|
|
|
|
1994-01-11 05:09:44 +00:00
|
|
|
|
global GDB
|
|
|
|
|
if ![info exists GDB] then {
|
1995-02-17 00:00:53 +00:00
|
|
|
|
if [file exists $base_dir/../gdb] then {
|
|
|
|
|
set GDB $base_dir/../gdb
|
|
|
|
|
} else {
|
|
|
|
|
set GDB [transform gdb]
|
|
|
|
|
}
|
1994-01-11 05:09:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
global GDBFLAGS
|
1993-11-03 18:28:22 +00:00
|
|
|
|
if ![info exists GDBFLAGS] then {
|
1995-02-16 18:41:54 +00:00
|
|
|
|
set GDBFLAGS "-nx"
|
1993-11-03 18:28:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
1994-05-21 17:24:22 +00:00
|
|
|
|
# set the prompt if it doesn't exist
|
|
|
|
|
global prompt
|
|
|
|
|
if ![info exists prompt] then {
|
|
|
|
|
set prompt "\[(\]gdb\[)\]"
|
|
|
|
|
}
|
|
|
|
|
|
1993-08-30 23:12:28 +00:00
|
|
|
|
#
|
* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
1995-01-20 22:26:33 +00:00
|
|
|
|
# gdb_version -- extract and print the version number of GDB
|
1993-08-30 23:12:28 +00:00
|
|
|
|
#
|
|
|
|
|
proc default_gdb_version {} {
|
|
|
|
|
global GDB
|
|
|
|
|
global GDBFLAGS
|
|
|
|
|
if {[which $GDB] != 0} then {
|
1995-03-14 21:25:19 +00:00
|
|
|
|
set tmp [exec echo "q" | $GDB -nw $GDBFLAGS]
|
1993-11-03 18:28:22 +00:00
|
|
|
|
regexp " \[0-9\.\]+" $tmp version
|
* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
1995-01-20 22:26:33 +00:00
|
|
|
|
clone_output "[which $GDB] version$version -nw $GDBFLAGS \n"
|
1993-08-30 23:12:28 +00:00
|
|
|
|
} else {
|
|
|
|
|
warning "$GDB does not exist"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1993-02-21 20:03:55 +00:00
|
|
|
|
#
|
|
|
|
|
# gdb_unload -- unload a file if one is loaded
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
proc gdb_unload {} {
|
|
|
|
|
global verbose
|
|
|
|
|
global GDB
|
|
|
|
|
global prompt
|
|
|
|
|
send "file\n"
|
|
|
|
|
expect {
|
1994-01-11 05:09:44 +00:00
|
|
|
|
-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. $"\
|
1993-02-21 20:03:55 +00:00
|
|
|
|
{ send "y\n"
|
1993-11-03 18:28:22 +00:00
|
|
|
|
verbose "\t\tKilling previous program being debugged"
|
1994-01-11 05:09:44 +00:00
|
|
|
|
exp_continue
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
1994-01-11 05:09:44 +00:00
|
|
|
|
-re "Discard symbol table from .*y or n. $" {
|
1993-02-21 20:03:55 +00:00
|
|
|
|
send "y\n"
|
1994-01-11 05:09:44 +00:00
|
|
|
|
exp_continue
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
-re "$prompt $" {}
|
|
|
|
|
timeout {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
perror "couldn't unload file in $GDB (timed out)."
|
1993-08-30 23:08:02 +00:00
|
|
|
|
return -1
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Many of the tests depend on setting breakpoints at various places and
|
|
|
|
|
# running until that breakpoint is reached. At times, we want to start
|
|
|
|
|
# with a clean-slate with respect to breakpoints, so this utility proc
|
|
|
|
|
# lets us do this without duplicating this code everywhere.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
proc delete_breakpoints {} {
|
|
|
|
|
global prompt
|
|
|
|
|
|
|
|
|
|
send "delete breakpoints\n"
|
|
|
|
|
expect {
|
1994-01-11 05:09:44 +00:00
|
|
|
|
-re "Delete all breakpoints.*y or n. $" {
|
1993-02-21 20:03:55 +00:00
|
|
|
|
send "y\n"
|
1994-01-11 05:09:44 +00:00
|
|
|
|
exp_continue
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
-re "y\r\n$prompt $" {}
|
1994-06-07 16:04:40 +00:00
|
|
|
|
-re ".*$prompt $" { # This happens if there were no breakpoints
|
|
|
|
|
}
|
1994-05-17 22:06:15 +00:00
|
|
|
|
timeout { perror "Delete all breakpoints (timeout)" ; return }
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
send "info breakpoints\n"
|
|
|
|
|
expect {
|
|
|
|
|
-re "No breakpoints or watchpoints..*$prompt $" {}
|
1994-01-11 05:09:44 +00:00
|
|
|
|
-re ".*$prompt $" { perror "breakpoints not deleted" ; return }
|
1994-05-17 22:06:15 +00:00
|
|
|
|
timeout { perror "info breakpoints (timeout)" ; return }
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
1994-08-24 02:21:37 +00:00
|
|
|
|
# Generic run command.
|
1994-07-19 22:19:41 +00:00
|
|
|
|
#
|
1994-08-24 02:21:37 +00:00
|
|
|
|
# The second pattern below matches up to the first newline *only*.
|
|
|
|
|
# Using ``.*$'' could swallow up output that we attempt to match
|
|
|
|
|
# elsewhere.
|
1994-07-19 22:19:41 +00:00
|
|
|
|
#
|
|
|
|
|
proc gdb_run_cmd {} {
|
|
|
|
|
send "run\n"
|
|
|
|
|
expect {
|
|
|
|
|
-re "The program .* has been started already.*y or n. $" {
|
|
|
|
|
send "y\n"
|
|
|
|
|
exp_continue
|
|
|
|
|
}
|
1994-07-20 17:29:02 +00:00
|
|
|
|
-re "Starting program: \[^\n\]*" {}
|
1994-07-19 22:19:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1993-02-21 20:03:55 +00:00
|
|
|
|
# Set breakpoint at function and run gdb until it breaks there.
|
|
|
|
|
# Since this is the only breakpoint that will be set, if it stops
|
|
|
|
|
# at a breakpoint, we will assume it is the one we want. We can't
|
|
|
|
|
# just compare to "function" because it might be a fully qualified,
|
|
|
|
|
# single quoted C++ function specifier.
|
|
|
|
|
|
|
|
|
|
proc runto { function } {
|
|
|
|
|
global prompt
|
|
|
|
|
global decimal
|
|
|
|
|
|
|
|
|
|
send "delete\n"
|
|
|
|
|
expect {
|
1994-01-11 05:09:44 +00:00
|
|
|
|
-re "delete.*Delete all breakpoints.*y or n. $" {
|
1993-02-21 20:03:55 +00:00
|
|
|
|
send "y\n"
|
|
|
|
|
expect {
|
|
|
|
|
-re "$prompt $" {}
|
|
|
|
|
timeout { fail "deleting breakpoints (timeout)" ; return 0 }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
-re ".*$prompt $" {}
|
|
|
|
|
timeout { fail "deleting breakpoints (timeout)" ; return 0 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
send "break $function\n"
|
1994-07-19 17:33:52 +00:00
|
|
|
|
# The first two regexps are what we get with -g, the third is without -g.
|
1993-02-21 20:03:55 +00:00
|
|
|
|
expect {
|
* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
1995-01-20 22:26:33 +00:00
|
|
|
|
-re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$prompt $" {}
|
1994-07-19 17:33:52 +00:00
|
|
|
|
-re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$prompt $" {}
|
* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
1995-01-20 22:26:33 +00:00
|
|
|
|
-re "Breakpoint \[0-9\]* at .*$prompt $" {}
|
1993-02-21 20:03:55 +00:00
|
|
|
|
-re "$prompt $" { fail "setting breakpoint at $function" ; return 0 }
|
|
|
|
|
timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
|
|
|
|
|
}
|
|
|
|
|
|
1994-07-20 16:40:08 +00:00
|
|
|
|
gdb_run_cmd
|
|
|
|
|
|
1993-08-30 23:08:02 +00:00
|
|
|
|
# the "at foo.c:36" output we get with -g.
|
|
|
|
|
# the "in func" output we get without -g.
|
1994-07-20 01:03:24 +00:00
|
|
|
|
expect {
|
1994-07-20 16:40:08 +00:00
|
|
|
|
-re "Break.* at .*:$decimal.*$prompt $" {
|
|
|
|
|
return 1
|
1994-07-20 01:03:24 +00:00
|
|
|
|
}
|
1993-08-30 23:08:02 +00:00
|
|
|
|
-re "Breakpoint \[0-9\]*, \[0-9xa-f\]* in $function.*$prompt $" {
|
|
|
|
|
return 1
|
|
|
|
|
}
|
1994-07-20 16:40:08 +00:00
|
|
|
|
-re "$prompt $" {
|
|
|
|
|
fail "running to $function"
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
timeout {
|
|
|
|
|
fail "running to $function (timeout)"
|
|
|
|
|
return 0
|
|
|
|
|
}
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# gdb_test -- send a command to gdb and test the result.
|
|
|
|
|
# Takes three parameters.
|
|
|
|
|
# Parameters:
|
|
|
|
|
# First one is the command to execute,
|
|
|
|
|
# Second one is the pattern to match for a PASS,
|
|
|
|
|
# Third one is an optional message to be printed. If this
|
|
|
|
|
# a null string "", then the pass/fail messages are not printed.
|
|
|
|
|
# Returns:
|
|
|
|
|
# 1 if the test failed,
|
|
|
|
|
# 0 if the test passes,
|
|
|
|
|
# -1 if there was an internal error.
|
|
|
|
|
#
|
|
|
|
|
proc gdb_test { args } {
|
|
|
|
|
global verbose
|
|
|
|
|
global prompt
|
|
|
|
|
global GDB
|
|
|
|
|
global spawn_id
|
|
|
|
|
|
|
|
|
|
if [llength $args]==3 then {
|
|
|
|
|
set message [lindex $args 2]
|
|
|
|
|
} else {
|
|
|
|
|
set message [lindex $args 0]
|
|
|
|
|
}
|
|
|
|
|
set command [lindex $args 0]
|
|
|
|
|
set pattern [lindex $args 1]
|
|
|
|
|
|
|
|
|
|
if $verbose>2 then {
|
|
|
|
|
send_user "Sending \"$command\" to gdb\n"
|
|
|
|
|
send_user "Looking to match \"$pattern\"\n"
|
|
|
|
|
send_user "Message is \"$message\"\n"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set result -1
|
1994-08-24 02:21:37 +00:00
|
|
|
|
if ![string match $command ""] {
|
1995-02-16 18:41:54 +00:00
|
|
|
|
send "$command\n"
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
expect {
|
|
|
|
|
-re ".*Ending remote debugging.*$prompt$" {
|
|
|
|
|
if ![isnative] then {
|
|
|
|
|
warning "Can`t communicate to remote target."
|
|
|
|
|
}
|
|
|
|
|
gdb_exit
|
|
|
|
|
gdb_start
|
|
|
|
|
set result -1
|
|
|
|
|
}
|
1995-03-14 21:25:19 +00:00
|
|
|
|
-re "$pattern\r\n$prompt $" {
|
1993-02-21 20:03:55 +00:00
|
|
|
|
if ![string match "" $message] then {
|
|
|
|
|
pass "$message"
|
|
|
|
|
}
|
|
|
|
|
set result 0
|
|
|
|
|
}
|
|
|
|
|
-re "Undefined command:.*$prompt" {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
perror "Undefined command \"$command\"."
|
1993-08-30 23:08:02 +00:00
|
|
|
|
set result 1
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
-re "Ambiguous command.*$prompt $" {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
perror "\"$command\" is not a unique command name."
|
1993-08-30 23:08:02 +00:00
|
|
|
|
set result 1
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
-re ".*$prompt $" {
|
|
|
|
|
if ![string match "" $message] then {
|
|
|
|
|
fail "$message"
|
|
|
|
|
}
|
|
|
|
|
set result 1
|
|
|
|
|
}
|
|
|
|
|
"<return>" {
|
|
|
|
|
send "\n"
|
1993-11-03 18:28:22 +00:00
|
|
|
|
perror "Window too small."
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
1994-01-11 05:09:44 +00:00
|
|
|
|
-re "\[(\]+y or n\[)\]+ " {
|
1993-02-21 20:03:55 +00:00
|
|
|
|
send "n\n"
|
1993-11-03 18:28:22 +00:00
|
|
|
|
perror "Got interactive prompt."
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
1993-08-30 23:08:02 +00:00
|
|
|
|
eof {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
perror "Process no longer exists"
|
1993-08-30 23:08:02 +00:00
|
|
|
|
return -1
|
|
|
|
|
}
|
1993-02-21 20:03:55 +00:00
|
|
|
|
buffer_full {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
perror "internal buffer is full."
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
timeout {
|
1994-07-19 17:33:52 +00:00
|
|
|
|
if ![string match "" $message] then {
|
|
|
|
|
fail "(timeout) $message"
|
|
|
|
|
}
|
1993-02-21 20:03:55 +00:00
|
|
|
|
set result 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $result
|
|
|
|
|
}
|
* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
1995-01-20 22:26:33 +00:00
|
|
|
|
|
* gdb.base/printcmds.exp (test_character_literals_accepted): Test
printing of '\'' (which is what the comment says we are testing,
even though we were not), not '''.
(test_integer_literals_rejected): Test that printing ''' is an error.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp, gdb.base/printcmds.exp,
gdb.c++/cplusfuncs.exp, gdb.chill/callch.exp, gdb.chill/misc.exp,
gdb.chill/pr-6292.exp, gdb.chill/string.exp, gdb.chill/tuples.exp:
Use gdb_test not test_print_accept.
* lib/gdb.exp: Remove test_print_accept.
1995-03-15 21:23:14 +00:00
|
|
|
|
# Test that a command gives an error. For pass or fail, return
|
* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
1995-01-20 22:26:33 +00:00
|
|
|
|
# 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 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 $" {
|
|
|
|
|
pass "reject $sendthis"
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
-re ".*Invalid syntax in expression.*$prompt $" {
|
|
|
|
|
pass "reject $sendthis"
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
-re ".*Junk after end of expression.*$prompt $" {
|
|
|
|
|
pass "reject $sendthis"
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
-re ".*Invalid number.*$prompt $" {
|
|
|
|
|
pass "reject $sendthis"
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
-re ".*Invalid character constant.*$prompt $" {
|
|
|
|
|
pass "reject $sendthis"
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
-re ".*No symbol table is loaded.*$prompt $" {
|
|
|
|
|
pass "reject $sendthis"
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
-re ".*No symbol .* in current context.*$prompt $" {
|
|
|
|
|
pass "reject $sendthis"
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
-re ".*$expectthis.*$prompt $" {
|
|
|
|
|
pass "reject $sendthis"
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
-re ".*$prompt $" {
|
|
|
|
|
fail "reject $sendthis"
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
default {
|
|
|
|
|
fail "reject $sendthis (eof or timeout)"
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1994-06-02 23:02:00 +00:00
|
|
|
|
# Given an input string, adds backslashes as needed to create a
|
|
|
|
|
# regexp that will match the string.
|
1994-07-19 17:33:52 +00:00
|
|
|
|
|
1994-06-02 23:02:00 +00:00
|
|
|
|
proc string_to_regexp {str} {
|
1994-07-19 17:33:52 +00:00
|
|
|
|
set result $str
|
|
|
|
|
regsub -all {[]*+.|()^$\[]} $str {\\&} result
|
1994-06-02 23:02:00 +00:00
|
|
|
|
return $result
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Same as gdb_test, but the second parameter is not a regexp,
|
|
|
|
|
# but a string that must match exactly.
|
|
|
|
|
|
|
|
|
|
proc gdb_test_exact { args } {
|
|
|
|
|
set command [lindex $args 0]
|
1994-06-07 16:40:10 +00:00
|
|
|
|
set pattern [string_to_regexp [lindex $args 1]]
|
1994-06-02 23:02:00 +00:00
|
|
|
|
if [llength $args]==3 then {
|
|
|
|
|
set message [lindex $args 2]
|
|
|
|
|
} else {
|
|
|
|
|
set message $command
|
|
|
|
|
}
|
|
|
|
|
return [gdb_test $command $pattern $message]
|
|
|
|
|
}
|
* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
1995-01-20 22:26:33 +00:00
|
|
|
|
|
1993-02-21 20:03:55 +00:00
|
|
|
|
proc gdb_reinitialize_dir { subdir } {
|
|
|
|
|
global prompt
|
|
|
|
|
|
1993-11-03 18:28:22 +00:00
|
|
|
|
send "dir\n"
|
1993-02-21 20:03:55 +00:00
|
|
|
|
expect {
|
|
|
|
|
-re "Reinitialize source path to empty.*" {
|
|
|
|
|
send "y\n"
|
|
|
|
|
expect {
|
|
|
|
|
-re "Source directories searched.*$prompt $" {
|
|
|
|
|
send "dir $subdir\n"
|
|
|
|
|
expect {
|
|
|
|
|
-re "Source directories searched.*$prompt $" {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
verbose "Dir set to $subdir"
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
-re ".*$prompt $" {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
perror "Dir \"$subdir\" failed."
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
-re ".*$prompt $" {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
perror "Dir \"$subdir\" failed."
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
-re ".*$prompt $" {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
perror "Dir \"$subdir\" failed."
|
1993-02-21 20:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1993-08-30 23:08:02 +00:00
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# gdb_exit -- exit the GDB, killing the target program if necessary
|
|
|
|
|
#
|
|
|
|
|
proc default_gdb_exit {} {
|
|
|
|
|
global GDB
|
|
|
|
|
global GDBFLAGS
|
|
|
|
|
global verbose
|
|
|
|
|
|
1994-01-17 23:28:29 +00:00
|
|
|
|
verbose "Quitting $GDB $GDBFLAGS"
|
1993-08-30 23:08:02 +00:00
|
|
|
|
|
|
|
|
|
# This used to be 1 for unix-gdb.exp
|
|
|
|
|
set timeout 5
|
|
|
|
|
|
1994-05-21 17:24:22 +00:00
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
# Omitting this probably would cause strange timing-dependent failures.
|
1993-08-30 23:08:02 +00:00
|
|
|
|
wait
|
|
|
|
|
}
|
|
|
|
|
|
1993-11-03 18:28:22 +00:00
|
|
|
|
#
|
|
|
|
|
# gdb_load -- load a file into the debugger.
|
|
|
|
|
# return a -1 if anything goes wrong.
|
|
|
|
|
#
|
|
|
|
|
proc gdb_file_cmd { arg } {
|
|
|
|
|
global verbose
|
|
|
|
|
global loadpath
|
|
|
|
|
global loadfile
|
|
|
|
|
global GDB
|
|
|
|
|
global prompt
|
1994-01-11 05:09:44 +00:00
|
|
|
|
global spawn_id
|
1993-11-03 18:28:22 +00:00
|
|
|
|
|
|
|
|
|
send "file $arg\n"
|
|
|
|
|
expect {
|
|
|
|
|
-re "Reading symbols from.*done.*$prompt $" {
|
|
|
|
|
verbose "\t\tLoaded $arg into the $GDB"
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
-re "has no symbol-table.*$prompt $" {
|
|
|
|
|
perror "$arg wasn't compiled with \"-g\""
|
|
|
|
|
return -1
|
|
|
|
|
}
|
1994-01-11 05:09:44 +00:00
|
|
|
|
-re "A program is being debugged already.*Kill it.*y or n. $" {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
send "y\n"
|
|
|
|
|
verbose "\t\tKilling previous program being debugged"
|
1994-01-11 05:09:44 +00:00
|
|
|
|
exp_continue
|
1993-11-03 18:28:22 +00:00
|
|
|
|
}
|
1994-01-11 05:09:44 +00:00
|
|
|
|
-re "Load new symbol table from \".*\".*y or n. $" {
|
1993-11-03 18:28:22 +00:00
|
|
|
|
send "y\n"
|
|
|
|
|
expect {
|
|
|
|
|
-re "Reading symbols from.*done.*$prompt $" {
|
|
|
|
|
verbose "\t\tLoaded $arg with new symbol table into $GDB"
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
timeout {
|
|
|
|
|
perror "(timeout) Couldn't load $arg, other program already l
|
|
|
|
|
oaded."
|
|
|
|
|
return -1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
-re ".*No such file or directory.*$prompt $" {
|
|
|
|
|
perror "($arg) No such file or directory\n"
|
|
|
|
|
return -1
|
|
|
|
|
}
|
|
|
|
|
-re "$prompt $" {
|
|
|
|
|
perror "couldn't load $arg into $GDB."
|
|
|
|
|
return -1
|
|
|
|
|
}
|
|
|
|
|
timeout {
|
1994-01-11 05:09:44 +00:00
|
|
|
|
perror "couldn't load $arg into $GDB (timed out)."
|
1993-11-03 18:28:22 +00:00
|
|
|
|
return -1
|
|
|
|
|
}
|
|
|
|
|
eof {
|
|
|
|
|
# This is an attempt to detect a core dump, but seems not to
|
|
|
|
|
# work. Perhaps we need to match .* followed by eof, in which
|
|
|
|
|
# expect does not seem to have a way to do that.
|
1994-05-17 22:06:15 +00:00
|
|
|
|
perror "couldn't load $arg into $GDB (end of file)."
|
1993-11-03 18:28:22 +00:00
|
|
|
|
return -1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1993-08-30 23:08:02 +00:00
|
|
|
|
|
1994-06-08 19:25:43 +00:00
|
|
|
|
#
|
|
|
|
|
# start gdb -- start gdb running, default procedure
|
|
|
|
|
#
|
|
|
|
|
proc default_gdb_start { } {
|
|
|
|
|
global verbose
|
|
|
|
|
global GDB
|
|
|
|
|
global GDBFLAGS
|
|
|
|
|
global prompt
|
|
|
|
|
global spawn_id
|
|
|
|
|
global timeout
|
* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
1995-01-20 22:26:33 +00:00
|
|
|
|
verbose "Spawning $GDB -nw $GDBFLAGS"
|
1994-07-19 17:33:52 +00:00
|
|
|
|
|
|
|
|
|
if { [which $GDB] == 0 } then {
|
|
|
|
|
perror "$GDB does not exist."
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
1994-06-08 19:25:43 +00:00
|
|
|
|
|
|
|
|
|
set oldtimeout $timeout
|
|
|
|
|
set timeout [expr "$timeout + 60"]
|
* gdb.c++/classes.exp, gdb.c++/cplusfuncs.exp,
gdb.c++/inherit.exp, gdb.c++/templates.exp, gdb.c++/virtfunc.exp,
gdb.fortran/exprs.exp, gdb.fortran/types.exp, gdb.chill/chexp.exp,
gdb.base/printcmds.exp: Remove passcount, failcount, etc., stuff;
it makes the tests harder to understand and confuses test-o-matic.
The preferred style is that each test provides a PASS or a FAIL,
and has a unique message (e.g. "continue #54" not just "continue")
which is the same for the pass and the fail.
* gdb.fortran/exprs.exp, gdb.fortran/types.exp,
gdb.chill/chexp.exp: Move test_print_accept and test_print_reject
to lib/gdb.exp.
* gdb.base/printcmds.exp: Use test_print_accept. Remove
prt_accept which was basically the same thing. Likewise for
test_print_reject and prt_reject.
* lib/gdb.exp (test_print_reject): Add some more error message
patterns to match from the former printcmds.exp (prt_reject).
* gdb.c++/classes.exp, gdb.base/scope.exp: Remove spurious xfails.
One defect of the passcount stuff is that some of it failed to
report XPASS where appropriate.
* gdb.c++/cplusfuncs.exp (print_addr_of): No longer accept extra
stuff before and after arg in expected pattern.
(test_paddr_operator_functions): Re-do test without print_addr_of;
this is the only test which seems to want extra stuff there.
1995-01-20 22:26:33 +00:00
|
|
|
|
eval "spawn $GDB -nw $GDBFLAGS"
|
1994-06-08 19:25:43 +00:00
|
|
|
|
expect {
|
|
|
|
|
-re ".*\r\n$prompt $" {
|
1994-07-19 17:33:52 +00:00
|
|
|
|
verbose "GDB initialized."
|
1994-06-08 19:25:43 +00:00
|
|
|
|
}
|
|
|
|
|
-re "$prompt $" {
|
|
|
|
|
perror "GDB never initialized."
|
|
|
|
|
return -1
|
|
|
|
|
}
|
|
|
|
|
timeout {
|
|
|
|
|
perror "(timeout) GDB never initialized."
|
|
|
|
|
return -1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
set timeout $oldtimeout
|
|
|
|
|
# force the height to "unlimited", so no pagers get used
|
|
|
|
|
send "set height 0\n"
|
|
|
|
|
expect {
|
|
|
|
|
-re ".*$prompt $" {
|
|
|
|
|
verbose "Setting height to 0." 2
|
|
|
|
|
}
|
|
|
|
|
timeout {
|
|
|
|
|
warning "Couldn't set the height to 0."
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
# force the width to "unlimited", so no wraparound occurs
|
|
|
|
|
send "set width 0\n"
|
|
|
|
|
expect {
|
|
|
|
|
-re ".*$prompt $" {
|
|
|
|
|
verbose "Seting width to 0." 2
|
|
|
|
|
}
|
|
|
|
|
timeout {
|
|
|
|
|
warning "Couldn't set the width to 0."
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1994-01-11 05:09:44 +00:00
|
|
|
|
#
|
|
|
|
|
# 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.
|
|
|
|
|
#
|
1994-01-17 23:28:29 +00:00
|
|
|
|
global argv0
|
|
|
|
|
if ![info exists argv0] then {
|
1994-01-11 05:09:44 +00:00
|
|
|
|
proc exp_continue { } {
|
|
|
|
|
continue -expect
|
|
|
|
|
}
|
|
|
|
|
}
|
1993-08-30 23:08:02 +00:00
|
|
|
|
|
1995-03-14 21:25:19 +00:00
|
|
|
|
proc skip_chill_tests {} {
|
|
|
|
|
return ![isnative]
|
|
|
|
|
}
|