Home | History | Annotate | Line # | Download | only in gdb.arch
powerpc64-prologue.exp revision 1.1.1.1.4.2
      1 # Copyright 2006-2023 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 # Test PowerPC(64le) prologue analyzer.
     17 
     18 # Do not run on AIX (where we won't be able to build the tests without
     19 # some surgery) or on PowerPC64 (ditto, dot symbols).
     20 if {[istarget *-*-aix*] || ![istarget "powerpc*-*-*"]} {
     21     verbose "Skipping PowerPC prologue tests."
     22     return
     23 }
     24 
     25 standard_testfile .c
     26 
     27 # Don't use "debug", so that we don't have line information for the assembly
     28 # fragments.
     29 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } {
     30     untested "PowerPC prologue tests"
     31     return -1
     32 }
     33 
     34 if { [prepare_for_testing "failed to prepare" $testfile "$srcfile" \
     35       {}] } {
     36     return -1
     37 }
     38 
     39 # Run to `main' where we begin our tests.
     40 if {![runto_main]} {
     41     return 0
     42 }
     43 
     44 # Testcase for PIC prologue.
     45 gdb_breakpoint "gdb2029_marker"
     46 gdb_test "continue" "Breakpoint $decimal, $hex in gdb2029_marker \\(\\).*" \
     47 	"continue to PIC"
     48 
     49 gdb_test "backtrace 10" \
     50 	"#0\[ \t\]*$hex in gdb2029_marker.*\r\n#1\[ \t\]*$hex in gdb2029.*\r\n#2\[ \t\]*$hex in main.*" \
     51 	"backtrace in PIC marker"
     52 
     53 gdb_test "finish" ".*$hex in gdb2029 .*" "finish from PIC"
     54 
     55 gdb_test "backtrace 10" \
     56 	"#0\[ \t\]*$hex in gdb2029 .*\r\n#1\[ \t\]*$hex in main.*" \
     57 	"backtrace in PIC"
     58 
     59 gdb_test "info frame" \
     60 	".*Saved registers:.*r31 at.*pc at.*lr at.*" \
     61 	"saved registers in PIC"
     62 
     63 # Testcase for scheduled prologue.
     64 gdb_breakpoint "optimized_1_marker"
     65 gdb_test "continue" "Breakpoint $decimal, $hex in optimized_1_marker \\(\\).*" \
     66 	"continue to optimized"
     67 
     68 gdb_test "backtrace 10" \
     69 	"#0\[ \t\]*$hex in optimized_1_marker.*\r\n#1\[ \t\]*$hex in optimized_1.*\r\n#2\[ \t\]*$hex in main.*" \
     70 	"backtrace in optimized marker"
     71 
     72 gdb_test "finish" ".*$hex in optimized_1 .*" "finish from optimized"
     73 
     74 gdb_test "backtrace 10" \
     75 	"#0\[ \t\]*$hex in optimized_1 .*\r\n#1\[ \t\]*$hex in main.*" \
     76 	"backtrace in optimized"
     77 
     78 gdb_test "info frame" \
     79 	".*Saved registers:.*r30 at.*pc at.*lr at.*" \
     80 	"saved registers in optimized"
     81 
     82