]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.reverse / finish-reverse-bkpt.exp
1 # Copyright 2008-2024 Free Software Foundation, Inc.
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.
17 #
18 # 'reverse-finish' used to have a bug where user breakpoints set at
19 # the functions entry would be ignored. Make sure the bug doesn't
20 # reappear.
21
22 # The test sets a breakpoint with the command break *void_func to set a
23 # breakpoint on the first instruction of the function. The issue is on
24 # PowerPC it uses Global Entry Points (GEP) and Local Entry Points (LEP).
25 # The GEP is the first instruction in the function. It sets up register
26 # r2 and then reaches the LEP.
27 #
28 # <void_func>:
29 # lis r2,4098 <- GEP
30 # addi r2,r2,32512
31 # mflr r0 <- LEP
32 # std r0,16(r1)
33 # ....
34
35 #
36 # The command break *void_func sets the breakpoint on the GEP. Calling
37 # the function with void_func() will enter the function via the LEP. So,
38 # this test needs to use a function pointer to call void_func() 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.
42
43 require supports_reverse
44
45 standard_testfile
46
47 if { [prepare_for_testing "failed to prepare" "$testfile" $srcfile] } {
48 return -1
49 }
50
51 if {![runto_main]} {
52 return 0
53 }
54
55 if [supports_process_record] {
56 # Activate process record/replay
57 gdb_test_no_output "record" "turn on process record"
58 }
59
60 # Start the test.
61 set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"]
62 gdb_test "tbreak void_func" \
63 "Temporary breakpoint $decimal at .*$srcfile, line $breakloc\." \
64 "set breakpoint on void_func"
65 gdb_continue_to_breakpoint "void_func" ".*$srcfile:$breakloc.*"
66
67 # We stop at the brekapoint on void_func, but breakpoint on
68 # *void_func will be set at the same place if function void_func doesn't
69 # have prologue. One step forward to avoid this.
70 gdb_test "si"
71
72 gdb_test "break \*void_func" \
73 "Breakpoint $decimal at .*" \
74 "set breakpoint at void_func's entry"
75
76 gdb_test "reverse-finish" \
77 ".*Breakpoint .*, void_func.*" \
78 "reverse-finish from void_func trips breakpoint at entry"
79
80 gdb_test "frame" "#0 void_func.*" "no spurious proceed after breakpoint stop"