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?