-# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+# Copyright 1988-2013 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
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Start with a fresh gdb
gdb_exit
gdb_start
+set prev_timeout $timeout
set timeout 60
#
gdb_test "append binary memory" "Missing filename\."
gdb_test "append binary value" "Missing filename\."
-setup_xfail "mips-idt-*"
-send_gdb "attach\n"
-gdb_expect {
- -re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\
- { pass "attach" }
- -re "You can't do that when your target is `None'.*$gdb_prompt $"\
- { pass "attach" }
- -re "You can't do that without a process to debug.*$gdb_prompt $"\
- { pass "attach" }
- -re "Don't know how to attach. Try \"help target\"..*$gdb_prompt $"\
- { pass "attach" }
- -re "Kill it. .y or n." {
- send_gdb "y\n"
- exp_continue
+if !$use_gdb_stub {
+ gdb_test_multiple "attach" "attach" {
+ -re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\
+ { pass "attach" }
+ -re "You can't do that when your target is `None'.*$gdb_prompt $"\
+ { pass "attach" }
+ -re "You can't do that without a process to debug.*$gdb_prompt $"\
+ { pass "attach" }
+ -re "Don't know how to attach. Try \"help target\"..*$gdb_prompt $"\
+ { pass "attach" }
+ -re "Kill it. .y or n." {
+ send_gdb "y\n"
+ exp_continue
+ }
}
- -re "$gdb_prompt $" { fail "attach" }
- timeout { fail "(timeout) attach" }
-}
-if ![target_info exists use_gdb_stub] {
gdb_test "break" "No default breakpoint address now." "break"
foreach i "b br bre brea" {
gdb_test $i "No default breakpoint address now." "break \"$i\" abbreviation"
}
- setup_xfail "mips-idt-*"
gdb_test "backtrace" "No stack."
# ba and bac are no longer unique command prefixes. So these tests
# GDB needs to be fixed to map unique alias here for ba bac.
#
foreach i "bt ba bac" {
- setup_xfail "mips-idt-*"
gdb_test $i "No stack." "backtrace \"$i\" abbreviation"
}
} else {
warning "Skipping backtrace and break tests because of GDB stub."
}
-# This works on the MIPS IDT board, but confuses future tests.
-if ![istarget "mips-idt-*"] then {
- gdb_test "continue" "The program is not being run." "continue"
- gdb_test "c" "The program is not being run." "continue \"c\" abbreviation"
-}
+gdb_test "continue" "The program is not being run." "continue"
+gdb_test "c" "The program is not being run." "continue \"c\" abbreviation"
#test call
gdb_test "call" "The history is empty..*" "call"
gdb_test "catch" "Catch requires an event name..*" "catch"
#test cd
-gdb_test "cd" "Argument required .new working directory.*" "cd"
+gdb_test "cd" "Working directory \[^\r\n\]*\\."
#test clear
gdb_test "clear" "No source file specified..*" "clear"
#test commands
-gdb_test "commands" "No breakpoint number 0..*" "commands"
+gdb_test "commands" "Argument required .one or more breakpoint numbers...*" "commands"
#test condition
gdb_test "condition" "Argument required .breakpoint number.*" "condition"
#test core-file
-gdb_test "core-file" "No core file now.|GDB can't read core files on this machine." "core-file"
+gdb_test "core-file" "No core file now." "core-file"
#test delete "d" abbreviation
-gdb_test "d" "" "delete \"d\" abbreviation"
+gdb_test_no_output "d" "delete \"d\" abbreviation"
#test delete
-gdb_test "delete" "" "delete"
+gdb_test_no_output "delete" "delete"
#test define
gdb_test "define" "Argument required \[(\]name of command to define\[)\]." "define"
#test delete breakpoints
-gdb_test "delete breakpoints" "" "delete breakpoints"
+gdb_test_no_output "delete breakpoints" "delete breakpoints"
#test delete display
# FIXME -- need to dump full output to detailed log
-send_gdb "delete display\n"
-gdb_expect {
- -re "Delete all auto-display expressions.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "$gdb_prompt $" { pass "delete display prompt" }
- timeout { fail "(timeout) delete display prompt" }
- }
- }
- timeout { fail "(timeout) delete display prompt" }
-}
+gdb_test "delete display" \
+ "" \
+ "delete display prompt" \
+ "Delete all auto-display expressions.*y or n. $" \
+ "y"
+
#test detach
-gdb_test "detach" "" "detach"
+gdb_test "detach" ".*" "detach"
if [istarget "h8300-*-hms"] then {
gdb_exit
#test directory
# FIXME -- need to dump full output to detailed log
-send_gdb "directory\n"
-gdb_expect {
- -re "Reinitialize source path to empty.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "Source directories searched: .cdir\[:;\].cwd.*$gdb_prompt $"\
- { pass "directory prompt" }
- timeout { fail "(timeout) directory prompt" }
- }
- }
-}
+gdb_test "directory" \
+ "Source directories searched: .cdir\[:;\].cwd.*" \
+ "directory prompt" \
+ "Reinitialize source path to empty.*y or n. $" \
+ "y"
#test disable "dis" abbreviation
-gdb_test "dis" "" "disable \"dis\" abbreviation"
+gdb_test_no_output "dis" "disable \"dis\" abbreviation"
#test disable "disa" abbreviation
-gdb_test "disa" "" "disable \"disa\" abbreviation"
+gdb_test_no_output "disa" "disable \"disa\" abbreviation"
#test disable
-gdb_test "disable" "" "disable"
+gdb_test_no_output "disable" "disable"
#test disable breakpoints
-gdb_test "disable breakpoints" "" "disable breakpoints"
+gdb_test_no_output "disable breakpoints" "disable breakpoints"
#test disable display
-gdb_test "disable display" "" "disable display"
+gdb_test_no_output "disable display" "disable display"
#test disassemble
gdb_test "disassemble" "No frame selected." "disassemble"
#test display
-gdb_test "display" "" "display"
+gdb_test_no_output "display" "display"
#test do
gdb_test "do" "No stack." "do"
#test document
gdb_test "dump tekhex memory" "Missing filename\."
gdb_test "dump tekhex value" "Missing filename\."
#test echo
-gdb_test "echo" "" "echo"
+gdb_test_no_output "echo" "echo"
#test enable breakpoints delete
gdb_test "enable breakpoints delete" "Argument required .one or more breakpoint numbers.*" "enable breakpoints delete"
#test enable breakpoints once
gdb_test "enable breakpoints once" "Argument required .one or more breakpoint numbers.*" "enable breakpoints once"
#test enable breakpoints
-gdb_test "enable breakpoints" "" "enable breakpoints"
+gdb_test_no_output "enable breakpoints" "enable breakpoints"
#test enable delete
gdb_test "enable delete" "Argument required .one or more breakpoint numbers.*" "enable delete"
#test enable display
-gdb_test "enable display" "" "enable display"
+gdb_test_no_output "enable display" "enable display"
#test enable once
gdb_test "enable once" "Argument required .one or more breakpoint numbers.*" "enable once"
#test enable
-gdb_test "enable" "" "enable"
+gdb_test_no_output "enable" "enable"
#test exec-file
send_gdb "exec-file\n"
gdb_expect {
}
#test finish
-gdb_test "finish" "The program is not running." "finish"
+gdb_test "finish" "The program is not being run." "finish"
#test forward-search
# The message here comes from the regexp library, not gdb, and so can
# vary on different systems.
gdb_test "forward-search" "No previous regular expression.*|There is no previous regular expression.*" "forward-search"
#test gcore
-send_gdb "gcore\n"
-gdb_expect {
+
+gdb_test_multiple "gcore" "gcore" {
-re "You can\'t do that without a process to debug.*$gdb_prompt $" {
pass "gcore"
}
-re "Undefined command: .*$gdb_prompt $" {
pass "gcore"
}
- default { fail "gcore" }
}
-send_gdb "generate-core-file\n"
-gdb_expect {
+
+gdb_test_multiple "generate-core-file" "generate-core-file" {
-re "You can\'t do that without a process to debug.*$gdb_prompt $" {
pass "generate-core-file"
}
-re "Undefined command: .*$gdb_prompt $" {
pass "generate-core-file"
}
- default { fail "generate-core-file" }
}
+
#test help "h" abbreviation
gdb_test "h" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- Aliases of other commands(\[^\r\n\]*\[\r\n\])+breakpoints -- Making program stop at certain points(\[^\r\n\]*\[\r\n\])+data -- Examining data(\[^\r\n\]*\[\r\n\])+files -- Specifying and examining files(\[^\r\n\]*\[\r\n\])+obscure -- Obscure features(\[^\r\n\]*\[\r\n\])+running -- Running the program(\[^\r\n\]*\[\r\n\])+stack -- Examining the stack(\[^\r\n\]*\[\r\n\])+status -- Status inquiries(\[^\r\n\]*\[\r\n\])+support -- Support facilities(\[^\r\n\]*\[\r\n\])+user-defined -- User-defined commands(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by a class name for a list of commands in that class.(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "help \"h\" abbreviation"
#test help
gdb_test "info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\". Try \"help info\".*" "info bogus-gdb-command"
#test info breakpoints
gdb_test "info breakpoints" "No breakpoints or watchpoints." "info breakpoints"
-#test info catch
-gdb_test "info catch" "You can't do that without a process to debug." "info catch"
#test info copying
# FIXME -- doesn't work worth a shit
#send_gdb "info copying"
#test info frame
gdb_test "info frame" "No stack.|No selected frame." "info frame"
#test info files
-gdb_test "info files" "" "info files"
+gdb_test_no_output "info files" "info files"
#test info float
gdb_test "info float" "The program has no registers now." "info float"
#test info functions
#test info stack
gdb_test "info stack" "No stack." "info stack"
#test info set
-# FIXME -- needs to match the entire output
-# FIXME -- on native solaris 2.8, this test fails due to this line:
+# Test improved to check three parts:
+# 1) confirm
+# 2) prompt
+# 3) write
+# And only succeed if all three are matched.
+# This should fix an old problem on native solaris 2.8,
+# where this test fails due to this line:
# prompt: Gdb's prompt is "(gdb) ".^M
-gdb_test "info set" "confirm: Whether to confirm potentially dangerous operations is o\[a-z\]*.(\[^\r\n\]*\[\r\n\])+history filename: The filename in which to record the command history is (\[^\r\n\]*\[\r\n\])+listsize: Number of source lines gdb will list by default is 10.*" "info set"
+set set_confirm_seen 0
+set set_prompt_seen 0
+gdb_test_multiple "info set" "info set" {
+ -re "confirm: Whether to confirm potentially dangerous operations is o\[a-z\]*.(\[^\r\n\]*\[\r\n\])+history filename: The filename in which to record the command history is (\[^\r\n\]*\[\r\n\])+listsize: Number of source lines gdb will list by default is 10" {
+ verbose "Confirm dislayed"
+ set set_confirm_seen 1
+ exp_continue
+ }
+ -re "Gdb's prompt is \"$gdb_prompt \"" {
+ verbose "GDB prompt displayed"
+ set set_prompt_seen 1
+ exp_continue
+ }
+ -re "Writing into executable.*$gdb_prompt $" {
+ verbose "write displayed"
+ if { $set_prompt_seen && $set_confirm_seen } {
+ pass "info set"
+ } else {
+ verbose "prompt $set_prompt_seen confirm $set_confirm_seen"
+ fail "info set (incomplete output)"
+ }
+ }
+}
gdb_test "info symbol" "Argument required .address.."
#test info source
gdb_test "info source" "No current source file..*" "info source"
#test info sources
gdb_test "info sources" "No symbol table is loaded. Use the \"file\" command.*" "info sources"
#test info target
-gdb_test "info target" "" "info target"
+gdb_test_no_output "info target" "info target"
#test info terminal
gdb_test "info terminal" "No saved terminal information." "info terminal"
+# test info threads
+gdb_test "info threads" "No threads." "info threads"
#test info types
gdb_test "info types" "All defined types:" "info types"
#test info variables
#test info warranty
gdb_test "info warranty" "15. *Disclaimer of Warranty.*" "info warranty"
#test info watchpoints
-gdb_test "info watchpoints" "No breakpoints or watchpoints." "info watchpoints"
+gdb_test "info watchpoints" "No watchpoints." "info watchpoints"
#test inspect
gdb_test "inspect" "The history is empty." "inspect"
#test jump
gdb_test "overlay" "\"overlay\" must be followed by the name of .*"
#test a non-existant overlay subcommand
gdb_test "overlay on" "Undefined overlay command.* Try \"help overlay\"."
-gdb_test "overlay manual" "" "overlay manual #1"
-gdb_test "overlay auto" ""
-gdb_test "overlay off" ""
+gdb_test_no_output "overlay manual" "overlay manual #1"
+gdb_test_no_output "overlay auto"
+gdb_test_no_output "overlay off"
gdb_test "overlay list" "No sections are mapped."
gdb_test "overlay map" "Overlay debugging not enabled.*" "overlay map #1"
gdb_test "overlay unmap" "Overlay debugging not enabled.*" "overlay unmap #1"
-gdb_test "overlay manual" "" "overlay manual #2"
+gdb_test_no_output "overlay manual" "overlay manual #2"
gdb_test "overlay map" "Argument required: name of an overlay section." "overlay map #2"
gdb_test "overlay unmap" "Argument required: name of an overlay section." "overlay unmap #2"
gdb_test "pwd" "Working directory .*" "pwd"
#test run "r" abbreviation
-if [istarget "*-*-vxworks*"] then {
- gdb_test "set args" "" ""
+if $use_gdb_stub {
+ # Only extended-remote supports "run".
+} elseif [istarget "*-*-vxworks*"] then {
+ gdb_test "set args" ".*" ""
gdb_test "r" "Starting program: .*
You must specify a function name to run, and arguments if any"\
"run \"r\" abbreviation"
- gdb_test "set args main" "" ""
+ gdb_test "set args main" ".*" ""
} else {
- send_gdb "r\n"
- gdb_expect {
- -re "Starting program: .*
-You can't do that when your target is `None'.*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Starting program: .*
-No executable file specified.*
-Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Starting program: .*
-No executable specified, use .target exec.\\..*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Starting program: .*
-No image loaded into target.*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Starting program: .*
-No program loaded.*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re ".*$gdb_prompt $" { fail "run \"r\" abbreviation" }
- timeout { fail "(timeout) run \"r\" abbreviation" }
- }
+ gdb_test_multiple "r" "run \"r\" abbreviation" {
+ -re "Starting program: .*You can't do that when your target is `None'.*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Starting program: .*No executable file specified.*Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Starting program: .*No executable specified, use .target exec.\\..*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Starting program: .*No image loaded into target.*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Starting program: .*No program loaded.*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Starting program: .*Running the default executable on the remote target failed; try \"set remote exec-file\"?.*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ }
}
#test run
-if [istarget "*-*-vxworks*"] then {
- gdb_test "set args" "" ""
+if $use_gdb_stub {
+ # Only extended-remote supports "run".
+} elseif [istarget "*-*-vxworks*"] then {
+ gdb_test "set args" ".*" ""
gdb_test "run" "Starting program: .*
You must specify a function name to run, and arguments if any"
- gdb_test "set args main" "" ""
+ gdb_test "set args main" ".*" ""
} else {
- send_gdb "run\n"
- gdb_expect {
- -re "Starting program:.*You can't do that when your target is `None'.*$gdb_prompt $" { pass "run" }
- -re "Starting program: .*
-No executable file specified.*
-Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
- { pass "run" }
- -re "Starting program: .*
-No executable specified, use .target exec.\\..*$gdb_prompt $"\
- { pass "run" }
- -re "Starting program: .*
-No image loaded into target.*$gdb_prompt $"\
- { pass "run" }
- -re "Starting program: .*
-No program loaded.*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
- { pass "run" }
- -re ".*$gdb_prompt $" { fail "run" }
- timeout { fail "(timeout) run" }
- }
+ gdb_test_multiple "run" "run" {
+ -re "Starting program:.*You can't do that when your target is `None'.*$gdb_prompt $"\
+ { pass "run" }
+ -re "Starting program: .*No executable file specified.*Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
+ { pass "run" }
+ -re "Starting program: .*No executable specified, use .target exec.\\..*$gdb_prompt $"\
+ { pass "run" }
+ -re "Starting program: .*No image loaded into target.*$gdb_prompt $"\
+ { pass "run" }
+ -re "Starting program: .*No program loaded.*$gdb_prompt $"\
+ { pass "run" }
+ -re "Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
+ { pass "run" }
+ -re "Starting program: .*Running the default executable on the remote target failed; try \"set remote exec-file\"?.*$gdb_prompt $"\
+ { pass "run" }
+ }
}
#test rbreak
-gdb_test "rbreak" "" "rbreak"
+gdb_test "rbreak" "rbreak"
# test restore
gdb_test "restore" "You can't do that without a process to debug\."
#test set annotate
gdb_test "set annotate" "Argument required .integer to set it to.*" "set annotate"
#test set args
-gdb_test "set args" "" "set args"
-#test set check "c" abbreviation
-gdb_test "set c" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check \"c\" abbreviation"
-#test set check "ch" abbreviation
-gdb_test "set ch" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check \"ch\" abbreviation"
-#test set check
-gdb_test "set check" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check"
+gdb_test_no_output "set args" "set args"
+
+# Test set check abbreviations
+foreach x {"c" "ch" "check"} {
+ gdb_test "set $x" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \
+ "set check \"$x\" abbreviation"
+}
+
#test set check range
-gdb_test "set check range" "" "set check range"
+gdb_test "set check range" ".*" "set check range"
#test set check type
-gdb_test "set check type" "" "set check type"
+gdb_test "set check type" ".*" "set check type"
#test set complaints
gdb_test "set complaints" "Argument required .integer to set it to.*" "set complaints"
#test set confirm
-gdb_test "set confirm" "" "set confirm"
+gdb_test_no_output "set confirm" "set confirm"
# Don't test set editing. What if we're talking to a gdb that
# won't do editing correctly while we're talking to it?
# gdb_test "set editing" "" "set editing"
#test set height
gdb_test "set height" "Argument required .integer to set it to.*" "set height"
#test set history expansion
-gdb_test "set history expansion" "" "set history expansion"
+gdb_test_no_output "set history expansion" "set history expansion"
#test set history filename
gdb_test "set history filename" "Argument required .filename to set it to.*" "set history filename"
#test set history save
-gdb_test "set history save" "" "set history save"
+gdb_test_no_output "set history save" "set history save"
#test set history size
gdb_test "set history size" "Argument required .integer to set it to.*" "set history size"
#test set history
gdb_test "set history" "\"set history\" must be followed by the name of a history subcommand.(\[^\r\n\]*\[\r\n\])+List of set history subcommands:(\[^\r\n\]*\[\r\n\])+set history expansion -- Set history expansion on command input(\[^\r\n\]*\[\r\n\])+set history filename -- Set the filename in which to record the command history(\[^\r\n\]*\[\r\n\])+set history save -- Set saving of the history record on exit(\[^\r\n\]*\[\r\n\])+set history size -- Set the size of the command history(\[^\r\n\]*\[\r\n\])+Type \"help set history\" followed by set history subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set history"
#test set language
-gdb_test "set language" "The currently understood settings are:(\[^\r\n\]*\[\r\n\])+local or auto *Automatic setting based on source file(\[^\r\n\]*\[\r\n\])+c *Use the C language(\[^\r\n\]*\[\r\n\])+c\[+\]+ *Use the C\[+\]+ language(\[^\r\n\]*\[\r\n\])+modula-2 *Use the Modula-2 language.*" "set language"
+gdb_test "set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, c, c.., asm, minimal, d, fortran, objective-c, go, java, modula-2, opencl, pascal." "set language"
#test set listsize
gdb_test "set listsize" "Argument required .integer to set it to.*" "set listsize"
#test set print "p" abbreviation
#test set print
gdb_test "set print" "\"set print\" must be followed by the name of a print subcommand.(\[^\r\n\]*\[\r\n\])+List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print"
#test set print address
-gdb_test "set print address" "" "set print address"
+gdb_test_no_output "set print address" "set print address"
#test set print array
-gdb_test "set print array" "" "set print array"
+gdb_test_no_output "set print array" "set print array"
#test set print asm-demangle
-gdb_test "set print asm-demangle" "" "set print asm-demangle"
+gdb_test_no_output "set print asm-demangle" "set print asm-demangle"
#test set print demangle
-gdb_test "set print demangle" "" "set print demangle"
+gdb_test_no_output "set print demangle" "set print demangle"
#test set print elements
gdb_test "set print elements" "Argument required .integer to set it to.*" "set print elements"
#test set print object
-gdb_test "set print object" "" "set print object"
+gdb_test_no_output "set print object" "set print object"
#test set print pretty
-gdb_test "set print pretty" "" "set print pretty"
+gdb_test_no_output "set print pretty" "set print pretty"
#test set print sevenbit-strings
-gdb_test "set print sevenbit-strings" "" "set print sevenbit-strings"
+gdb_test_no_output "set print sevenbit-strings" "set print sevenbit-strings"
#test set print union
-gdb_test "set print union" "" "set print union"
+gdb_test_no_output "set print union" "set print union"
#test set print vtbl
-gdb_test "set print vtbl" "" "set print vtbl"
+gdb_test_no_output "set print vtbl" "set print vtbl"
# FIXME -- need a test for "set prompt"
#test set radix
gdb_test "set radix" "Input and output radices now set to decimal 10, hex a, octal 12.*" "set radix"
-#test set symbol-reloading
-gdb_test "set symbol-reloading" "" "set symbol-reloading"
#test set variable
gdb_test "set variable" "Argument required .expression to compute.*" "set variable"
#test set verbose
-gdb_test "set verbose" "" "set verbose"
+gdb_test_no_output "set verbose" "set verbose"
#test set width
gdb_test "set width" "Argument required .integer to set it to.*" "set width"
#test set write
# This is only supported on targets which use exec.o.
-gdb_test "set write" "" "set write"
+gdb_test_no_output "set write" "set write"
#test set
gdb_test "set" "Argument required .expression to compute.*" "set"
#test shell echo Hi dad!
gdb_test "show annotate" "Annotation_level is 0." "show annotate"
#test show args
gdb_test "show args" "Argument list to give program being debugged when it is started is \"\"." "show args"
-#test show check "c" abbreviation
-gdb_test "show c" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Type checking is \"auto; currently off\".*" "show check \"c\" abbreviation"
-#test show check "ch" abbreviation
-gdb_test "show ch" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Type checking is \"auto; currently off\"." "show check \"ch\" abbreviation"
-#test show check
-gdb_test "show check" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Type checking is \"auto; currently off\"." "show check"
+
+# test show check abbreviations
+foreach x {"c" "ch" "check"} {
+ gdb_test "show $x" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Strict type checking is on\..*" \
+ "show check \"$x\" abbreviation"
+}
+
#test show check range
gdb_test "show check range" "Range checking is \"auto; currently off\"." "show check range"
#test show check type
-gdb_test "show check type" "Type checking is \"auto; currently off\"." "show check type"
+gdb_test "show check type" "Strict type checking is on\." "show check type"
#test show commands
-gdb_test "show commands" "" "show commands"
+gdb_test "show commands" ".*" "show commands"
#test show complaints
gdb_test "show complaints" "Max number of complaints about incorrect symbols is 0." "show complaints"
#test show confirm
gdb_test "show confirm" "Whether to confirm potentially dangerous operations is o\[a-z\]*." "show confirm"
+
#test show convenience
-gdb_test "show convenience" "No debugger convenience variables now defined.(\[^\r\n\]*\[\r\n\])+Convenience variables have names starting with \".\";(\[^\r\n\]*\[\r\n\])+use \"set\" as in \"set .foo = 5\" to define them." "show convenience"
+# This is trickier as there are multiple internal convenience vars and
+# functions and we can't assume any particular order.
+# And we have to handle the extra convenience funs provided by Python.
+set show_conv_list \
+ { \
+ {$_sdata = void} \
+ {$_siginfo = void} \
+ {$_thread = 0} \
+ {$_exception = <error: No frame selected>} \
+ {$_probe_argc = <error: No frame selected>} \
+ {$_probe_arg0 = <error: No frame selected>} \
+ {$_probe_arg1 = <error: No frame selected>} \
+ {$_probe_arg2 = <error: No frame selected>} \
+ {$_probe_arg3 = <error: No frame selected>} \
+ {$_probe_arg4 = <error: No frame selected>} \
+ {$_probe_arg5 = <error: No frame selected>} \
+ {$_probe_arg6 = <error: No frame selected>} \
+ {$_probe_arg7 = <error: No frame selected>} \
+ {$_probe_arg8 = <error: No frame selected>} \
+ {$_probe_arg9 = <error: No frame selected>} \
+ {$_probe_arg10 = <error: No frame selected>} \
+ {$_probe_arg11 = <error: No frame selected>} \
+ }
+if ![skip_python_tests] {
+ append show_conv_list \
+ {
+ {$_memeq = <internal function _memeq>} \
+ {$_regex = <internal function _regex>} \
+ {$_streq = <internal function _streq>} \
+ {$_strlen = <internal function _strlen>} \
+ }
+}
+gdb_test_list_exact "show convenience" "show convenience" \
+ "\[^\r\n\]+\[\r\n\]+" \
+ "\[^\r\n\]+" \
+ $show_conv_list
+
#test show directories
gdb_test "show directories" "Source directories searched: .cdir\[:;\].cwd" "show directories"
#test show editing
#test show print "pr" abbreviation
gdb_test "show pr" ".*" "show pr"
#test show print
-gdb_test "show print" "" "show print"
+gdb_test "show print" ".*" "show print"
#test show paths
gdb_test "show paths" "Executable and object file path:.*" "show paths"
#test show print address
gdb_test "show prompt" "Gdb's prompt is \"$gdb_prompt \".*" "show prompt"
#test show radix
gdb_test "show radix" "Input and output radices set to decimal 10, hex a, octal 12." "show radix"
-#test show symbol-reloading
-gdb_test "show symbol-reloading" "Dynamic symbol table reloading multiple times in one run is on." "show symbol-reloading"
#test show user
-gdb_test "show user" "" "show user"
+gdb_test_no_output "show user" "show user"
#test show values
-gdb_test "show values" "" "show values"
+gdb_test_no_output "show values" "show values"
#test show verbose
gdb_test "show verbose" "Verbose printing of informational messages is o.*|Verbosity is off.*" "show verbose"
#test show version
# This is only supported on targets which use exec.o.
gdb_test "show write" "Writing into executable and core files is o.*" "show write"
#test show
-gdb_test "show" "confirm: *Whether to confirm potentially dangerous operations is on.(\[^\r\n\]*\[\r\n\])+history filename: *The filename in which to record the command history is (\[^\r\n\]*\[\r\n\])+history save: *Saving of the history record on exit is on.(\[^\r\n\]*\[\r\n\])+history size: *The size of the command history is(\[^\r\n\]*\[\r\n\])+listsize: *Number of source lines gdb will list by default is 10(\[^\r\n]*\[\r\n\])+print elements: *Limit on string chars or array elements to print is 200..*" "show"
+set show_confirm_seen 0
+set show_prompt_seen 0
+gdb_test_multiple "show" "show" {
+ -re "confirm: *Whether to confirm potentially dangerous operations is on.(\[^\r\n\]*\[\r\n\])+history filename: *The filename in which to record the command history is (\[^\r\n\]*\[\r\n\])+history save: *Saving of the history record on exit is on.(\[^\r\n\]*\[\r\n\])+history size: *The size of the command history is(\[^\r\n\]*\[\r\n\])+listsize: *Number of source lines gdb will list by default is 10(\[^\r\n]*\[\r\n\])+print elements: *Limit on string chars or array elements to print is 200." {
+ verbose "Confirm dislayed"
+ set show_confirm_seen 1
+ exp_continue
+ }
+ -re "Gdb's prompt is \"$gdb_prompt \"" {
+ verbose "GDB prompt displayed"
+ set show_prompt_seen 1
+ exp_continue
+ }
+ -re "Writing into executable.*$gdb_prompt $" {
+ verbose "write displayed"
+ if { $show_prompt_seen && $show_confirm_seen } {
+ pass "show"
+ } else {
+ verbose "prompt $show_prompt_seen confirm $show_confirm_seen"
+ fail "show (incomplete output)"
+ }
+ }
+}
#test stepi "si" abbreviation
gdb_test "si" "The program is not being run." "stepi \"si\" abbreviation"
#test stepi
#test step
gdb_test "step" "The program is not being run." "step #2"
#test symbol-file
-gdb_test "symbol-file" "" "symbol-file"
+gdb_test "symbol-file" ".*" "symbol-file"
#test target child
gdb_test "target child" "Use the \"run\" command to start a Unix child process.*|Undefined target command: \"child\". *Try \"help target\".*" "target child"
gdb_test "target" "Argument required .target name.*" "target"
#test tbreak
gdb_test "tbreak" "No default breakpoint address now." "tbreak"
+#test thread
+gdb_test "thread" "No thread selected" "thread"
+#test thread apply
+gdb_test "thread apply" "Please specify a thread ID list" "thread apply"
+#test thread find
+gdb_test "thread find" "Command requires an argument." "thread find"
+#test thread name
+gdb_test "thread name" "No thread selected" "thread name"
#test tty
gdb_test "tty" "Argument required .filename to set it to\..*" "tty"
#test until "u" abbreviation
-gdb_test "u" "The program is not running." "until \"u\" abbreviation"
+gdb_test "u" "The program is not being run." "until \"u\" abbreviation"
#test until
-gdb_test "until" "The program is not running." "until"
+gdb_test "until" "The program is not being run." "until"
#test undisplay
# FIXME -- need to dump full output to detailed log
-send_gdb "undisplay\n"
-gdb_expect {
- -re "Delete all auto-display expressions.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "$gdb_prompt $" { pass "undisplay prompt" }
- timeout { fail "(timeout) (timeout) undisplay prompt" }
- }
- }
- timeout { fail "(timeout) (timeout) undisplay prompt" }
-}
+
+gdb_test "undisplay" \
+ "" \
+ "undisplay prompt" \
+ "Delete all auto-display expressions.*y or n. $" \
+ "y"
#test unset environment
-send_gdb "unset environment\n"
-gdb_expect {
- -re "Delete all environment variables?.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "$gdb_prompt $" { pass "unset environmentprompt" }
- timeout {
- fail "(timeout) (timeout) unset environment prompt"
- }
- }
- }
- timeout {
- fail "(timeout) (timeout) unset environment prompt"
- }
-}
+
+gdb_test "unset environment" \
+ "" \
+ "unset environment prompt" \
+ "Delete all environment variables?.*y or n. $" \
+ "y"
#test unset
gdb_test "unset" "\"unset\" must be followed by the name of an unset subcommand.(\[^\r\n\]*\[\r\n\])+List of unset subcommands:(\[^\r\n\]*\[\r\n\])+unset environment -- Cancel environment variable VAR for the program(\[^\r\n\]*\[\r\n\])+Type \"help unset\" followed by unset subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "unset"
#test where
gdb_test "where" "No stack." "where"
#test x
-#The case in which it prints a number is for vxgdb.
-send_gdb "x\n"
-gdb_expect {
- -re "0x0:.*Cannot access memory at address 0x0..*$gdb_prompt $" {
- pass "x"
- }
- -re "0x0:.*Error accessing memory address 0x0:.*$gdb_prompt $" {
- pass "x"
- }
- -re ".*$gdb_prompt $" { fail "x" }
- timeout { fail "(timeout) x" }
-}
+gdb_test "x" "Argument required .starting display address.*" "x"
gdb_exit
+
+set timeout $prev_timeout