From patchwork Wed Apr 29 15:13:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Machado X-Patchwork-Id: 6485 Received: (qmail 125489 invoked by alias); 29 Apr 2015 15:13:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 125429 invoked by uid 89); 29 Apr 2015 15:13:39 -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; Wed, 29 Apr 2015 15:13:38 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1YnTg7-0006tw-Ic from Luis_Gustavo@mentor.com ; Wed, 29 Apr 2015 08:13:35 -0700 Received: from [172.30.4.73] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.224.2; Wed, 29 Apr 2015 08:13:34 -0700 Message-ID: <5540F51C.2030303@codesourcery.com> Date: Wed, 29 Apr 2015 12:13:32 -0300 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: Yao Qi CC: Subject: Re: [PATCH] Handle memory write errors on gdb.base/break-always.exp References: <1428949306-15524-1-git-send-email-lgustavo@codesourcery.com> <553E58A3.5020904@codesourcery.com> <86mw1swmwi.fsf@gmail.com> In-Reply-To: <86mw1swmwi.fsf@gmail.com> X-IsSubscribed: yes On 04/28/2015 07:46 AM, Yao Qi wrote: > Luis Machado writes: > >> Ping? > > Hi Luis, > I've approved this patch here > https://sourceware.org/ml/gdb-patches/2015-04/msg00512.html If my > comments are addressed in the updated patch, you can push it in. > Sorry. For some reason i didn't get that reply. I did the changes and pushed the attached patch in. Thanks, Luis diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 639dae7..3e2df8f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-04-29 Luis Machado + + * gdb.base/break-always.exp: Abort testing if writing to memory + causes an error. + 2015-04-28 Doug Evans * gdb.python/py-pp-maint.py: Move "replace" testing to ... diff --git a/gdb/testsuite/gdb.base/break-always.exp b/gdb/testsuite/gdb.base/break-always.exp index 681be37..c45ce54 100644 --- a/gdb/testsuite/gdb.base/break-always.exp +++ b/gdb/testsuite/gdb.base/break-always.exp @@ -69,19 +69,25 @@ 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" + + gdb_test_multiple "p /x *(char *) $bp_address = $test_value" $write_test { + -re "Cannot access memory at address $hex.*$gdb_prompt $" { + + # Some targets do not allow manually writing a breakpoint to a + # certain memory address, like QEMU. In that case, just bail out. + 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" + gdb_test "p /x *(char *) $bp_address" " = 0x$test_value" $read_test +} # Restore the original contents. gdb_test "p /x *(char *) $bp_address = \$shadow" "" \