1 # Copyright 2014-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 # Test that dcache behaves correctly when reading a cache line fails. 17 18 standard_testfile 19 20 if { [prepare_for_testing "failed to prepare" ${testfile}] } { 21 return -1 22 } 23 24 if ![runto breakpt] { 25 return -1 26 } 27 28 # Issue the "delete mem" command. This makes GDB ignore the 29 # target-provided list, if any. 30 31 proc delete_mem {} { 32 global gdb_prompt 33 34 set test "delete mem" 35 gdb_test_multiple $test $test { 36 -re "Delete all memory regions.*y or n.*$" { 37 send_gdb "y\n" 38 exp_continue 39 } 40 -re "$gdb_prompt $" { 41 pass $test 42 } 43 } 44 } 45 46 # Make the dcache line size bigger than the pagesize. 47 set pagesize [get_integer_valueof "pg_size" -1] 48 set linesize [expr $pagesize * 2] 49 50 gdb_test_no_output "set dcache line-size $linesize" \ 51 "set dcache line size to twice the pagesize" 52 53 gdb_test "info dcache" \ 54 "Dcache 4096 lines of $linesize bytes each.\r\nNo data cache available." 55 56 # Make sure dcache doesn't automatically skip unmapped regions. 57 delete_mem 58 59 gdb_test "info mem" \ 60 "Using user-defined memory regions.\r\nThere are no memory regions defined\." 61 62 # Given the line size is bigger than the page size, we have 63 # alternating mapped and unmapped pages, these make dcache fail to 64 # fill in the cache line. GDB used to have a bug where that failure 65 # would end up as user-visible error. The range being disassembled is 66 # wholly available, so GDB should succeed. 67 gdb_test "disassemble first_mapped_page, +10" "End of assembler dump\." 68 gdb_test "disassemble last_mapped_page, +10" "End of assembler dump\." 69