This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH, gdb/testsuite] Fix compare-sections.exp FAIL
- From: Thomas Preudhomme <thomas dot preudhomme at foss dot arm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Date: Wed, 6 Sep 2017 17:58:03 +0100
- Subject: [PATCH, gdb/testsuite] Fix compare-sections.exp FAIL
- Authentication-results: sourceware.org; auth=none
Hi,
compare-sections.exp has two cases that are not handled appropriately:
1) value read from read-only section is negative
2) error while patching that section
This patch adapts the regular expression to allow a minus sign to deal
with 1) and test for the error message to not set written if read-only
section cannot be written to so as to solve 2).
ChangeLog entry is as follows:
*** gdb/testsuite/ChangeLog ***
2017-09-05 Thomas Preud'homme <thomas.preudhomme@arm.com>
* gdb.base/compare-sections.exp (get value of read-only section): Allow
minus sign in the answer.
(corrupt read-only section): Don't mark it pass if patching failed.
Without this patch I get a Tcl error on the first test while it now
PASSes and the second one is marked UNSUPPORTED.
Is this ok for master?
Best regards,
Thomas
diff --git a/gdb/testsuite/gdb.base/compare-sections.exp b/gdb/testsuite/gdb.base/compare-sections.exp
index e4b99216408f86745a890f80175e2f26c39303b5..8a0cf89a4c7c51299c59f59175865b5eb211f213 100644
--- a/gdb/testsuite/gdb.base/compare-sections.exp
+++ b/gdb/testsuite/gdb.base/compare-sections.exp
@@ -118,7 +118,7 @@ with_test_prefix "read-only" {
set test "get value of read-only section"
gdb_test_multiple "print /d *(unsigned char *) $ro_address" "$test" {
- -re " = (\[0-9\]*).*$gdb_prompt $" {
+ -re " = (-?\[0-9\]+).*$gdb_prompt $" {
set orig $expect_out(1,string)
pass "$test"
}
@@ -136,6 +136,8 @@ with_test_prefix "read-only" {
set written -1
set test "corrupt read-only section"
gdb_test_multiple "print /d *(unsigned char *) $ro_address = $patch" "$test" {
+ -re " = .*Cannot access memory at address $ro_address.*$gdb_prompt $" {
+ }
-re " = (\[0-9\]*).*$gdb_prompt $" {
set written $expect_out(1,string)
pass "$test"