| 1 | # Copyright 2012-2016 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 | |
| 16 | standard_testfile lspec.cc |
| 17 | |
| 18 | set execfile $testfile |
| 19 | |
| 20 | set baseone base/one/thefile.cc |
| 21 | set basetwo base/two/thefile.cc |
| 22 | |
| 23 | if {[skip_cplus_tests]} { |
| 24 | unsupported "skipping C++ tests" |
| 25 | return |
| 26 | } |
| 27 | |
| 28 | if {[prepare_for_testing "failed to prepare" $execfile \ |
| 29 | [list $srcfile $baseone $basetwo] \ |
| 30 | {debug nowarnings c++}]} { |
| 31 | return -1 |
| 32 | } |
| 33 | |
| 34 | gdb_test "skip function dupname" \ |
| 35 | {Function dupname will be skipped when stepping\.} |
| 36 | |
| 37 | if ![runto_main] { |
| 38 | return -1 |
| 39 | } |
| 40 | |
| 41 | set test "dupname ignored from main" |
| 42 | gdb_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 | |
| 51 | gdb_breakpoint "n" |
| 52 | gdb_continue_to_breakpoint "n" ".* dupname.* thefile breakpoint .*" |
| 53 | |
| 54 | set test "dupname ignored from n" |
| 55 | gdb_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 | |
| 64 | gdb_test_no_output "skip delete 1" |
| 65 | |
| 66 | gdb_test "skip file thefile.cc" \ |
| 67 | {File thefile\.cc will be skipped when stepping\.} |
| 68 | |
| 69 | if ![runto_main] { |
| 70 | return -1 |
| 71 | } |
| 72 | |
| 73 | gdb_test "step" "static int dupname .*" "step into dupname" |
| 74 | gdb_test "finish" "return dupname.* body_elsewhere.*" "finish from dupname" |
| 75 | |
| 76 | set test "dupname ignored for thefile.cc" |
| 77 | gdb_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 | } |