| # Copyright 2020-2021 Free Software Foundation, Inc. |
| |
| # This program is free software; you can redistribute it and/or modify |
| # it under the terms of the GNU General Public License as published by |
| # the Free Software Foundation; either version 3 of the License, or |
| # (at your option) any later version. |
| # |
| # This program is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| # GNU General Public License for more details. |
| # |
| # You should have received a copy of the GNU General Public License |
| # along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| |
| # Check if executable generated from eh_return.c assert when setting a |
| # breakpoint at the last insn of eh, and running to it. |
| |
| standard_testfile |
| |
| if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ |
| {debug nopie}]} { |
| return -1 |
| } |
| |
| set address -1 |
| |
| # Get the address of the last insn in function eh2. |
| gdb_test_multiple "disassemble eh2" "" { |
| -re -wrap "($hex)\[^\r\n\]*\r\nEnd of assembler dump." { |
| set address $expect_out(1,string) |
| pass $gdb_test_name |
| } |
| } |
| |
| if { $address == -1 } { |
| return 0 |
| } |
| |
| clean_restart ${binfile} |
| |
| gdb_breakpoint "*$address" message |
| |
| # The assert did not reproduce when running to main, and continuing to the |
| # breakpoint, so instead, run to the breakpoint. |
| gdb_run_cmd |
| |
| gdb_test "" "Breakpoint .*" "hit breakpoint" |