From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24088 invoked by alias); 22 Nov 2009 12:56:31 -0000 Received: (qmail 24079 invoked by uid 22791); 22 Nov 2009 12:56:31 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 22 Nov 2009 12:55:26 +0000 Received: (qmail 5533 invoked from network); 22 Nov 2009 12:55:24 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 22 Nov 2009 12:55:24 -0000 From: Pedro Alves To: Hui Zhu Subject: Re: [RFA] Fix hw watchpoints in process record. Date: Sun, 22 Nov 2009 12:56:00 -0000 User-Agent: KMail/1.9.10 Cc: Michael Snyder , "gdb-patches@sourceware.org" References: <4AECE12F.3000704@vmware.com> <4B084394.4010304@vmware.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200911221255.25826.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2009-11/txt/msg00471.txt.bz2 On Sunday 22 November 2009 02:10:23, Hui Zhu wrote: > I think this patch still not OK. ... > (gdb) hb *0x000000000040055b > During symbol reading, incomplete CFI data; unspecified registers > (e.g., rax) at 0x400550. > Hardware assisted breakpoint 2 at 0x40055b: file 1.c, line 21. > (gdb) record > (gdb) c > Continuing. > > Program received signal SIGTRAP, Trace/breakpoint trap. > 0x000000000040055c in main () at 1.c:21 > 21 int c = 1; > (gdb) info reg pc > pc: 0x40055c > > The stop pc is not right. Looks we need do some special works when > this is a simple hb. You're confusing hardware watchpoints with hardware breakpoints. The patch handles hardware _watchpoints_ only. Fixing hardware breakpoints is a different and unrelated issue. Actually, the problem you're seeing sounds simple: The breakpoint is set at 0x40055b, but GDB shows the SIGTRAP trigger at 0x40055c. Off by one, that is. Completelly untested, but I bet that something like this fixes it: record_wait: if (breakpoint_inserted_here_p (get_regcache_aspace (regcache), tmp_pc)) { /* There is a breakpoint. GDB will want to stop. */ + if (software_breakpoint_inserted_here_p (get_regcache_aspace (regcache), + tmp_pc)) struct gdbarch *gdbarch = get_regcache_arch (regcache); CORE_ADDR decr_pc_after_break = gdbarch_decr_pc_after_break (gdbarch); if (decr_pc_after_break) regcache_write_pc (regcache, tmp_pc + decr_pc_after_break); + } } -- Pedro Alves