From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26919 invoked by alias); 24 Apr 2012 14:18:06 -0000 Received: (qmail 26894 invoked by uid 22791); 24 Apr 2012 14:18:04 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-gy0-f169.google.com (HELO mail-gy0-f169.google.com) (209.85.160.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Apr 2012 14:17:51 +0000 Received: by ghrr18 with SMTP id r18so442948ghr.0 for ; Tue, 24 Apr 2012 07:17:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.60.7.200 with SMTP id l8mr11570745oea.52.1335277070261; Tue, 24 Apr 2012 07:17:50 -0700 (PDT) Received: by 10.182.179.35 with HTTP; Tue, 24 Apr 2012 07:17:50 -0700 (PDT) In-Reply-To: <4F96A812.4000008@mentor.com> References: <4F96A614.3040303@mentor.com> <4F96A812.4000008@mentor.com> Date: Tue, 24 Apr 2012 14:18:00 -0000 Message-ID: Subject: Re: Hardware watchpoint for read From: Xin Tong To: "Gustavo, Luis" Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00196.txt.bz2 On Tue, Apr 24, 2012 at 9:18 AM, Luis Gustavo wro= te: > On 04/24/2012 10:15 AM, Xin Tong wrote: >> >> On Tue, Apr 24, 2012 at 9:09 AM, Luis Gustavo >> =A0wrote: >>> >>> Hi, >>> >>> >>> On 04/24/2012 10:02 AM, Xin Tong wrote: >>>> >>>> >>>> Hello >>>> >>>> I am wondering that can gdb insert hardware watch point for read to >>>> the watched memory ? can other debugger do that ? is it supported in >>>> hardware watchpoint ? >>>> >>>> Thanks >>>> >>>> Xin >>>> >>> >>> Read watchpoints are hard to implement as soft-watchpoints, so they're >>> usually implemented as hardware watchpoints. >> >> >> software write watchpoint is easier to implement ? do not software >> watchpoint need to watch all memory accesses (read and write) to a >> memory location in software ? > > > Writes are "easier" to implemenet due to the fact that they usually change > memory contents. Reads don't. Either way, do not gdb need to instrument every memory accesses if a software watch point is used ? > > >> >>> >>> If a debugger knows how to properly set the bits in the hardware, either >>> through ptrace or other means, it can configure a read/write/read-write >>> watchpoint. Depends on hardware support really. >> >> >> do you know whether this is supported on the x86 chips ? is thee a way >> to try this out in gdb ? > > > All those modes should be supported in x86. Try "watch", "rwatch" and > "awatch". how are hardware watch, rwatch and awatch implemented in gdb. make call to ptrace apis and ptrace apis program some x86 registers through a driver interfaces ? > >> >>> >>> Regards, >>> Luis > >