2018-01-01 05:43:02 +01:00
|
|
|
# Copyright 2011-2018 Free Software Foundation, Inc.
|
2011-02-23 19:30:22 +01:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# This file is part of the gdb testsuite
|
|
|
|
|
|
|
|
# Test the memory attribute commands.
|
|
|
|
|
test suite update - gdb.base/[h-m]
Convert files gdb.base/[h-m]*.exp to use standard_output_file et al.
* hook-stop-continue.exp, hook-stop-frame.exp, huge.exp,
included.exp, inferior-died.exp, infnan.exp, info-fun.exp,
info-macros.exp, info-os.exp, info-proc.exp, info-target.exp,
infoline.exp, interp.exp, interrupt.exp, jit-simple.exp,
jit-so.exp, jump.exp, kill-after-signal.exp, label.exp, langs.exp,
lineinc.exp, list.exp, logical.exp, long_long.exp, longjmp.exp,
macscp.exp, maint.exp, memattr.exp, mips_pro.exp, miscexprs.exp,
morestack.exp, moribund-step.exp, multi-forks.exp: Use
standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 20:51:31 +02:00
|
|
|
standard_testfile .c
|
2011-02-23 19:30:22 +01:00
|
|
|
|
2016-12-23 17:52:18 +01:00
|
|
|
if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
|
2011-02-23 19:30:22 +01:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
runto main
|
|
|
|
|
2017-01-26 20:51:09 +01:00
|
|
|
# Delete all target-supplied memory regions.
|
|
|
|
delete_memory_regions
|
|
|
|
|
2011-02-23 19:30:22 +01:00
|
|
|
set mem1start -1
|
|
|
|
set mem2start -1
|
|
|
|
set mem3start -1
|
|
|
|
set mem4start -1
|
|
|
|
set mem5start -1
|
|
|
|
|
|
|
|
set mem1end -1
|
|
|
|
set mem2end -1
|
|
|
|
set mem3end -1
|
|
|
|
set mem4end -1
|
|
|
|
set mem5end -1
|
|
|
|
|
|
|
|
|
|
|
|
gdb_test_multiple "info address mem1" "get address of mem1" {
|
|
|
|
-re "Symbol \"mem1\" is static storage at address ($hex).*$gdb_prompt $" {
|
|
|
|
set mem1start $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "info address mem2" "get address of mem2" {
|
|
|
|
-re "Symbol \"mem2\" is static storage at address ($hex).*$gdb_prompt $" {
|
|
|
|
set mem2start $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "info address mem3" "get address of mem3" {
|
|
|
|
-re "Symbol \"mem3\" is static storage at address ($hex).*$gdb_prompt $" {
|
|
|
|
set mem3start $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "info address mem4" "get address of mem4" {
|
|
|
|
-re "Symbol \"mem4\" is static storage at address ($hex).*$gdb_prompt $" {
|
|
|
|
set mem4start $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "info address mem5" "get address of mem5" {
|
|
|
|
-re "Symbol \"mem5\" is static storage at address ($hex).*$gdb_prompt $" {
|
|
|
|
set mem5start $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &mem1\[64\]" "get end of mem1" {
|
|
|
|
-re "$decimal = .* ($hex).*$gdb_prompt $" {
|
|
|
|
set mem1end $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &mem2\[64\]" "get end of mem2" {
|
|
|
|
-re "$decimal = .* ($hex).*$gdb_prompt $" {
|
|
|
|
set mem2end $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &mem3\[64\]" "get end of mem3" {
|
|
|
|
-re "$decimal = .* ($hex).*$gdb_prompt $" {
|
|
|
|
set mem3end $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &mem4\[64\]" "get end of mem4" {
|
|
|
|
-re "$decimal = .* ($hex).*$gdb_prompt $" {
|
|
|
|
set mem4end $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &mem5\[64\]" "get end of mem5" {
|
|
|
|
-re "$decimal = .* ($hex).*$gdb_prompt $" {
|
|
|
|
set mem5end $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_no_output "mem $mem1start $mem1end wo" "create mem region 1"
|
|
|
|
gdb_test_no_output "mem $mem2start $mem2end ro" "create mem region 2"
|
|
|
|
gdb_test_no_output "mem $mem3start $mem3end rw" "create mem region 3"
|
|
|
|
gdb_test_no_output "mem $mem4start $mem4end rw" "create mem region 4"
|
|
|
|
gdb_test_no_output "mem $mem5start $mem5end rw" "create mem region 5"
|
|
|
|
|
|
|
|
set see1 0
|
|
|
|
set see2 0
|
|
|
|
set see3 0
|
|
|
|
set see4 0
|
|
|
|
set see5 0
|
|
|
|
|
2014-04-16 18:42:29 +02:00
|
|
|
set info_mem_header_pattern \
|
2017-11-09 23:44:08 +01:00
|
|
|
"info mem.*Num\[ \t\]+Enb\[ \t\]+Low\[ \t\]+Addr\[ \t\]+High\[ \t\]+Addr\[ \t\]+Attrs\[^\r\n\]*\r\n"
|
2014-04-16 18:42:29 +02:00
|
|
|
|
2011-02-23 19:30:22 +01:00
|
|
|
gdb_test_multiple "info mem" "info mem(1)" {
|
2014-04-16 18:42:29 +02:00
|
|
|
-re ${info_mem_header_pattern} {
|
|
|
|
# Discard the header.
|
|
|
|
exp_continue
|
|
|
|
}
|
2017-11-09 23:44:08 +01:00
|
|
|
-re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*\r\n" {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see1 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2017-11-09 23:44:08 +01:00
|
|
|
-re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*\r\n" {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see2 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2017-11-09 23:44:08 +01:00
|
|
|
-re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*\r\n" {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see3 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2017-11-09 23:44:08 +01:00
|
|
|
-re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*\r\n" {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see4 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2017-11-09 23:44:08 +01:00
|
|
|
-re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*\r\n" {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see5 1
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
if { $see1 && $see2 && $see3 && $see4 && $see5 } then {
|
|
|
|
pass "info mem (1)"
|
|
|
|
} else {
|
|
|
|
fail "info mem (1)"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test read-only, write-only
|
|
|
|
#
|
|
|
|
|
|
|
|
# mem1 is write only: read should fail.
|
|
|
|
gdb_test "print mem1\[1\]" \
|
|
|
|
"Cannot access memory at address $hex" \
|
|
|
|
"mem1 cannot be read"
|
|
|
|
|
|
|
|
gdb_test "print mem1\[1\] = 9" \
|
|
|
|
"$decimal = 9" \
|
|
|
|
"mem1 can be written"
|
|
|
|
|
|
|
|
# mem2 is read only: write should fail.
|
|
|
|
gdb_test "print mem2\[1\] = 9" \
|
|
|
|
"Cannot access memory at address $hex" \
|
|
|
|
"mem2 cannot be written"
|
|
|
|
|
|
|
|
gdb_test "print mem2\[1\]" \
|
|
|
|
"$decimal = 0" \
|
|
|
|
"mem2 can be read"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test disable and enable
|
|
|
|
#
|
|
|
|
|
|
|
|
gdb_test_no_output "disable mem 1" "disable mem 1"
|
|
|
|
gdb_test "info mem" "1 n .*" "mem 1 was disabled"
|
|
|
|
|
|
|
|
gdb_test_no_output "enable mem 1" "enable mem 1"
|
|
|
|
gdb_test "info mem" "1 y .*" "mem 1 was enabled"
|
|
|
|
|
|
|
|
gdb_test_no_output "disable mem 2 4"
|
|
|
|
|
|
|
|
set see1 0
|
|
|
|
set see2 0
|
|
|
|
set see3 0
|
|
|
|
set see4 0
|
|
|
|
set see5 0
|
|
|
|
|
|
|
|
gdb_test_multiple "info mem" "mem 2 and 4 were disabled" {
|
2014-04-16 18:42:29 +02:00
|
|
|
-re ${info_mem_header_pattern} {
|
|
|
|
# Discard the header.
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see1 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^2 n \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see2 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see3 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^4 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see4 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see5 1
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
if { $see1 && $see2 && $see3 && $see4 && $see5 } then {
|
|
|
|
pass "mem 2 and 4 were disabled"
|
|
|
|
} else {
|
|
|
|
fail "mem 2 and 4 were disabled"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_no_output "enable mem 2-4" "enable mem 2-4"
|
|
|
|
|
|
|
|
set see1 0
|
|
|
|
set see2 0
|
|
|
|
set see3 0
|
|
|
|
set see4 0
|
|
|
|
set see5 0
|
|
|
|
|
|
|
|
gdb_test_multiple "info mem" "mem 2-4 were enabled" {
|
2014-04-16 18:42:29 +02:00
|
|
|
-re ${info_mem_header_pattern} {
|
|
|
|
# Discard the header.
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see1 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see2 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see3 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see4 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see5 1
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
if { $see1 && $see2 && $see3 && $see4 && $see5 } then {
|
|
|
|
pass "mem 2-4 were enabled"
|
|
|
|
} else {
|
|
|
|
fail "mem 2-4 were enabled"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_no_output "disable mem" "disable mem"
|
|
|
|
|
|
|
|
set see1 0
|
|
|
|
set see2 0
|
|
|
|
set see3 0
|
|
|
|
set see4 0
|
|
|
|
set see5 0
|
|
|
|
|
|
|
|
gdb_test_multiple "info mem" "mem 1 to 5 were disabled" {
|
2014-04-16 18:42:29 +02:00
|
|
|
-re ${info_mem_header_pattern} {
|
|
|
|
# Discard the header.
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "^1 n \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see1 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^2 n \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see2 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^3 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see3 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^4 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see4 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^5 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see5 1
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
if { $see1 && $see2 && $see3 && $see4 && $see5 } then {
|
|
|
|
pass "mem 1 to 5 were disabled"
|
|
|
|
} else {
|
|
|
|
fail "mem 1 to 5 were disabled"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_no_output "enable mem" "enable mem"
|
|
|
|
|
|
|
|
set see1 0
|
|
|
|
set see2 0
|
|
|
|
set see3 0
|
|
|
|
set see4 0
|
|
|
|
set see5 0
|
|
|
|
|
|
|
|
gdb_test_multiple "info mem" "mem 1 to 5 were enabled" {
|
2014-04-16 18:42:29 +02:00
|
|
|
-re ${info_mem_header_pattern} {
|
|
|
|
# Discard the header.
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see1 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see2 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see3 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see4 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see5 1
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
if { $see1 && $see2 && $see3 && $see4 && $see5 } then {
|
|
|
|
pass "mem 1 to 5 were enabled"
|
|
|
|
} else {
|
|
|
|
fail "mem 1 to 5 were enabled"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test "disable mem 7 8" \
|
|
|
|
"No memory region number 7.*No memory region number 8." \
|
|
|
|
"disable non-existant regions"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test delete
|
|
|
|
#
|
|
|
|
|
|
|
|
set see1 0
|
|
|
|
set see2 0
|
|
|
|
set see3 0
|
|
|
|
set see4 0
|
|
|
|
set see5 0
|
|
|
|
|
|
|
|
gdb_test_no_output "delete mem 1" "delete mem 1"
|
|
|
|
gdb_test_multiple "info mem" "mem 1 was deleted" {
|
2014-04-16 18:42:29 +02:00
|
|
|
-re ${info_mem_header_pattern} {
|
|
|
|
# Discard the header.
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see1 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see2 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see3 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see4 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see5 1
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
if { !$see1 && $see2 && $see3 && $see4 && $see5 } then {
|
|
|
|
pass "mem 1 was deleted"
|
|
|
|
} else {
|
|
|
|
fail "mem 1 was deleted"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set see1 0
|
|
|
|
set see2 0
|
|
|
|
set see3 0
|
|
|
|
set see4 0
|
|
|
|
set see5 0
|
|
|
|
|
|
|
|
gdb_test_no_output "delete mem 2 4" "delete mem 2 4"
|
|
|
|
gdb_test_multiple "info mem" "mem 2 and 4 were deleted" {
|
2014-04-16 18:42:29 +02:00
|
|
|
-re ${info_mem_header_pattern} {
|
|
|
|
# Discard the header.
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see1 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see2 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see3 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see4 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see5 1
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
if { !$see1 && !$see2 && $see3 && !$see4 && $see5 } then {
|
|
|
|
pass "mem 2 and 4 were deleted"
|
|
|
|
} else {
|
|
|
|
fail "mem 2 and 4 were deleted"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set see1 0
|
|
|
|
set see2 0
|
|
|
|
set see3 0
|
|
|
|
set see4 0
|
|
|
|
set see5 0
|
|
|
|
|
|
|
|
gdb_test "delete mem 2-4" \
|
|
|
|
"No memory region number 2.*No memory region number 4." \
|
|
|
|
"delete mem 2-4"
|
|
|
|
gdb_test_multiple "info mem" "mem 2-4 were deleted" {
|
2014-04-16 18:42:29 +02:00
|
|
|
-re ${info_mem_header_pattern} {
|
|
|
|
# Discard the header.
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see1 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see2 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see3 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see4 1
|
|
|
|
exp_continue
|
|
|
|
}
|
2014-04-16 18:42:29 +02:00
|
|
|
-re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
|
2011-02-23 19:30:22 +01:00
|
|
|
set see5 1
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt $" {
|
|
|
|
if { !$see1 && !$see2 && !$see3 && !$see4 && $see5 } then {
|
|
|
|
pass "mem 2-4 were deleted"
|
|
|
|
} else {
|
|
|
|
fail "mem 2-4 were deleted"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test "delete mem 8" "No memory region number 8." \
|
|
|
|
"delete non-existant region"
|
2012-08-27 10:58:01 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test overlapping checking
|
|
|
|
#
|
|
|
|
|
|
|
|
# Create a region that doesn't overlap (a PASS in the table).
|
|
|
|
|
|
|
|
proc region_pass { region } {
|
|
|
|
gdb_test_no_output "mem $region ro" "$region: no-overlap"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Try to create a region that overlaps (a FAIL in the table).
|
|
|
|
|
|
|
|
proc region_fail { region } {
|
|
|
|
gdb_test "mem $region ro" "overlapping memory region" "$region: overlap"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Test normal case (upper != 0)
|
|
|
|
#
|
|
|
|
# lo' hi'
|
|
|
|
# |--------|
|
|
|
|
# 10 20 30 40 50 60 70 80 90
|
|
|
|
# |-----| FAIL
|
|
|
|
# |--| FAIL
|
|
|
|
# |--| FAIL
|
|
|
|
# |--| FAIL
|
|
|
|
# |-----| FAIL
|
|
|
|
# |--------| FAIL
|
|
|
|
# |--------------| FAIL
|
|
|
|
# |--------------------- FAIL
|
|
|
|
# |------------------ FAIL
|
|
|
|
# |--------------- FAIL
|
|
|
|
# |--| PASS
|
|
|
|
# |--| PASS
|
|
|
|
# |--- PASS
|
|
|
|
|
2017-01-26 20:51:09 +01:00
|
|
|
# Clear the memory regions list.
|
|
|
|
delete_memory_regions
|
2012-08-27 10:58:01 +02:00
|
|
|
gdb_test_no_output "mem 0x30 0x60 ro"
|
|
|
|
with_test_prefix "0x30 0x60" {
|
|
|
|
region_fail "0x20 0x40"
|
|
|
|
region_fail "0x30 0x40"
|
|
|
|
region_fail "0x40 0x50"
|
|
|
|
region_fail "0x50 0x60"
|
|
|
|
region_fail "0x50 0x70"
|
|
|
|
region_fail "0x30 0x60"
|
|
|
|
region_fail "0x20 0x70"
|
|
|
|
region_fail "0x20 0x0"
|
|
|
|
region_fail "0x30 0x0"
|
|
|
|
region_fail "0x40 0x0"
|
|
|
|
region_pass "0x20 0x30"
|
|
|
|
region_pass "0x60 0x70"
|
|
|
|
region_pass "0x80 0x0"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Test special case (upper == 0)
|
|
|
|
#
|
|
|
|
# lo' hi'
|
|
|
|
# |---------------
|
|
|
|
# 00 10 20 30 40 50 60 70 80
|
|
|
|
# |--------| FAIL
|
|
|
|
# |-----| FAIL
|
|
|
|
# |--| FAIL
|
|
|
|
# |------------------ FAIL
|
|
|
|
# |--------------- FAIL
|
|
|
|
# |------------ FAIL
|
|
|
|
# |--| PASS
|
|
|
|
# |--| PASS
|
|
|
|
|
2017-01-26 20:51:09 +01:00
|
|
|
# Clear the memory regions list.
|
|
|
|
delete_memory_regions
|
2012-08-27 10:58:01 +02:00
|
|
|
gdb_test_no_output "mem 0x30 0x0 ro"
|
|
|
|
with_test_prefix "0x30 0x0" {
|
|
|
|
region_fail "0x20 0x50"
|
|
|
|
region_fail "0x30 0x50"
|
|
|
|
region_fail "0x40 0x50"
|
|
|
|
region_fail "0x20 0x0"
|
|
|
|
region_fail "0x30 0x0"
|
|
|
|
region_fail "0x40 0x0"
|
|
|
|
region_pass "0x20 0x30"
|
|
|
|
region_pass "0x00 0x10"
|
|
|
|
}
|