OSDN Git Service

* gdb.base/del.exp (test_delete_alias): New function.
[pf3gnuchains/pf3gnuchains3x.git] / gdb / testsuite / gdb.base / del.exp
1 # Copyright 2006 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7
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.
12
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
16
17 # The intent of this testcase it to verify that various aliases and
18 # shortcuts of the "delete" command never stop working.
19
20 if $tracelevel then {
21     strace $tracelevel
22 }
23
24 set prms_id 0
25 set bug_id 0
26
27 set testfile del
28 set srcfile ${testfile}.c
29 set binfile ${objdir}/${subdir}/${testfile}
30 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
31     untested "Couldn't compile test program"
32     return -1
33 }
34
35 # Get things started.
36
37 gdb_exit
38 gdb_start
39 gdb_reinitialize_dir $srcdir/$subdir
40 gdb_load ${binfile}
41
42 # A function to test that ALIAS is working as a shortcut of the "delete"
43 # command.
44
45 proc test_delete_alias { alias } {
46     global srcfile
47
48     # First of all, remove all previous breakpoints if there were any,
49     # and then verify that we do not have any breakpoint lying around.
50     gdb_test "delete" \
51              "" \
52              "Remove all breakpoints ($alias)"
53     gdb_test "info break" \
54              "No breakpoints or watchpoints." \
55              "info break after removing break on main"
56
57     
58     # Now, insert a breakpoint at an easy location, and then remove it
59     # using $alias. We verified that the removal worked by checking
60     # the list of breakpoints.
61     gdb_test "break main" \
62              "Breakpoint.*at.* file .*$srcfile, line.*" \
63              "breakpoint insertion ($alias)"
64     
65     gdb_test "$alias \$bpnum" \
66              "" \
67              "Remove last breakpoint ($alias)"
68     
69     gdb_test "info break" \
70              "No breakpoints or watchpoints." \
71              "info break after removing break on main ($alias)"
72 }
73
74 # Test various shortcut forms of the "delete" command.
75
76 test_delete_alias "del"
77 test_delete_alias "d"
78