Use CXXCOMPILE in gold/testsuite/Makefile for c++ testcases
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / help.exp
CommitLineData
b811d2c2 1# Copyright 1988-2020 Free Software Foundation, Inc.
c906108c
SS
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
c906108c 6# (at your option) any later version.
e22f8b7c 7#
c906108c
SS
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
e22f8b7c 12#
c906108c 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 15
c906108c
SS
16# This file was written by Rob Savoye. (rob@cygnus.com)
17
5941debb
DE
18# Test basic help functionality.
19# This is not intended to test the help text of every command,
20# or even more than a few commands - too much of a maintenance burden.
c906108c
SS
21
22gdb_start
23
7c05caf7 24# Disable pagination.
5941debb 25gdb_test_no_output "set height 0" "disable pagination"
c906108c 26
5941debb 27# Test all the help classes.
a38cd180 28test_class_help "aliases" {"Aliases of other commands\.\[\r\n\]+"}
5941debb
DE
29test_class_help "breakpoints" {
30 "Making program stop at certain points\.\[\r\n\]+"
31}
d86bd7cb
TV
32with_read1_timeout_factor 10 {
33 test_class_help "data" {"Examining data\.\[\r\n\]+"}
34 test_class_help "files" {"Specifying and examining files\.\[\r\n\]+"}
35 test_class_help "internals" {
36 "Maintenance commands\.\[\r\n\]+"
37 "Some gdb commands are provided just for use by gdb maintainers\.\[\r\n\]+"
38 "These commands are subject to frequent change, and may not be as\[\r\n\]+"
39 "well documented as user commands\.\[\r\n\]+"
40 }
5941debb
DE
41}
42test_class_help "obscure" {"Obscure features\.\[\r\n\]+"}
43test_class_help "running" {"Running the program\.\[\r\n\]+"}
44test_class_help "stack" {
45 "Examining the stack\..*\[\r\n\]+"
46 "When the program being debugged stops, gdb selects the innermost frame\.\[\r\n\]+"
47 "The commands below can be used to select other frames by number or address\.\[\r\n\]+"
48}
d86bd7cb
TV
49with_read1_timeout_factor 10 {
50 test_class_help "status" {
51 "Status inquiries\.\[\r\n\]+"
52 }
53 test_class_help "support" {"Support facilities\.\[\r\n\]+"}
54 test_class_help "tracepoints" {
55 "Tracing of program execution without stopping the program\.\[\r\n\]+"
56 }
5941debb 57}
206584bd 58
d86bd7cb
TV
59with_read1_timeout_factor 10 {
60 test_user_defined_class_help
a38cd180 61
d86bd7cb
TV
62 # Test help of an abbreviated command. "break" is picked at random.
63 set help_breakpoint_text "Set breakpoint at specified location\..*"
7c05caf7 64 # Test help breakpoint "b" abbreviation.
d86bd7cb 65 gdb_test "help b" $help_breakpoint_text "help breakpoint \"b\" abbreviation"
7c05caf7 66 # Test help breakpoint "br" abbreviation.
d86bd7cb 67 gdb_test "help br" $help_breakpoint_text "help breakpoint \"br\" abbreviation"
7c05caf7 68 # Test help breakpoint "bre" abbreviation;
d86bd7cb 69 gdb_test "help bre" $help_breakpoint_text "help breakpoint \"bre\" abbreviation"
7c05caf7 70 # Test help breakpoint "brea" abbreviation.
d86bd7cb 71}
5941debb 72gdb_test "help brea" $help_breakpoint_text "help breakpoint \"brea\" abbreviation"
7c05caf7 73# Test help breakpoint "break" abbreviation.
5941debb
DE
74gdb_test "help break" $help_breakpoint_text "help breakpoint \"break\" abbreviation"
75
76# Test help of an aliased command. "bt" is picked at random.
77set help_backtrace_text "Print backtrace of all stack frames, or innermost COUNT frames\..*"
7c05caf7 78# Test help backtrace "bt" abbreviation.
5941debb 79gdb_test "help bt" $help_backtrace_text "help backtrace \"bt\" abbreviation"
7c05caf7 80# Test help backtrace.
11af934b 81gdb_test "help backtrace" $help_backtrace_text
5941debb 82
7c05caf7 83# Test help commands.
11af934b 84gdb_test "help commands" "Set commands to be executed when the given breakpoints are hit\.\[\r\n\]+Give a space-separated breakpoint list as argument after \"commands\"\.\[\r\n\]+A list element can be a breakpoint number \\(e.g. `5'\\) or a range of numbers\[\r\n\]+\\(e.g. `5-7'\\)\.\[\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\."
5941debb
DE
85
86# Test a prefix command. "delete" is picked at random.
7c05caf7 87# Test help delete "d" abbreviation.
a38cd180 88set expected_help_delete {
590042fc
PW
89 "Delete all or some breakpoints\.\[\r\n\]+"
90 "Usage: delete \\\[BREAKPOINTNUM\\\]...\[\r\n\]+"
a38cd180
VP
91 "Arguments are breakpoint numbers with spaces in between\.\[\r\n\]+"
92 "To delete all breakpoints, give no argument\.\[\r\n\]+"
93 "Also a prefix command for deletion of other GDB objects\.\[\r\n\]+"
a38cd180
VP
94}
95test_prefix_command_help {"d" "delete"} $expected_help_delete "help delete \"d\" abbreviation"
7c05caf7 96# Test help delete.
a38cd180 97test_prefix_command_help "delete" $expected_help_delete
5941debb
DE
98
99# Make sure help for help itself is present.
7c05caf7 100# Test help help "h" abbreviation.
523ac3f9 101gdb_test "help h" "Print list of commands\." "help help \"h\" abbreviation"
7c05caf7 102# Test help help.
11af934b 103gdb_test "help help" "Print list of commands\."
5941debb
DE
104
105# The startup banner refers to "show copying" and "show warranty",
106# might as well test for them.
7c05caf7 107# Test help info copying.
11af934b 108gdb_test "help show copying" "Conditions for redistributing copies of GDB\."
7c05caf7 109# Test help info warranty.
11af934b 110gdb_test "help show warranty" "Various kinds of warranty you do not have\."
a451cb65 111
5941debb 112# Test a few other random "help show" commands.
7c05caf7 113# Test help show commands.
11af934b 114gdb_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\."
7c05caf7 115# Test help show confirm.
11af934b 116gdb_test "help show confirm" "Show whether to confirm potentially dangerous operations\."
96b3d632 117
7c05caf7 118# Test help info bogus-gdb-command.
11af934b 119gdb_test "help info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\"\. Try \"help info\"\."
7c05caf7 120# Test help gotcha.
11af934b 121gdb_test "help gotcha" "Undefined command: \"gotcha\"\. Try \"help\"\."
5941debb 122
7c05caf7 123# Test apropos regex.
590042fc 124gdb_test "apropos \\\(print\[\^\[ bsiedf\\\".-\]\\\)" "handle -- Specify how to handle signals\."
7c05caf7 125# Test apropos >1 word string.
590042fc 126gdb_test "apropos handle signal" "handle -- Specify how to handle signals\."
7c05caf7 127# Test apropos apropos.
ed3ef339 128gdb_test "apropos apropos" "apropos -- Search for commands matching a REGEXP.*"
7c05caf7
PW
129
130# Test apropos for commands having aliases.
131gdb_test "apropos Print backtrace of all stack frames, or innermost COUNT frames\." \
132 "backtrace, where, bt -- Print backtrace of all stack frames, or innermost COUNT frames\."
133
134# Test help for commands having aliases.
135gdb_test "help bt" "backtrace, where, bt\[\r\n\]+Print backtrace of all stack frames, or innermost COUNT frames\..*"
This page took 2.149961 seconds and 4 git commands to generate.