break-ask.exp revision 1.1.1.1
1# Copyright 2013 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 18if {[skip_cplus_tests]} { 19 unsupported ${testfile}.exp 20 return 21} 22 23set opts {debug c++} 24set objfile1 [standard_output_file ${testfile}one.o] 25set objfile2 [standard_output_file ${testfile}two.o] 26 27if { [file pathtype $objdir] == "relative" } { 28 untested "objdir $objdir should be absolute" 29 return 30} 31set saved_pwd [pwd] 32cd $srcdir/${subdir}/base/one 33set err1 [gdb_compile "thefile.cc" $objfile1 object $opts] 34cd $saved_pwd 35cd $srcdir/${subdir}/base/two 36set err2 [gdb_compile "thefile.cc" $objfile2 object $opts] 37cd $saved_pwd 38if { $err1 != "" || $err2 != "" } { 39 untested "compilation failed" 40 return -1 41} 42 43if { [gdb_compile "$srcdir/${subdir}/$srcfile $objfile1 $objfile2" \ 44 $binfile executable $opts] != "" } { 45 return -1 46} 47 48clean_restart ${testfile} 49 50gdb_test_no_output "set multiple-symbols ask" 51 52gdb_test_no_output "set filename-display absolute" 53set cmd "break twodup" 54set test "break twodup absolute" 55gdb_test_multiple $cmd $test { 56 -re "^$cmd\r\n\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] \[^\r\n\]+/base/one/thefile\\.cc:twodup\\\(\\\)\r\n\\\[3\\\] \[^\r\n\]+/base/two/thefile\\.cc:twodup\\\(\\\)\r\n> $" { 57 pass $test 58 } 59} 60gdb_test "0" "canceled" 61 62gdb_test_no_output "set filename-display relative" 63 64set cmd "break twodup" 65set test "break twodup relative" 66gdb_test_multiple $cmd $test { 67 -re "^$cmd\r\n\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] thefile\\.cc:twodup\\\(\\\)\r\n\\\[3\\\] thefile\\.cc:twodup\\\(\\\)\r\n> $" { 68 pass $test 69 } 70} 71gdb_test "2" "^2\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\." 72 73gdb_breakpoint "body_elsewhere" 74 75gdb_run_cmd 76gdb_test "" "Breakpoint \[0-9\]+, twodup \\(\\) at thefile.cc:\[0-9\]+\r\n.*" "expect breakpoint" 77 78gdb_test "info source" "\r\nLocated in \[^\r\n\]+/base/one/thefile\\.cc\r\n.*" 79 80gdb_continue_to_breakpoint "body_elsewhere" ".* body_elsewhere marker .*" 81 82delete_breakpoints 83 84set cmd "break twodup" 85set test "break twodup relative other" 86gdb_test_multiple $cmd $test { 87 -re "^$cmd\r\n\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] thefile\\.cc:twodup\\\(\\\)\r\n\\\[3\\\] thefile\\.cc:twodup\\\(\\\)\r\n> $" { 88 pass $test 89 } 90} 91gdb_test "3" "^3\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\." 92 93gdb_breakpoint "body_elsewhere" 94 95gdb_run_cmd 96gdb_test "" "Breakpoint \[0-9\]+, twodup \\(\\) at thefile.cc:\[0-9\]+\r\n.*" "expect breakpoint other" 97 98gdb_test "info source" "\r\nLocated in \[^\r\n\]+/base/two/thefile\\.cc\r\n.*" "info source other" 99 100gdb_continue_to_breakpoint "body_elsewhere other" ".* body_elsewhere marker .*" 101