2018-01-01 05:43:02 +01:00
# Copyright 1988-2018 Free Software Foundation, Inc.
1999-04-16 03:35:26 +02: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
2007-08-23 20:14:19 +02:00
# the Free Software Foundation; either version 3 of the License, or
1999-04-16 03:35:26 +02:00
# (at your option) any later version.
2007-08-23 20:14:19 +02:00
#
1999-04-16 03:35:26 +02:00
# 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.
2007-08-23 20:14:19 +02:00
#
1999-04-16 03:35:26 +02:00
# You should have received a copy of the GNU General Public License
2007-08-23 20:14:19 +02:00
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1999-04-16 03:35:26 +02:00
# Start with a fresh gdb
gdb_exit
gdb_start
* gdb.base/call-strs.exp, gdb.base/default.exp,
gdb.base/ending-run.exp, gdb.base/finish.exp, gdb.base/funcargs.exp,
gdb.base/huge.exp, gdb.base/nodebug.exp, gdb.base/ptype.exp,
gdb.base/restore.exp, gdb.base/return.exp, gdb.base/setvar.exp,
gdb.base/watchpoints.exp, gdb.threads/gcore-thread.exp,
gdb.base/watchpoint-solib.exp: Save and restore timeout.
* gdb.base/ending-run.exp: Correct restore of timeout.
* gdb.base/page.exp: Remove unnecessary timeout setting.
2010-01-29 16:38:38 +01:00
set prev_timeout $timeout
1999-04-16 03:35:26 +02:00
set timeout 60
#
# test default actions of gdb commands
#
#load_lib gdb.exp
gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address" "add-symbol-file"
2002-03-29 02:19:11 +01:00
# test append
gdb_test "append" "\"append\" must be followed by a subcommand\.\[\r\n\]+List of append subcommands:.*"
gdb_test "append binary" "\"append binary\" must be followed by a subcommand\.\[\r\n\]+List of append binary subcommands:.*"
gdb_test "append memory" "Missing filename\."
gdb_test "append value" "Missing filename\."
gdb_test "append binary memory" "Missing filename\."
gdb_test "append binary value" "Missing filename\."
2011-12-03 21:20:29 +01:00
if !$use_gdb_stub {
2011-10-28 19:32:30 +02:00
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
}
1999-04-16 03:35:26 +02:00
}
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"
}
gdb_test "backtrace" "No stack."
1999-06-28 18:06:02 +02:00
# ba and bac are no longer unique command prefixes. So these tests
# elict an error from GDB.
# GDB needs to be fixed to map unique alias here for ba bac.
#
1999-04-16 03:35:26 +02:00
foreach i "bt ba bac" {
gdb_test $i "No stack." "backtrace \"$i\" abbreviation"
}
} else {
warning "Skipping backtrace and break tests because of GDB stub."
}
2012-02-13 19:09:59 +01:00
gdb_test "continue" "The program is not being run." "continue"
gdb_test "c" "The program is not being run." "continue \"c\" abbreviation"
1999-04-16 03:35:26 +02:00
#test call
gdb_test "call" "The history is empty..*" "call"
#test catch
gdb_test "catch" "Catch requires an event name..*" "catch"
#test cd
2013-09-10 09:32:25 +02:00
gdb_test "cd" "Working directory \[^\r\n\]*\(\r\n \\(canonically \[^\r\n\]*\\)\)?\\."
1999-04-16 03:35:26 +02:00
#test clear
gdb_test "clear" "No source file specified..*" "clear"
#test commands
2010-03-24 22:24:09 +01:00
gdb_test "commands" "Argument required .one or more breakpoint numbers...*" "commands"
1999-04-16 03:35:26 +02:00
#test condition
gdb_test "condition" "Argument required .breakpoint number.*" "condition"
#test core-file
2012-01-11 11:59:51 +01:00
gdb_test "core-file" "No core file now." "core-file"
1999-04-16 03:35:26 +02:00
#test delete "d" abbreviation
2010-06-01 23:29:21 +02:00
gdb_test_no_output "d" "delete \"d\" abbreviation"
1999-04-16 03:35:26 +02:00
#test delete
2010-06-01 23:29:21 +02:00
gdb_test_no_output "delete" "delete"
1999-04-16 03:35:26 +02:00
#test define
gdb_test "define" "Argument required \[(\]name of command to define\[)\]." "define"
#test delete breakpoints
2010-06-01 23:29:21 +02:00
gdb_test_no_output "delete breakpoints" "delete breakpoints"
1999-04-16 03:35:26 +02:00
#test delete display
# FIXME -- need to dump full output to detailed log
2010-05-25 00:06:59 +02:00
gdb_test "delete display" \
"" \
"delete display prompt" \
"Delete all auto-display expressions.*y or n. $" \
"y"
1999-04-16 03:35:26 +02:00
#test detach
2010-06-10 21:48:20 +02:00
gdb_test "detach" ".*" "detach"
1999-04-16 03:35:26 +02:00
#test directory
# FIXME -- need to dump full output to detailed log
2010-05-25 00:06:59 +02:00
gdb_test "directory" \
"Source directories searched: .cdir\[:;\].cwd.*" \
"directory prompt" \
"Reinitialize source path to empty.*y or n. $" \
"y"
1999-04-16 03:35:26 +02:00
#test disable "dis" abbreviation
2010-06-01 23:29:21 +02:00
gdb_test_no_output "dis" "disable \"dis\" abbreviation"
1999-04-16 03:35:26 +02:00
#test disable "disa" abbreviation
2010-06-01 23:29:21 +02:00
gdb_test_no_output "disa" "disable \"disa\" abbreviation"
1999-04-16 03:35:26 +02:00
#test disable
2010-06-01 23:29:21 +02:00
gdb_test_no_output "disable" "disable"
1999-04-16 03:35:26 +02:00
#test disable breakpoints
2010-06-01 23:29:21 +02:00
gdb_test_no_output "disable breakpoints" "disable breakpoints"
1999-04-16 03:35:26 +02:00
#test disable display
2010-06-01 23:29:21 +02:00
gdb_test_no_output "disable display" "disable display"
1999-04-16 03:35:26 +02:00
#test disassemble
gdb_test "disassemble" "No frame selected." "disassemble"
#test display
2010-06-01 23:29:21 +02:00
gdb_test_no_output "display" "display"
1999-04-16 03:35:26 +02:00
#test do
gdb_test "do" "No stack." "do"
#test document
gdb_test "document" "Argument required .name of command to define.*" "document"
#test down
gdb_test "down" "No stack.*" "down"
#test down-silently
gdb_test "down-silently" "No stack." "down-silently"
2002-03-29 02:19:11 +01:00
# test dump
gdb_test "dump" "\"dump\" must be followed by a subcommand\.\[\r\n\]+List of dump subcommands:.*"
gdb_test "dump binary" "\"dump binary\" must be followed by a subcommand\.\[\r\n\]+List of dump binary subcommands:.*"
gdb_test "dump ihex" "\"dump ihex\" must be followed by a subcommand\.\[\r\n\]+List of dump ihex subcommands:.*"
gdb_test "dump memory" "Missing filename\."
gdb_test "dump srec" "\"dump srec\" must be followed by a subcommand\.\[\r\n\]+List of dump srec subcommands:.*"
gdb_test "dump tekhex" "\"dump tekhex\" must be followed by a subcommand\.\[\r\n\]+List of dump tekhex subcommands:.*"
gdb_test "dump value" "Missing filename\."
gdb_test "dump binary memory" "Missing filename\."
gdb_test "dump binary value" "Missing filename\."
gdb_test "dump ihex memory" "Missing filename\."
gdb_test "dump ihex value" "Missing filename\."
gdb_test "dump srec memory" "Missing filename\."
gdb_test "dump srec value" "Missing filename\."
gdb_test "dump tekhex memory" "Missing filename\."
gdb_test "dump tekhex value" "Missing filename\."
1999-04-16 03:35:26 +02:00
#test echo
2010-06-01 23:29:21 +02:00
gdb_test_no_output "echo" "echo"
1999-04-16 03:35:26 +02:00
#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
2010-06-01 23:29:21 +02:00
gdb_test_no_output "enable breakpoints" "enable breakpoints"
1999-04-16 03:35:26 +02:00
#test enable delete
gdb_test "enable delete" "Argument required .one or more breakpoint numbers.*" "enable delete"
#test enable display
2010-06-01 23:29:21 +02:00
gdb_test_no_output "enable display" "enable display"
1999-04-16 03:35:26 +02:00
#test enable once
gdb_test "enable once" "Argument required .one or more breakpoint numbers.*" "enable once"
#test enable
2010-06-01 23:29:21 +02:00
gdb_test_no_output "enable" "enable"
1999-04-16 03:35:26 +02:00
#test exec-file
send_gdb "exec-file\n"
gdb_expect {
-re "No executable file now..*$gdb_prompt $" {
pass "exec-file"
}
-re "exec-file.*A program is being debugged already. Kill it. .y or n.*$" {
send_gdb "n\n"
if $verbose>1 then {
send_user "\tDidn't kill program being debugged\n"
}
gdb_expect -re "$gdb_prompt $" { }
pass "exec-file"
}
-re "$gdb_prompt $" { fail "exec-file" }
timeout { fail "(timeout) exec-file" }
}
#test frame "f" abbreviation
gdb_test "f" "No stack." "frame \"f\" abbreviation"
#test frame
gdb_test "frame" "No stack." "frame"
#test fg
gdb_test "fg" "The program is not being run." "fg"
2015-08-24 16:29:49 +02:00
1999-04-16 03:35:26 +02:00
#test file
send_gdb "file\n"
gdb_expect {
-re "No executable file now..*$gdb_prompt $"\
{ pass "file" }
-re ".*A program is being debugged already. Kill it. .y or n.*$" {
send_gdb "n\n"
if $verbose>1 then {
send_user "\t\tDidn't kill program being debugged\n"
}
gdb_expect -re "$gdb_prompt $" { }
pass "file"
}
-re ".*$gdb_prompt $" { fail "file" }
timeout { fail "(timeout) file" }
}
#test finish
2010-03-18 14:21:40 +01:00
gdb_test "finish" "The program is not being run." "finish"
1999-04-16 03:35:26 +02:00
#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"
2002-03-23 01:03:01 +01:00
#test gcore
2010-05-25 00:06:59 +02:00
gdb_test_multiple "gcore" "gcore" {
2002-03-23 01:03:01 +01:00
-re "You can\'t do that without a process to debug.*$gdb_prompt $" {
pass "gcore"
}
-re "Undefined command: .*$gdb_prompt $" {
pass "gcore"
}
}
2010-05-25 00:06:59 +02:00
gdb_test_multiple "generate-core-file" "generate-core-file" {
2002-03-23 01:03:01 +01:00
-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"
}
}
2010-05-25 00:06:59 +02:00
1999-04-16 03:35:26 +02:00
#test help "h" abbreviation
2002-02-04 19:02:25 +01:00
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"
1999-04-16 03:35:26 +02:00
#test help
2002-02-04 19:02:25 +01:00
gdb_test "help" "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"
1999-04-16 03:35:26 +02:00
#test handle
gdb_test "handle" "Argument required .signal to handle.*" "handle"
#test info "i" abbreviation
2002-02-04 19:02:25 +01:00
gdb_test "i" "\"info\" must be followed by the name of an info command.(\[^\r\n\]*\[\r\n\])+List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation"
1999-04-16 03:35:26 +02:00
#test info
2002-02-04 19:02:25 +01:00
gdb_test "info" "\"info\" must be followed by the name of an info command.(\[^\r\n\]*\[\r\n\])+List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "info"
1999-04-16 03:35:26 +02:00
#test ignore
gdb_test "ignore" "Argument required .a breakpoint number.*" "ignore"
#test info address
gdb_test "info address" "Argument required." "info address"
#test info all-registers
gdb_test "info all-registers" "The program has no registers now." "info all-registers"
#test info args
gdb_test "info args" "No frame selected." "info args"
#test info bogus-gdb-command
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 copying
# FIXME -- doesn't work worth a shit
#send_gdb "info copying"
# -re "GNU GENERAL PUBLIC LICENSE.*#of preserving the free status of all derivatives of our free software and.*#of promoting the sharing and reuse of software generally."#
gdb_test "info copying"
# }
#
#
#test info display
gdb_test "info display" "There are no auto-display expressions now." "info display"
#test info frame "f" abbreviation
gdb_test "info f" "No stack.*|No selected frame.*" "info frame \"f\" abbreviation"
#test info frame
gdb_test "info frame" "No stack.|No selected frame." "info frame"
#test info files
2010-06-01 23:29:21 +02:00
gdb_test_no_output "info files" "info files"
1999-04-16 03:35:26 +02:00
#test info float
2003-01-15 18:46:20 +01:00
gdb_test "info float" "The program has no registers now." "info float"
1999-04-16 03:35:26 +02:00
#test info functions
gdb_test "info functions" "All defined functions:" "info functions"
#test info locals
gdb_test "info locals" "No frame selected." "info locals"
#test info program
gdb_test "info program" "The program being debugged is not being run." "info program"
#test info registers
gdb_test "info registers" "The program has no registers now." "info registers"
#test info stack "s" abbreviation
gdb_test "info s" "No stack." "info stack \"s\" abbreviation"
#test info stack
gdb_test "info stack" "No stack." "info stack"
#test info set
2010-08-19 09:05:56 +02:00
# 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:
2001-05-23 21:04:13 +02:00
# prompt: Gdb's prompt is "(gdb) ".^M
2010-08-19 09:05:56 +02:00
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)"
}
}
}
1999-04-16 03:35:26 +02:00
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
2010-06-01 23:29:21 +02:00
gdb_test_no_output "info target" "info target"
1999-04-16 03:35:26 +02:00
#test info terminal
gdb_test "info terminal" "No saved terminal information." "info terminal"
2011-02-15 22:17:53 +01:00
# test info threads
gdb_test "info threads" "No threads." "info threads"
1999-04-16 03:35:26 +02:00
#test info types
gdb_test "info types" "All defined types:" "info types"
#test info variables
gdb_test "info variables" "All defined variables:" "info variables"
2003-01-15 18:46:20 +01:00
#test info vector
gdb_test "info vector" "The program has no registers now." "info vector"
1999-04-16 03:35:26 +02:00
#test info warranty
2007-08-23 22:36:15 +02:00
gdb_test "info warranty" "15. *Disclaimer of Warranty.*" "info warranty"
1999-04-16 03:35:26 +02:00
#test info watchpoints
2010-04-05 01:47:16 +02:00
gdb_test "info watchpoints" "No watchpoints." "info watchpoints"
1999-04-16 03:35:26 +02:00
#test inspect
gdb_test "inspect" "The history is empty." "inspect"
#test jump
gdb_test "jump" "The program is not being run." "jump"
#test kill
gdb_test "kill" "The program is not being run." "kill"
#test list "l" abbreviation
gdb_test "l" "No symbol table is loaded. Use the \"file\" command.*" "list \"l\" abbreviation"
#test list
gdb_test "list" "No symbol table is loaded. Use the \"file\" command.*" "list"
#test load
# The ``takes a file name'' case is for vxgdb.
# The ``Use the "file" command'' case is for newer GDB versions which try
# to deduce the filename from the exec file.
gdb_test "load" "You can't do that when your target is `None'.*|The load command takes a file name.*|Must specify at least a file name with the load command.*|.*Use the .file. or .exec-file. command.*" "load"
#test next "n" abbreviation
gdb_test "n" "The program is not being run." "next \"n\" abbreviation"
#test next
gdb_test "next" "The program is not being run." "next"
#test nexti "ni" abbreviation
gdb_test "ni" "The program is not being run." "nexti \"ni\" abbreviation"
#test nexti
gdb_test "nexti" "The program is not being run." "nexti"
#test output
gdb_test "output" "Argument required .expression to compute.*" "output"
#test overlay
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\"."
2010-06-01 23:29:21 +02:00
gdb_test_no_output "overlay manual" "overlay manual #1"
gdb_test_no_output "overlay auto"
gdb_test_no_output "overlay off"
1999-04-16 03:35:26 +02:00
gdb_test "overlay list" "No sections are mapped."
gdb_test "overlay map" "Overlay debugging not enabled.*" "overlay map #1"
2001-05-23 21:04:13 +02:00
gdb_test "overlay unmap" "Overlay debugging not enabled.*" "overlay unmap #1"
2010-06-01 23:29:21 +02:00
gdb_test_no_output "overlay manual" "overlay manual #2"
1999-04-16 03:35:26 +02:00
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"
#test print "p" abbreviation
gdb_test "p" "The history is empty." "print \"p\" abbreviation"
#test print
gdb_test "print" "The history is empty." "print"
#test printf
gdb_test "printf" "Argument required .format-control string and values to print.*" "printf"
#test ptype
gdb_test "ptype" "The history is empty." "ptype"
#test pwd
gdb_test "pwd" "Working directory .*" "pwd"
#test run "r" abbreviation
2011-12-03 21:20:29 +01:00
if $use_gdb_stub {
2011-10-28 19:32:30 +02:00
# Only extended-remote supports "run".
1999-04-16 03:35:26 +02:00
} else {
2010-05-25 00:06:59 +02:00
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" }
2012-02-02 19:05:35 +01:00
-re "Starting program: .*Running the default executable on the remote target failed; try \"set remote exec-file\"?.*$gdb_prompt $"\
{ pass "run \"r\" abbreviation" }
2010-05-25 00:06:59 +02:00
}
1999-04-16 03:35:26 +02:00
}
#test run
2011-12-03 21:20:29 +01:00
if $use_gdb_stub {
2011-10-28 19:32:30 +02:00
# Only extended-remote supports "run".
1999-04-16 03:35:26 +02:00
} else {
2010-05-25 00:06:59 +02:00
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" }
2012-02-02 19:05:35 +01:00
-re "Starting program: .*Running the default executable on the remote target failed; try \"set remote exec-file\"?.*$gdb_prompt $"\
{ pass "run" }
2010-05-25 00:06:59 +02:00
}
1999-04-16 03:35:26 +02:00
}
#test rbreak
2010-06-01 23:29:21 +02:00
gdb_test "rbreak" "rbreak"
1999-04-16 03:35:26 +02:00
2002-03-29 02:19:11 +01:00
# test restore
gdb_test "restore" "You can't do that without a process to debug\."
1999-04-16 03:35:26 +02:00
#test return
2002-05-04 17:18:21 +02:00
# The middle case accomodated the obsolete a29k, where doing the "ni"
2002-01-06 15:42:39 +01:00
# above causes an initial stack to be created.
1999-04-16 03:35:26 +02:00
gdb_test "return" "No selected frame..*" "return" "Make .* return now.*y or n. $" "y"
#test reverse-search
gdb_test "reverse-search" "No previous regular expression.*|There is no previous regular expression.*" "reverse-search"
#test step "s" abbreviation
gdb_test "s" "The program is not being run." "step \"s\" abbreviation #1"
#test step
gdb_test "step" "The program is not being run." "step #1"
#test search
gdb_test "search" "No previous regular expression.*|There is no previous regular expression.*" "search"
#test section
gdb_test "section" "Must specify section name and its virtual address.*" "section"
#test set annotate
gdb_test "set annotate" "Argument required .integer to set it to.*" "set annotate"
#test set args
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set args" "set args"
2012-08-17 19:37:03 +02:00
# 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"
}
1999-04-16 03:35:26 +02:00
#test set check range
2010-06-10 21:48:20 +02:00
gdb_test "set check range" ".*" "set check range"
1999-04-16 03:35:26 +02:00
#test set check type
2010-06-10 21:48:20 +02:00
gdb_test "set check type" ".*" "set check type"
1999-04-16 03:35:26 +02:00
#test set complaints
gdb_test "set complaints" "Argument required .integer to set it to.*" "set complaints"
#test set confirm
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set confirm" "set confirm"
1999-04-16 03:35:26 +02:00
# 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 environment
gdb_test "set environment" "Argument required .environment variable and value.*" "set environment"
#test set height
gdb_test "set height" "Argument required .integer to set it to.*" "set height"
#test set history expansion
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set history expansion" "set history expansion"
1999-04-16 03:35:26 +02:00
#test set history filename
gdb_test "set history filename" "Argument required .filename to set it to.*" "set history filename"
test suite update - gdb.base/[cd]
Convert files gdb.base/[cd]*.exp to use standard_output_file et al.
* call-ar-st.exp, call-rt-st.exp, call-sc.exp,
call-signal-resume.exp, call-strs.exp, callexit.exp,
callfuncs.exp, catch-load.exp, catch-syscall.exp, charset.exp,
checkpoint.exp, chng-syms.exp, code-expr.exp, code_elim.exp,
commands.exp, completion.exp, complex.exp, cond-expr.exp,
condbreak.exp, consecutive.exp, constvars.exp, corefile.exp,
ctxobj.exp, cursal.exp, cvexpr.exp, dbx.exp, default.exp,
define.exp, del.exp, detach.exp, dfp-test.exp, display.exp,
dmsym.exp, dump.exp, dup-sect.exp: Use standard_testfile,
standard_output_file, prepare_for_testing, clean_restart.
2013-06-27 20:49:03 +02:00
# Make sure the history ends up in the right place.
gdb_test_no_output "set history filename [standard_output_file .gdb_history]" \
"set the history filename"
1999-04-16 03:35:26 +02:00
#test set history save
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set history save" "set history save"
1999-04-16 03:35:26 +02:00
#test set history size
gdb_test "set history size" "Argument required .integer to set it to.*" "set history size"
#test set history
2002-02-04 19:02:25 +01:00
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"
1999-04-16 03:35:26 +02:00
#test set language
Make language_def O(1)
Profiling GDB with the rest of series applied, I saw calls to
language_def showing up high in some runs. The problem is that
language_def is O(N) currently, since walk the languages vector each
time to find the matching language_defn.
IMO, the add_language mechanism is pointless, because "enum language"
implies the core of GDB needs to know about all languages anyway. So
simply make the languages vector array be an array where each
element's index is the corresponding enum language enumerator. Note
that "local_language_defn" is gone along the way. It's just a copy of
"auto", so the new code simply maps one to the other. One fewer place
to update when we need to change the language vector...
Also, a while ago the output of "set language" was made out of order
as side effect of some other change. While I was at it, I made them
sorted again.
gdb/ChangeLog:
2017-07-20 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_language_defn): Make extern.
(_initialize_ada_language): Remove add_language call.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Make extern.
(_initialize_c_language): Delete.
* completer.c (compare_cstrings): Delete, moved to utils.h.
* d-lang.c (d_language_defn): Make extern.
(_initialize_d_language): Remove add_language calls.
* defs.h (enum language): Add comment.
* f-lang.c (f_language_defn): Make extern.
(_initialize_f_language): Remove add_language call.
* go-lang.c (go_language_defn): Make extern.
(_initialize_go_language): Remove add_language call.
* language.c: Include <algorithm>.
(languages): Redefine as const array.
(languages_size, languages_allocsize, DEFAULT_ALLOCSIZE): Delete.
(set_language_command): Handle "local". Use for-range loop.
(set_language): Remove loop.
(language_enum): Rewrite.
(language_def, language_str): Remove loops.
(add_language): Delete.
(add_set_language_command): New, based on add_languages.
(skip_language_trampoline): Adjust.
(local_language_defn): Delete.
(language_gdbarch_post_init): Adjust.
(_initialize_language): Remove add_language calls. Call
add_set_language_command.
* language.h (add_language): Delete.
(auto_language_defn)
(unknown_language_defn, minimal_language_defn, ada_language_defn)
(asm_language_defn, c_language_defn, cplus_language_defn)
(d_language_defn, f_language_defn, go_language_defn)
(m2_language_defn, objc_language_defn, opencl_language_defn)
(pascal_language_defn, rust_language_defn): Declare.
* m2-lang.c (m2_language_defn): Make extern.
(_initialize_m2_language): Remove add_language call.
* objc-lang.c (objc_language_defn): Make extern.
(_initialize_objc_language): Remove add_language call.
* opencl-lang.c (opencl_language_defn): Make extern.
(_initialize_opencl_language): Remove add_language call.
* p-lang.c (pascal_language_defn): Make extern.
(_initialize_pascal_language): Delete.
* rust-lang.c (rust_language_defn): Make extern.
(_initialize_rust_language): Delete.
* utils.h (compare_cstrings): New static inline function.
gdb/testsuite/ChangeLog:
2017-07-20 Pedro Alves <palves@redhat.com>
* gdb.base/default.exp (set language): Adjust expected output.
2017-07-20 19:28:01 +02:00
gdb_test "set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, asm, c, c.., d, fortran, go, minimal, modula-2, objective-c, opencl, pascal, rust." "set language"
1999-04-16 03:35:26 +02:00
#test set listsize
gdb_test "set listsize" "Argument required .integer to set it to.*" "set listsize"
#test set print "p" abbreviation
2002-02-04 19:02:25 +01:00
gdb_test "set p" "\"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 \"p\" abbreviation"
1999-04-16 03:35:26 +02:00
#test set print "pr" abbreviation
2002-02-04 19:02:25 +01:00
gdb_test "set pr" "\"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 \"pr\" abbreviation"
1999-04-16 03:35:26 +02:00
#test set print
2002-02-04 19:02:25 +01:00
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"
1999-04-16 03:35:26 +02:00
#test set print address
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set print address" "set print address"
1999-04-16 03:35:26 +02:00
#test set print array
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set print array" "set print array"
1999-04-16 03:35:26 +02:00
#test set print asm-demangle
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set print asm-demangle" "set print asm-demangle"
1999-04-16 03:35:26 +02:00
#test set print demangle
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set print demangle" "set print demangle"
1999-04-16 03:35:26 +02:00
#test set print elements
gdb_test "set print elements" "Argument required .integer to set it to.*" "set print elements"
#test set print object
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set print object" "set print object"
1999-04-16 03:35:26 +02:00
#test set print pretty
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set print pretty" "set print pretty"
1999-04-16 03:35:26 +02:00
#test set print sevenbit-strings
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set print sevenbit-strings" "set print sevenbit-strings"
1999-04-16 03:35:26 +02:00
#test set print union
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set print union" "set print union"
1999-04-16 03:35:26 +02:00
#test set print vtbl
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set print vtbl" "set print vtbl"
1999-04-16 03:35:26 +02:00
# 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 variable
gdb_test "set variable" "Argument required .expression to compute.*" "set variable"
#test set verbose
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set verbose" "set verbose"
1999-04-16 03:35:26 +02:00
#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.
2010-06-01 23:29:21 +02:00
gdb_test_no_output "set write" "set write"
1999-04-16 03:35:26 +02:00
#test set
gdb_test "set" "Argument required .expression to compute.*" "set"
#test shell echo Hi dad!
gdb_test "shell echo Hi dad!" "Hi dad!" "shell echo Hi dad!"
#test show annotate
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"
2012-08-17 19:37:03 +02:00
# 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"
}
1999-04-16 03:35:26 +02:00
#test show check range
gdb_test "show check range" "Range checking is \"auto; currently off\"." "show check range"
#test show check type
2012-08-17 19:37:03 +02:00
gdb_test "show check type" "Strict type checking is on\." "show check type"
1999-04-16 03:35:26 +02:00
#test show commands
2010-06-10 21:48:20 +02:00
gdb_test "show commands" ".*" "show commands"
1999-04-16 03:35:26 +02:00
#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"
2010-07-07 20:49:51 +02:00
1999-04-16 03:35:26 +02:00
#test show convenience
2012-08-13 16:31:00 +02:00
# 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 \
2010-07-07 20:49:51 +02:00
{ \
{$_sdata = void} \
{$_siginfo = void} \
{$_thread = 0} \
2016-01-13 11:56:10 +01:00
{$_gthread = 0} \
2016-01-13 11:56:05 +01:00
{$_inferior = 1} \
2013-04-15 20:09:02 +02:00
{$_exception = <error: No frame selected>} \
2012-04-27 22:52:06 +02:00
{$_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>} \
2013-09-17 21:24:51 +02:00
{$_isvoid = <internal function _isvoid>} \
2010-07-07 20:49:51 +02:00
}
2012-08-13 16:31:00 +02:00
if ![skip_python_tests] {
append show_conv_list \
{
{$_memeq = <internal function _memeq>} \
{$_regex = <internal function _regex>} \
{$_streq = <internal function _streq>} \
{$_strlen = <internal function _strlen>} \
2016-03-14 17:42:54 +01:00
{$_as_string = <internal function _as_string>} \
2014-09-09 08:01:01 +02:00
{$_caller_is = <internal function _caller_is>} \
{$_caller_matches = <internal function _caller_matches>} \
{$_any_caller_is = <internal function _any_caller_is>} \
{$_any_caller_matches = <internal function _any_caller_matches>} \
2012-08-13 16:31:00 +02:00
}
}
gdb_test_list_exact "show convenience" "show convenience" \
"\[^\r\n\]+\[\r\n\]+" \
"\[^\r\n\]+" \
$show_conv_list
2010-07-07 20:49:51 +02:00
1999-04-16 03:35:26 +02:00
#test show directories
2006-02-23 19:24:34 +01:00
gdb_test "show directories" "Source directories searched: .cdir\[:;\].cwd" "show directories"
1999-04-16 03:35:26 +02:00
#test show editing
gdb_test "show editing" "Editing of command lines as they are typed is o\[a-z\]*." "show editing"
#test show height
gdb_test "show height" "Number of lines gdb thinks are in a page is.*" "show height"
#test show history expansion
gdb_test "show history expansion" "History expansion on command input is o\[a-z\]*.*" "show history expansion"
#test show history filename
gdb_test "show history filename" "The filename in which to record the command history is.*.gdb_history.*" "show history filename"
#test show history save
gdb_test "show history save" "Saving of the history record on exit is on." "show history save"
#test show history size
gdb_test "show history size" "The size of the command history is.*" "show history size"
#test show history
2002-02-04 19:02:25 +01:00
gdb_test "show history" "expansion: *History expansion on command input is o(\[^\r\n\]*\[\r\n\])+filename: *The filename in which to record the command history is.*.gdb_history(\[^\r\n\]*\[\r\n\])+save: *Saving of the history record on exit is o(\[^\r\n\]*\[\r\n\])+size: * The size of the command history is.*" "show history"
1999-04-16 03:35:26 +02:00
#test show language
gdb_test "show language" "The current source language is \"auto; currently c\"." "show language"
#test show listsize
gdb_test "show listsize" "Number of source lines gdb will list by default is 10." "show listsize"
#test show print "p" abbreviation
gdb_test "show p" ".*" "show p"
#test show print "pr" abbreviation
gdb_test "show pr" ".*" "show pr"
#test show print
2010-06-10 21:48:20 +02:00
gdb_test "show print" ".*" "show print"
1999-04-16 03:35:26 +02:00
#test show paths
gdb_test "show paths" "Executable and object file path:.*" "show paths"
#test show print address
gdb_test "show print address" "Printing of addresses is on." "show print address"
#test show print array
2013-07-09 18:57:09 +02:00
gdb_test "show print array" "Pretty formatting of arrays is on." "show print array"
1999-04-16 03:35:26 +02:00
#test show print asm-demangle
2002-10-18 20:54:55 +02:00
gdb_test "show print asm-demangle" "Demangling of C\[+\]+/ObjC names in disassembly listings is on." "show print asm-demangle"
1999-04-16 03:35:26 +02:00
#test show print demangle
2002-10-18 20:54:55 +02:00
gdb_test "show print demangle" "Demangling of encoded C\[+\]+/ObjC names when displaying symbols is on." "show print demangle"
1999-04-16 03:35:26 +02:00
#test show print elements
gdb_test "show print elements" "Limit on string chars or array elements to print is 200." "show print elements"
#test show print object
gdb_test "show print object" "Printing of object's derived type based on vtable info is on." "show print object"
#test show print pretty
2013-07-09 18:57:09 +02:00
gdb_test "show print pretty" "Pretty formatting of structures is on." "show print pretty"
1999-04-16 03:35:26 +02:00
#test show print sevenbit-strings
gdb_test "show print sevenbit-strings" "Printing of 8-bit characters in strings as .nnn is on." "show print sevenbit-strings"
#test show print union
gdb_test "show print union" "Printing of unions interior to structures is on." "show print union"
#test show print vtbl
gdb_test "show print vtbl" "Printing of C\[+\]+ virtual function tables is on." "show print vtbl"
#test show prompt
# In the FAIL case, can't just look for $gdb_prompt because that will match
# the output, rather than the prompt. So look for $gdb_prompt at the start
# of a line.
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 user
2010-06-01 23:29:21 +02:00
gdb_test_no_output "show user" "show user"
1999-04-16 03:35:26 +02:00
#test show values
2010-06-01 23:29:21 +02:00
gdb_test_no_output "show values" "show values"
1999-04-16 03:35:26 +02:00
#test show verbose
gdb_test "show verbose" "Verbose printing of informational messages is o.*|Verbosity is off.*" "show verbose"
#test show version
Remove some text from --version output
I happened to notice recently that "gdb --version" says:
GNU gdb (GDB) 8.0.50.20170911-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
This is a bit on the wordy side, but also references interactive
commands, which I think doesn't really make sense for --version.
This patch removes some text from --version, while leaving it in the
"show version" output. It also adds a newline between the URLs and
the "For help, ..." text, because I thought that was easier to read.
Finally, it indents one of the URLs, since that was simpler to read,
but not the other URL, because the current format is specified by the
GNU coding standards section on "--version".
Now the --version output looks like:
GNU gdb (GDB) 8.1.50.20180511-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Tested by the buildbot.
gdb/ChangeLog
2018-06-05 Tom Tromey <tom@tromey.com>
* cli/cli-cmds.c (show_version): Update.
* top.c (print_gdb_version): Add "interactive" parameter.
Update.
* main.c (captured_main_1): Update.
* top.h (print_gdb_version): Add "interactive" parameter and a
comment.
gdb/testsuite/ChangeLog
2018-06-05 Tom Tromey <tom@tromey.com>
* gdb.base/default.exp: Update expected "show version" output.
2018-05-11 20:21:03 +02:00
gdb_test "show version" "GNU gdb \[0-9\.\]*(\[^\r\n\]*\[\r\n\])+Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc(\[^\r\n\]*\[\r\n\])+License GPLv3\\+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>(\[^\r\n\]*\[\r\n\])+This is free software: you are free to change and redistribute it.(\[^\r\n\]*\[\r\n\])+There is NO WARRANTY, to the extent permitted by law.(\[^\r\n\]*\[\r\n\])+Type \"show copying\" and \"show warranty\" for details..*" "show version"
1999-04-16 03:35:26 +02:00
#test show width
gdb_test "show width" "Number of characters gdb thinks are in a line is.*" "show width"
#test show write
# 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
2010-08-19 09:05:56 +02:00
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)"
}
}
}
2013-05-13 10:49:23 +02:00
#history saving should stay disabled
gdb_test_no_output "set history save off" "set history save off"
1999-04-16 03:35:26 +02:00
#test stepi "si" abbreviation
gdb_test "si" "The program is not being run." "stepi \"si\" abbreviation"
#test stepi
gdb_test "stepi" "The program is not being run." "stepi"
#test signal
gdb_test "signal" "The program is not being run." "signal"
#test source
2006-07-21 16:46:56 +02:00
gdb_test "source" "source command requires file name of file to source..*|No such file or directory.*" "source"
1999-04-16 03:35:26 +02:00
#test step "s" abbreviation
gdb_test "s" "The program is not being run." "step \"s\" abbreviation #2"
#test step
gdb_test "step" "The program is not being run." "step #2"
#test symbol-file
2010-06-10 21:48:20 +02:00
gdb_test "symbol-file" ".*" "symbol-file"
1999-04-16 03:35:26 +02:00
2014-05-21 19:30:43 +02:00
#test target native
2014-06-03 07:17:42 +02:00
gdb_test "target native" "Use the \"run\" command to start a process.*|Undefined target command: \"native\". *Try \"help target\".*" "target native"
1999-04-16 03:35:26 +02:00
#test target core
send_gdb "target core\n"
gdb_expect {
-re "No core file specified..*$gdb_prompt $" { pass "target core" }
-re ".*A program is being debugged already. Kill it. .y or n.*$" {
send_gdb "n\n"
if $verbose>1 then {
send_user "\t\tDidn't kill program being debugged\n"
}
gdb_expect -re "$gdb_prompt $" { }
pass "target core"
}
-re "Undefined target command: \"core\". Try \"help target\"..*$gdb_prompt $" { pass "target core" }
-re ".*$gdb_prompt $" { fail "target core" }
timeout { fail "(timeout) target core" }
}
#test target exec
send_gdb "target exec\n"
gdb_expect {
-re "No executable file now..*$gdb_prompt $"\
{ pass "target exec" }
-re ".*A program is being debugged already. Kill it. .y or n.*$" {
send_gdb "n\n"
if $verbose>1 then {
send_user "\t\tDidn't kill program being debugged\n"
}
gdb_expect -re "$gdb_prompt $" { }
pass "target exec"
}
-re ".*$gdb_prompt $" { fail "target exec" }
timeout { fail "(timeout) target exec" }
}
#test target remote
2015-08-24 16:29:49 +02:00
send_gdb "target remote\n"
gdb_expect {
-re "To open a remote debug connection, you need to specify what.*serial.*device is attached to the remote system.*.e.g. .*$gdb_prompt $"\
{ pass "target remote" }
-re ".*A program is being debugged already. Kill it. .y or n.*$" {
send_gdb "n\n"
if $verbose>1 then {
send_user "\t\tDidn't kill program being debugged\n"
1999-04-16 03:35:26 +02:00
}
2015-08-24 16:29:49 +02:00
gdb_expect -re "$gdb_prompt $" { }
pass "target remote"
1999-04-16 03:35:26 +02:00
}
2015-08-24 16:29:49 +02:00
-re ".*$gdb_prompt $" { fail "target remote" }
timeout { fail "(timeout) target remote" }
1999-04-16 03:35:26 +02:00
}
#test target
gdb_test "target" "Argument required .target name.*" "target"
#test tbreak
gdb_test "tbreak" "No default breakpoint address now." "tbreak"
2011-02-15 22:17:53 +01:00
#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"
1999-04-16 03:35:26 +02:00
#test until "u" abbreviation
2010-03-18 14:21:40 +01:00
gdb_test "u" "The program is not being run." "until \"u\" abbreviation"
1999-04-16 03:35:26 +02:00
#test until
2010-03-18 14:21:40 +01:00
gdb_test "until" "The program is not being run." "until"
1999-04-16 03:35:26 +02:00
#test undisplay
# FIXME -- need to dump full output to detailed log
2010-05-25 00:06:59 +02:00
gdb_test "undisplay" \
"" \
"undisplay prompt" \
"Delete all auto-display expressions.*y or n. $" \
"y"
1999-04-16 03:35:26 +02:00
#test unset environment
2010-05-25 00:06:59 +02:00
gdb_test "unset environment" \
"" \
"unset environment prompt" \
"Delete all environment variables?.*y or n. $" \
"y"
1999-04-16 03:35:26 +02:00
#test unset
2002-02-04 19:02:25 +01:00
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"
1999-04-16 03:35:26 +02:00
#test up
#test up-silently
gdb_test "up-silently" "No stack." "up-silently"
#test watch
gdb_test "watch" "Argument required .expression to compute.*" "watch"
#test whatis
gdb_test "whatis" "The history is empty." "whatis"
#test where
gdb_test "where" "No stack." "where"
#test x
2009-07-02 14:14:01 +02:00
gdb_test "x" "Argument required .starting display address.*" "x"
1999-04-16 03:35:26 +02:00
gdb_exit
* gdb.base/call-strs.exp, gdb.base/default.exp,
gdb.base/ending-run.exp, gdb.base/finish.exp, gdb.base/funcargs.exp,
gdb.base/huge.exp, gdb.base/nodebug.exp, gdb.base/ptype.exp,
gdb.base/restore.exp, gdb.base/return.exp, gdb.base/setvar.exp,
gdb.base/watchpoints.exp, gdb.threads/gcore-thread.exp,
gdb.base/watchpoint-solib.exp: Save and restore timeout.
* gdb.base/ending-run.exp: Correct restore of timeout.
* gdb.base/page.exp: Remove unnecessary timeout setting.
2010-01-29 16:38:38 +01:00
set timeout $prev_timeout