1 # Copyright
2004-2024 Free Software Foundation
, Inc.
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.
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.
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
/>.
16 # Please email
any bugs
, comments
, and
/or additions to this file to
:
19 # This file is part of the gdb testsuite.
21 # Tests
for PR
:1558. Hits breakpoint at main after function called
24 require
{istarget
"sh-*-*"}
26 set testfile
"gdb1558"
27 set srcfile $
{testfile
}.c
28 set binfile $
{objdir
}/$
{subdir
}/$
{testfile
}
29 # Note we have to
compile WITH optimization and WITHOUT debugging information to expose the bug.
30 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {"additional_flags=-O2"}] != "" } {
31 untested
"failed to compile"
35 clean_restart $binfile
37 gdb_test
"b -q main" "Breakpoint 1.*" "set breakpoint at main"
38 gdb_test
"b -q sub1" "Breakpoint 2.*" "set breakpoint at sub1"
39 gdb_test
"b -q sub2" "Breakpoint 3.*" "set breakpoint at sub2"
41 # We can
't use "runto_main" because that is exactly the problem
42 # we are trying to detect, stopping somewhere before main.
46 set test "hits breakpoint at main after function called from main"
47 gdb_test_multiple "" $test {
48 -re "Breakpoint 1.*main .*$gdb_prompt $" {
51 -re "Breakpoint 2.*sub1 .*$gdb_prompt $" {
52 kfail "gdb/1558" $test