From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31795 invoked by alias); 6 Jun 2014 03:10:36 -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 31775 invoked by uid 89); 6 Jun 2014 03:10:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham 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; Fri, 06 Jun 2014 03:10:29 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WskXx-00038Z-KX from Yao_Qi@mentor.com ; Thu, 05 Jun 2014 20:10:25 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 5 Jun 2014 20:10:25 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Thu, 5 Jun 2014 20:10:24 -0700 Message-ID: <539130AC.2050401@codesourcery.com> Date: Fri, 06 Jun 2014 03:10:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Pedro Alves , Subject: Re: [pushed] Don't suppress errors inserting/removing hardware breakpoints in shared libraries. References: <1398262082-12503-1-git-send-email-palves@redhat.com> <538D982A.4070404@codesourcery.com> <5390946C.6010408@redhat.com> In-Reply-To: <5390946C.6010408@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00297.txt.bz2 On 06/06/2014 12:01 AM, Pedro Alves wrote: > Yes, but no need to match by target, we can do like e.g., > gdb.base/signull.exp does, and check whether "x /b 0" manages > to read memory. If so, then skip the test. Any sane target with > an MMU will leave page 0 unmapped, so no need to look for some other > address. How about the patch below? -- Yao (齐尧) Subject: [PATCH] Skip hbreak-unmapped.exp if memory at address 0 is readable hbreak-unmapped.exp assumes that memory at address 0 is unmapped or unreadable, but on bare metal or uclinux targets, memory at address 0 is readable. For example, on arm-none-eabi, the vector table base address is 0x0. hbreak *0^M Hardware assisted breakpoint 3 at 0x0: file /scratch/yqi/arm-none-eabi-lite/obj/cs3-2014.11-999999-arm-none-eabi-i686-pc-linux-gnu/generated/arm-vector.S, line 25.^M (gdb) FAIL: gdb.base/hbreak-unmapped.exp: hbreak *0 info break^M Num Type Disp Enb Address What^M 3 hw breakpoint keep y 0x00000000 /scratch/yqi/arm-none-eabi-lite/obj/cs3-2014.11-999999-arm-none-eabi-i686-pc-linux-gnu/generated/arm-vector.S:25^M (gdb) FAIL: gdb.base/hbreak-unmapped.exp: info break shows hw breakpoint delete $bpnum This patch is to check whether address 0 is readable via command 'x 0'. If it is, skip the test. gdb/testsuite: 2014-06-06 Yao Qi * gdb.base/hbreak-unmapped.exp: Read memory at address 0. If readable, skip the test. --- gdb/testsuite/gdb.base/hbreak-unmapped.exp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdb/testsuite/gdb.base/hbreak-unmapped.exp b/gdb/testsuite/gdb.base/hbreak-unmapped.exp index 5cb655c..95668f2 100644 --- a/gdb/testsuite/gdb.base/hbreak-unmapped.exp +++ b/gdb/testsuite/gdb.base/hbreak-unmapped.exp @@ -28,6 +28,16 @@ if ![runto_main] { return -1 } +# If we can read the memory at address 0, skip the test. +gdb_test_multiple "x 0" "memory at address 0" { + -re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { } + -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { } + -re ".*$gdb_prompt $" { + untested "Memory at address 0 is readable" + return + } +} + delete_breakpoints # Test whether the target supports hardware breakpoints at all. -- 1.9.0