2012-01-04 08:17:56 +00:00
# Copyright 1988, 1990-1992, 1994-2000, 2002-2003, 2005-2012 Free
# Software Foundation, Inc.
1999-04-16 01:35:26 +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
2007-08-23 18:14:19 +00:00
# the Free Software Foundation; either version 3 of the License, or
1999-04-16 01:35:26 +00:00
# (at your option) any later version.
2007-08-23 18:14:19 +00:00
#
1999-04-16 01:35:26 +00: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 18:14:19 +00:00
#
1999-04-16 01:35:26 +00:00
# You should have received a copy of the GNU General Public License
2007-08-23 18:14:19 +00:00
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1999-04-16 01:35:26 +00:00
# This file was written by Rob Savoye. (rob@cygnus.com)
2012-09-12 18:55:49 +00:00
# Test basic help functionality.
# This is not intended to test the help text of every command,
# or even more than a few commands - too much of a maintenance burden.
1999-04-16 01:35:26 +00:00
gdb_start
2012-09-12 18:55:49 +00:00
# disable pagination
gdb_test_no_output "set height 0" "disable pagination"
1999-04-16 01:35:26 +00:00
2012-09-12 18:55:49 +00:00
# Test all the help classes.
2006-11-09 19:22:11 +00:00
test_class_help "aliases" {"Aliases of other commands\.\[\r\n\]+"}
2012-09-12 18:55:49 +00:00
test_class_help "breakpoints" {
"Making program stop at certain points\.\[\r\n\]+"
}
test_class_help "data" {"Examining data\.\[\r\n\]+"}
test_class_help "files" {"Specifying and examining files\.\[\r\n\]+"}
test_class_help "internals" {
"Maintenance commands\.\[\r\n\]+"
"Some gdb commands are provided just for use by gdb maintainers\.\[\r\n\]+"
"These commands are subject to frequent change, and may not be as\[\r\n\]+"
"well documented as user commands\.\[\r\n\]+"
}
test_class_help "obscure" {"Obscure features\.\[\r\n\]+"}
test_class_help "running" {"Running the program\.\[\r\n\]+"}
test_class_help "stack" {
"Examining the stack\..*\[\r\n\]+"
"When the program being debugged stops, gdb selects the innermost frame\.\[\r\n\]+"
"The commands below can be used to select other frames by number or address\.\[\r\n\]+"
}
test_class_help "status" {
"Status inquiries\.\[\r\n\]+"
}
test_class_help "support" {"Support facilities\.\[\r\n\]+"}
test_class_help "tracepoints" {
"Tracing of program execution without stopping the program\.\[\r\n\]+"
}
test_class_help "user-defined" {
"User-defined commands\.\[\r\n\]+"
"The commands in this class are those defined by the user\.\[\r\n\]+"
"Use the \"define\" command to define a command\.\[\r\n\]+"
}
2006-11-09 19:22:11 +00:00
2012-09-12 18:55:49 +00:00
# Test help of an abbreviated command. "break" is picked at random.
set help_breakpoint_text "Set breakpoint at specified line or function\..*"
1999-04-16 01:35:26 +00:00
# test help breakpoint "b" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help b" $help_breakpoint_text "help breakpoint \"b\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help breakpoint "br" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help br" $help_breakpoint_text "help breakpoint \"br\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help breakpoint "bre" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help bre" $help_breakpoint_text "help breakpoint \"bre\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help breakpoint "brea" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help brea" $help_breakpoint_text "help breakpoint \"brea\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help breakpoint "break" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help break" $help_breakpoint_text "help breakpoint \"break\" abbreviation"
# Test help of an aliased command. "bt" is picked at random.
set help_backtrace_text "Print backtrace of all stack frames, or innermost COUNT frames\..*"
1999-04-16 01:35:26 +00:00
# test help backtrace "bt" abbreviation
2012-09-12 18:55:49 +00:00
gdb_test "help bt" $help_backtrace_text "help backtrace \"bt\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help backtrace
2012-09-12 18:55:49 +00:00
gdb_test "help backtrace" $help_backtrace_text "help backtrace"
1999-04-16 01:35:26 +00:00
# test help commands
2002-03-26 05:10:26 +00:00
gdb_test "help commands" "Set commands to be executed when a breakpoint is hit\.\[\r\n\]+Give breakpoint number as argument after \"commands\"\.\[\r\n\]+With no argument, the targeted breakpoint is the last one set\.\[\r\n\]+The commands themselves follow starting on the next line\.\[\r\n\]+Type a line containing \"end\" to indicate the end of them\.\[\r\n\]+Give \"silent\" as the first line to make the breakpoint silent;\[\r\n\]+then no output is printed when it is hit, except what the commands print\." "help commands"
2012-09-12 18:55:49 +00:00
# Test a prefix command. "delete" is picked at random.
1999-04-16 01:35:26 +00:00
# test help delete "d" abbreviation
2006-11-09 19:22:11 +00:00
set expected_help_delete {
"Delete some breakpoints or auto-display expressions\.\[\r\n\]+"
"Arguments are breakpoint numbers with spaces in between\.\[\r\n\]+"
"To delete all breakpoints, give no argument\.\[\r\n\]+"
"Also a prefix command for deletion of other GDB objects\.\[\r\n\]+"
"The \"unset\" command is also an alias for \"delete\"\.\[\r\n\]+"
}
test_prefix_command_help {"d" "delete"} $expected_help_delete "help delete \"d\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help delete
2006-11-09 19:22:11 +00:00
test_prefix_command_help "delete" $expected_help_delete
2012-09-12 18:55:49 +00:00
# Make sure help for help itself is present.
1999-04-16 01:35:26 +00:00
# test help help "h" abbreviation
2002-03-26 05:10:26 +00:00
gdb_test "help h" "Print list of commands\." "help help \"h\" abbreviation"
1999-04-16 01:35:26 +00:00
# test help help
2002-03-26 05:10:26 +00:00
gdb_test "help help" "Print list of commands\." "help help"
2012-09-12 18:55:49 +00:00
# The startup banner refers to "show copying" and "show warranty",
# might as well test for them.
1999-04-16 01:35:26 +00:00
# test help info copying
2012-09-12 18:55:49 +00:00
gdb_test "help show copying" "Conditions for redistributing copies of GDB\." \
"help show copying"
1999-04-16 01:35:26 +00:00
# test help info warranty
2012-09-12 18:55:49 +00:00
gdb_test "help show warranty" "Various kinds of warranty you do not have\." \
"help show warranty"
2012-08-17 17:37:03 +00:00
2012-09-12 18:55:49 +00:00
# Test a few other random "help show" commands.
1999-04-16 01:35:26 +00:00
# test help show commands
2002-03-26 05:10:26 +00:00
gdb_test "help show commands" "Show the history of commands you typed\.\[\r\n\]+You can supply a command number to start with, or a `\[+\]' to start after\[\r\n\]+the previous command number shown\." "help show commands"
1999-04-16 01:35:26 +00:00
# test help show confirm
2002-03-26 05:10:26 +00:00
gdb_test "help show confirm" "Show whether to confirm potentially dangerous operations\." "help show confirm"
2002-04-24 03:07:33 +00:00
1999-04-16 01:35:26 +00:00
# test help info bogus-gdb-command
2002-03-26 05:10:26 +00:00
gdb_test "help info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\"\. Try \"help info\"\." "help info bogus-gdb-command"
1999-04-16 01:35:26 +00:00
# test help gotcha
2002-03-26 05:10:26 +00:00
gdb_test "help gotcha" "Undefined command: \"gotcha\"\. Try \"help\"\." "help gotcha"
2012-09-12 18:55:49 +00:00
2000-03-23 23:21:27 +00:00
# test apropos regex
2012-08-23 16:59:14 +00:00
gdb_test "apropos \\\(print\[\^ bsiedf\\\".-\]\\\)" "handle -- Specify how to handle signals"
2000-03-23 23:21:27 +00:00
# test apropos >1 word string
2012-08-23 16:59:14 +00:00
gdb_test "apropos handle signal" "handle -- Specify how to handle signals"
2000-03-23 23:21:27 +00:00
# test apropos apropos
gdb_test "apropos apropos" "apropos -- Search for commands matching a REGEXP"