1*1424dfb3Schristos# Copyright (C) 2011-2020 Free Software Foundation, Inc. 207163879Schristos# 307163879Schristos# This program is free software; you can redistribute it and/or modify 407163879Schristos# it under the terms of the GNU General Public License as published by 507163879Schristos# the Free Software Foundation; either version 3 of the License, or 607163879Schristos# (at your option) any later version. 707163879Schristos# 807163879Schristos# This program is distributed in the hope that it will be useful, 907163879Schristos# but WITHOUT ANY WARRANTY; without even the implied warranty of 1007163879Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1107163879Schristos# GNU General Public License for more details. 1207163879Schristos# 1307163879Schristos# You should have received a copy of the GNU General Public License 1407163879Schristos# along with this program. If not, see <http://www.gnu.org/licenses/>. 1507163879Schristos 1607163879Schristos# Test "save breakpoints" + "break -qualified". 1707163879Schristos 1807163879Schristosstandard_testfile .cc 1907163879Schristos 2007163879Schristosif { [build_executable "failed to prepare" ${testfile} $srcfile {debug c++}] } { 2107163879Schristos return -1 2207163879Schristos} 2307163879Schristos 2407163879Schristosproc restart {} { 2507163879Schristos global testfile 2607163879Schristos 2707163879Schristos clean_restart $testfile 2807163879Schristos 2907163879Schristos if ![runto_main] { 3007163879Schristos untested "could not run to main" 3107163879Schristos return 0 3207163879Schristos } 3307163879Schristos # Delete all breakpoints so that the "runto_main" breakpoint above 3407163879Schristos # does not interfere with our testing. 3507163879Schristos delete_breakpoints 3607163879Schristos 3707163879Schristos return 1 3807163879Schristos} 3907163879Schristos 4007163879Schristoswith_test_prefix "save" { 4107163879Schristos if ![restart] { 4207163879Schristos return -1 4307163879Schristos } 4407163879Schristos 4507163879Schristos gdb_breakpoint "function" qualified 4607163879Schristos gdb_breakpoint "function" 4707163879Schristos 4807163879Schristos # Save the breakpoints into a file. 4907163879Schristos if {[is_remote host]} { 5007163879Schristos set bps bps 5107163879Schristos } else { 5207163879Schristos set bps [standard_output_file bps] 5307163879Schristos } 5407163879Schristos remote_file host delete "$bps" 5507163879Schristos gdb_test "save breakpoint $bps" "" "save breakpoint bps" 5607163879Schristos} 5707163879Schristos 5807163879Schristoswith_test_prefix "restore" { 5907163879Schristos if ![restart] { 6007163879Schristos return -1 6107163879Schristos } 6207163879Schristos 6307163879Schristos # Restore the breakpoints. 6407163879Schristos gdb_test "source $bps" "" "source bps" 6507163879Schristos 6607163879Schristos # Verify that all breakpoints have been created correctly. 6707163879Schristos gdb_test "info break" [multi_line \ 6807163879Schristos "Num +Type +Disp +Enb +Address +What" \ 6907163879Schristos "$decimal +breakpoint +keep +y +$hex +in function\\(\\) at \[^\r\n\]*$srcfile:$decimal" \ 7007163879Schristos "$decimal +breakpoint +keep +y +<MULTIPLE> +" \ 7107163879Schristos "$decimal.$decimal +y +$hex +in S::function\\(\\) at \[^\r\n\]*$srcfile:$decimal" \ 7207163879Schristos "$decimal.$decimal +y +$hex +in function\\(\\) at \[^\r\n\]*$srcfile:$decimal" \ 7307163879Schristos ] 7407163879Schristos} 75