1 # Copyright 2008-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 # This file is part of the GDB testsuite. It tests reverse stepping.
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.
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.
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
43 require supports_reverse
47 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
55 if [supports_process_record] {
56 # Activate process record/replay
57 gdb_test_no_output "record" "turn on process record"
60 # Stop after the function pointer call to test the reverse-next command.
61 set lineno [gdb_get_line_number "END OF MAIN"]
62 gdb_test "advance $lineno" ".*END OF MAIN.*" \
63 "get past callee call"
65 gdb_test "b \*callee" "" "set breakpoint at callee's entry"
67 set bpnum [get_integer_valueof "\$bpnum" 0]
68 gdb_test "reverse-next" \
69 "Breakpoint $bpnum, callee.*" \
70 "reverse-next over call trips user breakpoint at function entry"
73 ".*FUNCTION PTR CALL TO CALLEE.*" \
74 "stopped at the right callee call"