Support R_SPARC_WDISP10 and R_SPARC_H34.
[external/binutils.git] / gdb / testsuite / gdb.base / alias.exp
1 # Test the alias command.
2 # Copyright 2011-2012 Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 gdb_exit
18 gdb_start
19 gdb_reinitialize_dir $srcdir/$subdir
20
21 # Helper to test the -a option to alias.
22 # Aliases that are abbreviations of commands (e.g. r -> run)
23 # do not appear in help output.
24
25 proc test_abbrev_not_present { alias_name } {
26     global gdb_prompt
27     set alias_present 0
28     set test_name "abbrev $alias_name not present in help command list"
29     gdb_test_multiple "help aliases" $test_name {
30         -re "\[\r\n\]$alias_name \[^\r\n\]*" {
31             set alias_present 1
32             exp_continue
33         }
34         -re ".*$gdb_prompt $" {
35             if { !$alias_present } then {
36                 pass $test_name
37             } else {
38                 fail $test_name
39             }
40         }
41     }
42 }
43
44 proc test_abbrev_alias { name gdb_command test_value } {
45     gdb_test_no_output $gdb_command
46     gdb_test_no_output "$name print elements $test_value"
47     gdb_test "show print elements" "Limit .* is $test_value\[.\]" "verify $name"
48     test_abbrev_not_present $name
49 }
50
51 test_abbrev_alias set2 "alias -a set2=set" 42
52 test_abbrev_alias set3 "alias -a set3= set" 43
53 test_abbrev_alias set4 "alias -a set4 =set" 44
54 test_abbrev_alias set5 "alias -a set5 = set" 45
55 test_abbrev_alias set6 "alias -a -- set6 = set" 46
56 test_abbrev_alias -a "alias -a -- -a = set" 47
57
58 gdb_test "alias set2=set" "already exists: set2"
59 gdb_test "alias foo=bar" "Invalid command to alias to: bar"
60
61 gdb_test_no_output "alias spe = set p elem"
62 gdb_test_no_output "spe 50"
63 gdb_test "show print elements" "Limit .* is 50\[.\]" "verify spe"
64
65 gdb_test_no_output "alias set pr elms = set p elem"
66 gdb_test_no_output "set pr elms 51"
67 gdb_test "show print elements" "Limit .* is 51\[.\]" "verify set pr elms"
68 gdb_test "help set print" "set print elms .*"