]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.reverse / next-reverse-bkpt-over-sr.exp
CommitLineData
1d506c26 1# Copyright 2008-2024 Free Software Foundation, Inc.
2c03e5be
PA
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# This file is part of the GDB testsuite. It tests reverse stepping.
2c03e5be
PA
17#
18# reverse-next over a function call sets a step-resume breakpoint at
19# callee's entry point, runs to it, and then does an extra single-step
20# to get at the callee's caller. Test that a user breakpoint set at
21# the same location as the step-resume breakpoint isn't ignored.
22#
c367d9e0
CL
23# The test sets a breakpoint with the command break *callee to set a
24# breakpoint on the first instruction of the function. The issue is on
25# PowerPC it uses Global Entry Points (GEP) and Local Entry Points (LEP).
26# The GEP is the first instruction in the function. It sets up register
27# r2 and then reaches the LEP.
28#
29# <callee>:
30# lis r2,4098 <- GEP
31# addi r2,r2,32512
32# mflr r0 <- LEP
33# std r0,16(r1)
34
35#
36# The command break *callee sets the breakpoint on the GEP. Calling
37# the function with callee() will enter the function via the LEP. So,
38# this test needs to use a function pointer to call callee() so the
39# function will be entered via the GEP to work as designed on PowerPC in
40# addition to non-PowerPC systems. On non-PowerPC systems, the GEP and LEP
41# are the same.
2c03e5be 42
5954db83 43require supports_reverse
2c03e5be 44
c367d9e0 45standard_testfile
2c03e5be 46
5b362f04 47if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
2c03e5be
PA
48 return -1
49}
50
bde43e8d 51if {![runto_main]} {
2c03e5be
PA
52 return 0
53}
54
d3895d7d 55if [supports_process_record] {
2c03e5be 56 # Activate process record/replay
9f058c10 57 gdb_test_no_output "record" "turn on process record"
2c03e5be
PA
58}
59
c367d9e0
CL
60# Stop after the function pointer call to test the reverse-next command.
61set lineno [gdb_get_line_number "END OF MAIN"]
62gdb_test "advance $lineno" ".*END OF MAIN.*" \
63 "get past callee call"
2c03e5be
PA
64
65gdb_test "b \*callee" "" "set breakpoint at callee's entry"
66
bde47561 67set bpnum [get_integer_valueof "\$bpnum" 0]
2c03e5be 68gdb_test "reverse-next" \
bde47561 69 "Breakpoint $bpnum, callee.*" \
2c03e5be
PA
70 "reverse-next over call trips user breakpoint at function entry"
71
72gdb_test "up" \
c367d9e0 73 ".*FUNCTION PTR CALL TO CALLEE.*" \
2c03e5be 74 "stopped at the right callee call"