+2017-01-26 Luis Machado <lgustavo@codesourcery.com>
+
+ * lib/memory.exp: New file.
+ * lib/gdb.exp: Load memory.exp.
+ * gdb.base/memattr.exp (delete_memory): Move proc to
+ lib/memory.exp and rename to delete_memory_regions.
+ Replace delete_memory with delete_memory_regions.
+ Cleanup memory regions before tests.
+ * gdb.base/breakpoint-in-ro-region.exp: Cleanup memory regions
+ before tests.
+
2017-01-26 Luis Machado <lgustavo@codesourcery.com>
* gdb.reverse/insn-reverse.c: Move arm and aarch64 code to their own
return -1
}
+# Delete all target-supplied memory regions.
+delete_memory_regions
+
delete_breakpoints
# Probe for hardware stepping.
runto main
+# Delete all target-supplied memory regions.
+delete_memory_regions
+
set mem1start -1
set mem2start -1
set mem3start -1
# Test overlapping checking
#
-proc delete_memory {} {
- global gdb_prompt
-
- gdb_test_multiple "delete mem" "delete mem" {
- -re "Delete all memory regions.*y or n.*$" {
- send_gdb "y\n"
- exp_continue
- }
- -re "$gdb_prompt $" { }
- }
-}
-
# Create a region that doesn't overlap (a PASS in the table).
proc region_pass { region } {
# |--| PASS
# |--- PASS
-delete_memory
+# Clear the memory regions list.
+delete_memory_regions
gdb_test_no_output "mem 0x30 0x60 ro"
with_test_prefix "0x30 0x60" {
region_fail "0x20 0x40"
# |--| PASS
# |--| PASS
-delete_memory
+# Clear the memory regions list.
+delete_memory_regions
gdb_test_no_output "mem 0x30 0x0 ro"
with_test_prefix "0x30 0x0" {
region_fail "0x20 0x50"
load_lib libgloss.exp
load_lib cache.exp
load_lib gdb-utils.exp
+load_lib memory.exp
global GDB
--- /dev/null
+# Copyright 2012-2017 Free Software Foundation, Inc.
+
+# 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 holds functions and data dealing with memory checks and other memory
+# manipulation routines.
+
+# Deletes all memory regions GDB currently knows about.
+
+proc delete_memory_regions {} {
+ global gdb_prompt
+
+ gdb_test_multiple "delete mem" "delete mem" {
+ -re "Delete all memory regions.*y or n.*$" {
+ send_gdb "y\n"
+ exp_continue
+ }
+ -re "$gdb_prompt $" { }
+ }
+}
+
+