blob: f94972cf208c89eacaf47e9433e4c25355de5a4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# Test the alias command.
# Copyright 2011-2014 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
# Helper to test the -a option to alias.
# Aliases that are abbreviations of commands (e.g. r -> run)
# do not appear in help output.
proc test_abbrev_not_present { alias_name } {
global gdb_prompt
set alias_present 0
set test_name "abbrev $alias_name not present in help command list"
gdb_test_multiple "help aliases" $test_name {
-re "\[\r\n\]$alias_name \[^\r\n\]*" {
set alias_present 1
exp_continue
}
-re ".*$gdb_prompt $" {
if { !$alias_present } then {
pass $test_name
} else {
fail $test_name
}
}
}
}
proc test_abbrev_alias { name gdb_command test_value } {
gdb_test_no_output $gdb_command
gdb_test_no_output "$name print elements $test_value"
gdb_test "show print elements" "Limit .* is $test_value\[.\]" "verify $name"
test_abbrev_not_present $name
}
test_abbrev_alias set2 "alias -a set2=set" 42
test_abbrev_alias set3 "alias -a set3= set" 43
test_abbrev_alias set4 "alias -a set4 =set" 44
test_abbrev_alias set5 "alias -a set5 = set" 45
test_abbrev_alias set6 "alias -a -- set6 = set" 46
test_abbrev_alias -a "alias -a -- -a = set" 47
gdb_test "alias set2=set" "already exists: set2"
gdb_test "alias foo=bar" "Invalid command to alias to: bar"
gdb_test_no_output "alias spe = set p elem"
gdb_test_no_output "spe 50"
gdb_test "show print elements" "Limit .* is 50\[.\]" "verify spe"
gdb_test_no_output "alias set pr elms = set p elem"
gdb_test_no_output "set pr elms 51"
gdb_test "show print elements" "Limit .* is 51\[.\]" "verify set pr elms"
gdb_test "help set print" "set print elms .*"
|