From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16573 invoked by alias); 20 Apr 2009 18:31:35 -0000 Received: (qmail 16564 invoked by uid 22791); 20 Apr 2009 18:31:34 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail3.caviumnetworks.com (HELO mail3.caviumnetworks.com) (12.108.191.235) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Apr 2009 18:31:28 +0000 Received: from exch4.caveonetworks.com (Not Verified[192.168.16.23]) by mail3.caviumnetworks.com with MailMarshal (v6,2,2,3503) id ; Mon, 20 Apr 2009 14:31:20 -0400 Received: from exch4.caveonetworks.com ([192.168.16.23]) by exch4.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 20 Apr 2009 11:31:17 -0700 Received: from dd1.caveonetworks.com ([64.169.86.201]) by exch4.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 20 Apr 2009 11:31:17 -0700 Message-ID: <49ECBF74.8020306@caviumnetworks.com> Date: Mon, 20 Apr 2009 18:31:00 -0000 From: David Daney User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches@sourceware.org Subject: [Patch 1/2] Fix aftermath of 'infrun.c support for MIPS hardware watchpoints.' References: <49D9AECB.7040302@gmail.com> <200904111817.36236.pedro@codesourcery.com> <49E765F7.1030201@caviumnetworks.com> <200904171443.26794.pedro@codesourcery.com> In-Reply-To: <200904171443.26794.pedro@codesourcery.com> Content-Type: multipart/mixed; boundary="------------040509010704060502040205" 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-04/txt/msg00529.txt.bz2 This is a multi-part message in MIME format. --------------040509010704060502040205 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1495 Pedro Alves wrote: > Thanks for the update. > > On Thursday 16 April 2009 18:08:07, David Daney wrote: >>>> Reported instruction location of the watchpoint trigger is one >>>> instruction later and one line later. >>> Why is that? >> I was mistaken, it is earlier, not later. With hardware watch points, >> $pc points to the faulting instruction, with software watch points $pc >> points to the following instruction. In a couple of tests, this results >> in the reported line number being different than the expected value. > > I'm missing something and am still confused. PC points at the > faulting instruction when the target reports the watchpoint hit to > infrun --- . That step-over-watchpoint dance that patch 1/2 took care of comes > into play. That should move the inferior to the following instruction, evaluate > the watchpoint expression, notice the value changed, and report to the > user. Why does the PC still point at the faulting instruction? > This patch had a small problem: http://sourceware.org/ml/gdb-patches/2009-04/msg00245.html I was calling registers_changed() to clear the register cache, but then immediately calling read_pc() which caused it to be reloaded. After the single step to move past the watchpoint, the old cached register values were used instead of the current values. The fix: Move the registers_changed() call after read_pc(). Tested on x86_64-unknown-linux-gnu and mips64-unknown-linux-gnu with no regressions. OK to commit? --------------040509010704060502040205 Content-Type: text/plain; name="infrun.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="infrun.patch" Content-length: 799 2009-04-20 David Daney * infrun.c (handle_inferior_event): Move registers_changed call down. Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.368 diff -u -p -r1.368 infrun.c --- infrun.c 14 Apr 2009 00:59:47 -0000 1.368 +++ infrun.c 20 Apr 2009 18:14:35 -0000 @@ -2842,9 +2842,9 @@ targets should add new threads to the th if (!HAVE_STEPPABLE_WATCHPOINT) remove_breakpoints (); - registers_changed (); /* Single step */ hw_step = maybe_software_singlestep (current_gdbarch, read_pc ()); + registers_changed (); target_resume (ecs->ptid, hw_step, TARGET_SIGNAL_0); waiton_ptid = ecs->ptid; if (HAVE_STEPPABLE_WATCHPOINT) --------------040509010704060502040205--