xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.linespec/skip-two.exp (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1# Copyright 2012-2023 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 3 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, see <http://www.gnu.org/licenses/>.
15
16standard_testfile lspec.cc
17
18set execfile $testfile
19
20set baseone base/one/thefile.cc
21set basetwo base/two/thefile.cc
22
23if {[skip_cplus_tests]} {
24    unsupported "skipping C++ tests"
25    return
26}
27
28if {[prepare_for_testing "failed to prepare" $execfile \
29	 [list $srcfile $baseone $basetwo] \
30	 {debug nowarnings c++}]} {
31    return -1
32}
33
34gdb_test "skip function dupname" \
35	 {Function dupname will be skipped when stepping\.}
36
37if ![runto_main] {
38    return -1
39}
40
41set test "dupname ignored from main"
42gdb_test_multiple "step" $test {
43    -re "^step\r\ndupname .*\r\n$gdb_prompt $" {
44	fail $test
45    }
46    -re "^step\r\nm .*\r\n$gdb_prompt $" {
47	pass $test
48    }
49}
50
51gdb_breakpoint "n"
52gdb_continue_to_breakpoint "n" ".* dupname.* thefile breakpoint .*"
53
54set test "dupname ignored from n"
55gdb_test_multiple "step" $test {
56    -re "^step\r\ndupname .*\r\n$gdb_prompt $" {
57	fail $test
58    }
59    -re "^step\r\n\[^\r\n\]* after dupname .*\r\n$gdb_prompt $" {
60	pass $test
61    }
62}
63
64gdb_test_no_output "skip delete 1"
65
66gdb_test "skip file thefile.cc" \
67	 {File thefile\.cc will be skipped when stepping\.}
68
69if ![runto_main] {
70    return -1
71}
72
73gdb_test "step" "static int dupname .*" "step into dupname"
74gdb_test "finish" "return dupname.* body_elsewhere.*" "finish from dupname"
75
76set test "dupname ignored for thefile.cc"
77gdb_test_multiple "step" $test {
78    -re "^step\r\ndupname .*\r\n$gdb_prompt $" {
79	fail $test
80    }
81    -re "^step\r\nf1 .* f1 breakpoint .*\r\n$gdb_prompt $" {
82	pass $test
83    }
84}
85