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
- From: Pedro Alves <palves at redhat dot com>
- To: Thomas Preudhomme <thomas dot preudhomme at foss dot arm dot com>, GDB Patches <gdb-patches at sourceware dot org>
- Date: Wed, 6 Sep 2017 18:13:42 +0100
- Subject: Re: [PATCH, gdb/testsuite] Fix compare-sections.exp FAIL
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 405483E6
- References: <33d0f2eb-4802-8b06-44bf-3e4299c5fdb4@foss.arm.com>
On 09/06/2017 05:58 PM, Thomas Preudhomme wrote:
>
> 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 $" {
This is reading bytes off of memory, as we can infer from
use of "unsigned char". The test is most probably using
explicit /d to avoid printing the number as a character.
I think it'd be clearer to change the "/d" to "/u", here
and below too.
Also, I think treating as negative integer would actually
be buggy because if the value happens to be 0xff, then you
get back -1, which would incorrectly match here:
if {$orig == -1} {
untested "couldn't read address of read-only section"
return -1
}
> 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 $" {
Add:
pass "$test (cannot write)"
> + }
> -re " = (\[0-9\]*).*$gdb_prompt $" {
> set written $expect_out(1,string)
> pass "$test"
>
Thanks,
Pedro Alves