]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
Switch the license of all .exp files to GPLv3.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / powerpc-aix-prologue.exp
CommitLineData
6aba47ca 1# Copyright 2004, 2007 Free Software Foundation, Inc.
c0586a34
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
c0586a34
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/>.
c0586a34
JB
15#
16# This file is part of the gdb testsuite.
17
18if $tracelevel {
19 strace $tracelevel
20}
21
22# Test rs6000 prologue analyzer.
23
24set prms_id 0
25set bug_id 0
26
27if ![istarget "powerpc-*-aix*"] then {
28 verbose "Skipping powerpc-aix prologue tests."
29 return
30}
31
32set testfile "powerpc-aix-prologue"
33set srcfile ${testfile}.c
34set binfile ${objdir}/${subdir}/${testfile}
35if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } {
36 unsupported "Testcase compile failed."
37 return -1
38}
39
40gdb_exit
41gdb_start
42gdb_reinitialize_dir $srcdir/$subdir
43gdb_load ${binfile}
44
45# Insert a breakpoint in FUNCTION and verifies that the breakpoint was
46# inserted at the expected location. EXPECTED_LOCATION should be an
47# offset relative to the function start address.
48proc insert_breakpoint {function expected_location} {
49 global gdb_prompt
50 global expect_out
51 global hex
52
53 set address ""
54
55 # Insert a breakpoint using the given function name, and extract
56 # the breakpoint address for the output.
57 gdb_test_multiple "break $function" "set breakpoint in $function" {
58 -re "Breakpoint 1 at ($hex).*$gdb_prompt $" {
59 set address $expect_out(1,string)
60 }
61 default {
62 fail "set breakpoint in $function"
63 }
64 }
65
66 # If we managed to get the breakpoing address, then check that
67 # we inserted it at the expected location by examining the
68 # instruction at that address (we're not interested in the insn
69 # itself, but rather at the address printed at the begining of
70 # the instruction).
71 if { $address != "" } then {
72 gdb_test "x /i $address" \
73 ".*<$function\\+$expected_location>.*" \
74 "check $function breakpoint address"
75 } else {
76 fail "unable to compute breakpoint address"
77 }
78
79}
80
81insert_breakpoint "li_stw" 12