1# Copyright 2017 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# Tests decoding of various sparc64 registers. 19# At the moment, only few registers are tested, but more can be added in future. 20 21if ![istarget "sparc64*-*-linux*"] then { 22 verbose "Skipping sparc64 register tests." 23 return 0 24} 25 26standard_testfile .S 27 28set additional_flags "-Wa,-g" 29 30if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ 31 [list debug $additional_flags]] } { 32 return -1 33} 34 35if ![runto_main] then { 36 untested "could not run to main" 37 return 0 38} 39 40########################################## 41gdb_test "break $srcfile:test_ccr" "Breakpoint \[0-9\] at .*" 42gdb_test "continue" "Continuing.*" 43gdb_test "si" "wr .*" "single step to the first %ccr test" 44 45proc test_ccr {exp_value exp_text {exp_insn "wr .*"}} { 46 gdb_test "info register ccr" \ 47 "ccr $exp_value .*$exp_text.*" \ 48 "check %ccr register value equal to $exp_text" 49 50 gdb_test "si" "$exp_insn" "single step to a next %ccr test after $exp_text" 51} 52 53test_ccr "0x1" "icc.c" 54test_ccr "0x2" "icc.v" 55test_ccr "0x3" "icc.c icc.v" 56test_ccr "0x4" "icc.z" 57test_ccr "0x5" "icc.c icc.z" 58test_ccr "0x6" "icc.v icc.z" 59test_ccr "0x7" "icc.c icc.v icc.z" 60test_ccr "0x8" "icc.n" 61test_ccr "0x9" "icc.c icc.n" 62test_ccr "0xa" "icc.v icc.n" 63test_ccr "0xb" "icc.c icc.v icc.n" 64test_ccr "0xc" "icc.z icc.n" 65test_ccr "0xd" "icc.c icc.z icc.n" 66test_ccr "0xe" "icc.v icc.z icc.n" 67test_ccr "0xf" "icc.c icc.v icc.z icc.n" 68 69test_ccr "0x10" "xcc.c" 70test_ccr "0x20" "xcc.v" 71test_ccr "0x30" "xcc.c xcc.v" 72test_ccr "0x40" "xcc.z" 73test_ccr "0x50" "xcc.c xcc.z" 74test_ccr "0x60" "xcc.v xcc.z" 75test_ccr "0x70" "xcc.c xcc.v xcc.z" 76test_ccr "0x80" "xcc.n" 77test_ccr "0x90" "xcc.c xcc.n" 78test_ccr "0xa0" "xcc.v xcc.n" 79test_ccr "0xb0" "xcc.c xcc.v xcc.n" 80test_ccr "0xc0" "xcc.z xcc.n" 81test_ccr "0xd0" "xcc.c xcc.z xcc.n" 82test_ccr "0xe0" "xcc.v xcc.z xcc.n" "retl" 83test_ccr "0xf0" "xcc.c xcc.v xcc.z xcc.n" "nop" 84########################################## 85 86 87########################################## 88set lno [gdb_get_line_number "sparc64-regs.exp: after first %fsr" $srcfile] 89gdb_test "break $srcfile:$lno" "Breakpoint \[0-9\] at .*" \ 90 "forward breakpoint to first %fsr test" 91gdb_test "continue" "Continuing.*" 92 93proc test_fsr {exp_value exp_text} { 94 gdb_test "info register fsr" \ 95 "fsr $exp_value .*$exp_text.*" \ 96 "check %fsr register value equal to $exp_text" 97 98 gdb_test "si" "stx .*" "single step to a next %fsr test (I.) after $exp_text" 99 gdb_test "si" "ldx .*" "single step to a next %fsr test (II.) after $exp_text" 100 gdb_test "si" "sllx .*" "single step to a next %fsr test (III.) after $exp_text" 101} 102 103test_fsr "0x1" "NXC" 104test_fsr "0x2" "DZC" 105test_fsr "0x4" "UFC" 106test_fsr "0x8" "OFC" 107test_fsr "0x10" "NVC" 108test_fsr "0x20" "NXA" 109test_fsr "0x40" "DZA" 110test_fsr "0x80" "UFA" 111test_fsr "0x100" "OFA" 112test_fsr "0x200" "NVA" 113test_fsr "0x800000" "NXM" 114test_fsr "0x1000000" "DZM" 115test_fsr "0x2000000" "UFM" 116test_fsr "0x4000000" "OFM" 117test_fsr "0x8000000" "NVM" 118########################################## 119