This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH, gdb/testsuite] Fix compare-sections.exp FAIL
Committed and pushed. Committed version in attachment.
Best regards,
Thomas
On 14/09/17 14:26, Pedro Alves wrote:
Hi Thomas,
On 09/12/2017 04:24 PM, Thomas Preudhomme wrote:
Hi Pedro,
Thanks for the review. Please find an updated patch attached. Updated
ChangeLog entry and description are as follow:
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)
The above is stale. It should now talk about /d vs /u.
Could you please update?
Is this ok for master?
OK with commit log fixed, and ...
On 09/12/2017 04:24 PM, Thomas Preudhomme wrote:
@@ -136,6 +136,9 @@ 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" {
... this should be switched to "/u" too.
+ -re " = .*Cannot access memory at address $ro_address.*$gdb_prompt $" {
+ pass "$test (cannot write)"
Thanks,
Pedro Alves
>From df8899e5c8b60ffbbe93e35315ebb76a9c80ee37 Mon Sep 17 00:00:00 2001
From: Thomas Preud'homme <thomas.preudhomme@arm.com>
Date: Tue, 26 Sep 2017 09:57:18 +0100
Subject: [PATCH] Fix FAILs in compare-sections.exp
compare-sections.exp has two cases that are not handled appropriately:
1) value read with msb set
2) error while patching that section
This patch adapts the "get value of read-only section" test to print
the value as an unsigned integer to fix 1) and test for the error
message to not set the written variable if read-only section cannot
be written to so as to solve 2).
2017-09-26 Thomas Preud'homme <thomas.preudhomme@arm.com>
Pedro Alves <palves@redhat.com>
gdb/testsuite/
* gdb.base/compare-sections.exp (get value of read-only section): Read
as unsigned value.
(corrupt read-only section): Likewise and don't set written if patching
failed.
---
gdb/testsuite/ChangeLog | 8 ++++++++
gdb/testsuite/gdb.base/compare-sections.exp | 7 +++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 6584a23..4b6cb80 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-26 Thomas Preud'homme <thomas.preudhomme@arm.com>
+ Pedro Alves <palves@redhat.com>
+
+ * gdb.base/compare-sections.exp (get value of read-only section): Read
+ as unsigned value.
+ (corrupt read-only section): Likewise and don't set written if patching
+ failed.
+
2017-09-21 Kevin Buettner <kevinb@redhat.com>
* gdb.python/py-thrhandle.c, gdb.python/py-thrhandle.exp: New
diff --git a/gdb/testsuite/gdb.base/compare-sections.exp b/gdb/testsuite/gdb.base/compare-sections.exp
index e4b9921..757ccf8 100644
--- a/gdb/testsuite/gdb.base/compare-sections.exp
+++ b/gdb/testsuite/gdb.base/compare-sections.exp
@@ -117,7 +117,7 @@ with_test_prefix "read-only" {
set orig -1
set test "get value of read-only section"
- gdb_test_multiple "print /d *(unsigned char *) $ro_address" "$test" {
+ gdb_test_multiple "print /u *(unsigned char *) $ro_address" "$test" {
-re " = (\[0-9\]*).*$gdb_prompt $" {
set orig $expect_out(1,string)
pass "$test"
@@ -135,7 +135,10 @@ with_test_prefix "read-only" {
# Write PATCH to memory.
set written -1
set test "corrupt read-only section"
- gdb_test_multiple "print /d *(unsigned char *) $ro_address = $patch" "$test" {
+ gdb_test_multiple "print /u *(unsigned char *) $ro_address = $patch" "$test" {
+ -re " = .*Cannot access memory at address $ro_address.*$gdb_prompt $" {
+ pass "$test (cannot write)"
+ }
-re " = (\[0-9\]*).*$gdb_prompt $" {
set written $expect_out(1,string)
pass "$test"
--
2.7.4