From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109951 invoked by alias); 27 Apr 2015 15:41:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 109940 invoked by uid 89); 27 Apr 2015 15:41:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Apr 2015 15:41:32 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1YmlA1-0002uY-2l from Luis_Gustavo@mentor.com for gdb-patches@sourceware.org; Mon, 27 Apr 2015 08:41:29 -0700 Received: from [172.30.3.127] (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.224.2; Mon, 27 Apr 2015 08:41:24 -0700 Message-ID: <553E58A3.5020904@codesourcery.com> Date: Mon, 27 Apr 2015 15:41:00 -0000 From: Luis Machado Reply-To: Luis Machado User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Subject: Re: [PATCH] Handle memory write errors on gdb.base/break-always.exp References: <1428949306-15524-1-git-send-email-lgustavo@codesourcery.com> In-Reply-To: <1428949306-15524-1-git-send-email-lgustavo@codesourcery.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00994.txt.bz2 Ping? On 04/13/2015 03:21 PM, Luis Machado wrote: > This is another case of the testcase not handling memory write errors that > happen on some targets (QEMU) when GDB attempts to modify an address that > should contain a breakpoint, for example. > > The following patch handles this and prevents spurious failures from > happening. It also adds a foreach loop to avoid duplication of code > and hardcoded patterns. > > Regression tested on x86-64-linux and aarch64-linux. > > Ok? > > 2015-04-13 Luis Machado > > gdb/testsuite/ > * gdb.base/break-always.exp: Abort testing if writing to memory > causes an error. > --- > gdb/testsuite/gdb.base/break-always.exp | 30 +++++++++++++++++------------- > 1 file changed, 17 insertions(+), 13 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/break-always.exp b/gdb/testsuite/gdb.base/break-always.exp > index 681be37..9133229 100644 > --- a/gdb/testsuite/gdb.base/break-always.exp > +++ b/gdb/testsuite/gdb.base/break-always.exp > @@ -69,19 +69,23 @@ gdb_test "p /x \$shadow = *(char *) $bp_address" \ > # and still leave the breakpoint insn planted. Try twice with > # different values, in case we happen to be writting exactly what was > # there already. > -gdb_test "p /x *(char *) $bp_address = 0" \ > - " = 0x0" \ > - "write 0 to breakpoint's address" > -gdb_test "p /x *(char *) $bp_address" \ > - " = 0x0" \ > - "read back 0 from the breakpoint's address" > - > -gdb_test "p /x *(char *) $bp_address = 1" \ > - " = 0x1" \ > - "write 1 to breakpoint's address" > -gdb_test "p /x *(char *) $bp_address" \ > - " = 0x1" \ > - "read back 1 from the breakpoint's address" > +foreach test_value {0 1} { > + set write_test "write $test_value to breakpoint's address $bp_address" > + > + gdb_test_multiple "p /x *(char *) $bp_address = $test_value" $write_test { > + -re "Cannot access memory at address $hex.*$gdb_prompt $" { > + unsupported "Cannot write to address $bp_address" > + return -1 > + } > + -re " = .*$gdb_prompt $" { > + pass $write_test > + } > + } > + > + set read_test "read back $test_value from the breakpoint's address $bp_address" > + > + gdb_test "p /x *(char *) $bp_address" " = 0x$test_value" $read_test > +} > > # Restore the original contents. > gdb_test "p /x *(char *) $bp_address = \$shadow" "" \ >