aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@broadcom.com>2014-04-16 17:42:29 +0100
committerAndrew Burgess <aburgess@broadcom.com>2014-04-16 17:42:29 +0100
commitfc98a809db2b6792a47919d30c9bd3446f5a83ca (patch)
treefd0e1a60ec2b88e2aee20aedc2a148e1b2c9538f
parent8e63ef2f2539b7fd3f81f11d930b8bdf8daa9da1 (diff)
downloadgdb-fc98a809db2b6792a47919d30c9bd3446f5a83ca.zip
gdb-fc98a809db2b6792a47919d30c9bd3446f5a83ca.tar.gz
gdb-fc98a809db2b6792a47919d30c9bd3446f5a83ca.tar.bz2
gdb.base/memattr.exp regexp improvements.
https://sourceware.org/ml/gdb-patches/2014-04/msg00210.html Improve the regexp used in the memattr.exp test so allow for different memory regions (.data / .bss) being laid out in different orders. gdb/testsuite/ChangeLog: * gdb.base/memattr.exp: Improve regexps to handle memory regions appearing in any order.
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/memattr.exp115
2 files changed, 80 insertions, 40 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 10dacdd..a554ad7 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-16 Andrew Burgess <aburgess@broadcom.com>
+
+ * gdb.base/memattr.exp: Improve regexps to handle memory regions
+ appearing in any order.
+
2014-04-15 Doug Evans <dje@google.com>
* gdb.gdb/selftest.exp (do_steps_and_nexts): Don't reference
diff --git a/gdb/testsuite/gdb.base/memattr.exp b/gdb/testsuite/gdb.base/memattr.exp
index af7de1f..1e23dae 100644
--- a/gdb/testsuite/gdb.base/memattr.exp
+++ b/gdb/testsuite/gdb.base/memattr.exp
@@ -110,24 +110,31 @@ set see3 0
set see4 0
set see5 0
+set info_mem_header_pattern \
+ "info mem.*Num\[ \t\]+Enb\[ \t\]+Low\[ \t\]+Addr\[ \t\]+High\[ \t\]+Addr\[ \t\]+Attrs\[^\n\r]*.."
+
gdb_test_multiple "info mem" "info mem(1)" {
- -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" {
+ -re ${info_mem_header_pattern} {
+ # Discard the header.
+ exp_continue
+ }
+ -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
set see1 1
exp_continue
}
- -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" {
+ -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
set see2 1
exp_continue
}
- -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see3 1
exp_continue
}
- -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see4 1
exp_continue
}
- -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" {
+ -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see5 1
exp_continue
}
@@ -181,23 +188,27 @@ set see4 0
set see5 0
gdb_test_multiple "info mem" "mem 2 and 4 were disabled" {
- -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" {
+ -re ${info_mem_header_pattern} {
+ # Discard the header.
+ exp_continue
+ }
+ -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
set see1 1
exp_continue
}
- -re "2 n \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" {
+ -re "^2 n \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
set see2 1
exp_continue
}
- -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see3 1
exp_continue
}
- -re "4 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^4 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see4 1
exp_continue
}
- -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" {
+ -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see5 1
exp_continue
}
@@ -219,23 +230,27 @@ set see4 0
set see5 0
gdb_test_multiple "info mem" "mem 2-4 were enabled" {
- -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" {
+ -re ${info_mem_header_pattern} {
+ # Discard the header.
+ exp_continue
+ }
+ -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
set see1 1
exp_continue
}
- -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" {
+ -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
set see2 1
exp_continue
}
- -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see3 1
exp_continue
}
- -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see4 1
exp_continue
}
- -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" {
+ -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see5 1
exp_continue
}
@@ -257,23 +272,27 @@ set see4 0
set see5 0
gdb_test_multiple "info mem" "mem 1 to 5 were disabled" {
- -re "1 n \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" {
+ -re ${info_mem_header_pattern} {
+ # Discard the header.
+ exp_continue
+ }
+ -re "^1 n \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
set see1 1
exp_continue
}
- -re "2 n \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" {
+ -re "^2 n \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
set see2 1
exp_continue
}
- -re "3 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^3 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see3 1
exp_continue
}
- -re "4 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^4 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see4 1
exp_continue
}
- -re "5 n \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" {
+ -re "^5 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see5 1
exp_continue
}
@@ -295,23 +314,27 @@ set see4 0
set see5 0
gdb_test_multiple "info mem" "mem 1 to 5 were enabled" {
- -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" {
+ -re ${info_mem_header_pattern} {
+ # Discard the header.
+ exp_continue
+ }
+ -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
set see1 1
exp_continue
}
- -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" {
+ -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
set see2 1
exp_continue
}
- -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see3 1
exp_continue
}
- -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see4 1
exp_continue
}
- -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" {
+ -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see5 1
exp_continue
}
@@ -340,23 +363,27 @@ set see5 0
gdb_test_no_output "delete mem 1" "delete mem 1"
gdb_test_multiple "info mem" "mem 1 was deleted" {
- -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" {
+ -re ${info_mem_header_pattern} {
+ # Discard the header.
+ exp_continue
+ }
+ -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
set see1 1
exp_continue
}
- -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" {
+ -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
set see2 1
exp_continue
}
- -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see3 1
exp_continue
}
- -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see4 1
exp_continue
}
- -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" {
+ -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see5 1
exp_continue
}
@@ -377,23 +404,27 @@ 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" {
- -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" {
+ -re ${info_mem_header_pattern} {
+ # Discard the header.
+ exp_continue
+ }
+ -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
set see1 1
exp_continue
}
- -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" {
+ -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
set see2 1
exp_continue
}
- -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see3 1
exp_continue
}
- -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see4 1
exp_continue
}
- -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" {
+ -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see5 1
exp_continue
}
@@ -416,23 +447,27 @@ 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" {
- -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" {
+ -re ${info_mem_header_pattern} {
+ # Discard the header.
+ exp_continue
+ }
+ -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
set see1 1
exp_continue
}
- -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" {
+ -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
set see2 1
exp_continue
}
- -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see3 1
exp_continue
}
- -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" {
+ -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see4 1
exp_continue
}
- -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" {
+ -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
set see5 1
exp_continue
}