Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Unified Diff: gdb/testsuite/gdb.base/memattr.exp

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/testsuite/gdb.base/memattr.c ('k') | gdb/testsuite/gdb.base/mips_pro.exp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/gdb.base/memattr.exp
diff --git a/gdb/testsuite/gdb.base/memattr.exp b/gdb/testsuite/gdb.base/memattr.exp
index 4065808997748868ba90e9e2d323569ea9033d29..455bea55ff5742d9d9e766335e11598b1b2593e3 100644
--- a/gdb/testsuite/gdb.base/memattr.exp
+++ b/gdb/testsuite/gdb.base/memattr.exp
@@ -1,4 +1,4 @@
-# Copyright 2011-2012 Free Software Foundation, Inc.
+# Copyright 2011-2013 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
@@ -17,8 +17,7 @@
# Test the memory attribute commands.
-set testfile "memattr"
-set srcfile ${testfile}.c
+standard_testfile .c
if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
return -1
@@ -448,3 +447,95 @@ gdb_test_multiple "info mem" "mem 2-4 were deleted" {
gdb_test "delete mem 8" "No memory region number 8." \
"delete non-existant region"
+
+#
+# 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 } {
+ 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
+
+delete_memory
+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
+
+delete_memory
+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"
+}
« no previous file with comments | « gdb/testsuite/gdb.base/memattr.c ('k') | gdb/testsuite/gdb.base/mips_pro.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698