]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | # Copyright 2004-2023 Free Software Foundation, Inc. |
7a8f1e6b JB |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
7a8f1e6b JB |
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 | |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
7a8f1e6b JB |
15 | # |
16 | # This file is part of the gdb testsuite. | |
17 | ||
7a8f1e6b JB |
18 | # Test PowerPC E500 prologue analyzer. |
19 | ||
73c06197 | 20 | require {istarget "powerpc-*"} |
7a8f1e6b JB |
21 | |
22 | set testfile "e500-prologue" | |
23 | set srcfile ${testfile}.c | |
24 | set binfile ${objdir}/${subdir}/${testfile} | |
25 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } { | |
84c93cd5 | 26 | unsupported "failed to compile" |
7a8f1e6b JB |
27 | return -1 |
28 | } | |
29 | ||
30 | gdb_exit | |
31 | gdb_start | |
32 | gdb_reinitialize_dir $srcdir/$subdir | |
33 | gdb_load ${binfile} | |
34 | ||
35 | # Insert a breakpoint in FUNCTION and verifies that the breakpoint was | |
36 | # inserted at the expected location. EXPECTED_LOCATION should be an | |
37 | # offset relative to the function start address. | |
38 | proc insert_breakpoint {function expected_location} { | |
39 | global gdb_prompt | |
40 | global expect_out | |
41 | global hex | |
42 | ||
43 | set address "" | |
44 | ||
45 | # Insert a breakpoint using the given function name, and extract | |
46 | # the breakpoint address for the output. | |
47 | gdb_test_multiple "break $function" "set breakpoint in $function" { | |
48 | -re "Breakpoint 1 at ($hex).*$gdb_prompt $" { | |
49 | set address $expect_out(1,string) | |
50 | } | |
51 | default { | |
52 | fail "set breakpoint in $function" | |
53 | } | |
54 | } | |
55 | ||
56 | # If we managed to get the breakpoing address, then check that | |
57 | # we inserted it at the expected location by examining the | |
58 | # instruction at that address (we're not interested in the insn | |
59 | # itself, but rather at the address printed at the begining of | |
60 | # the instruction). | |
75b6f386 | 61 | if {$address != ""} { |
7a8f1e6b JB |
62 | gdb_test "x /i $address" \ |
63 | ".*<$function\\+$expected_location>.*" \ | |
64 | "check $function breakpoint address" | |
65 | } else { | |
66 | fail "unable to compute breakpoint address" | |
67 | } | |
68 | ||
69 | } | |
70 | ||
71 | insert_breakpoint "arg_passing_test2" 40 |