From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11616 invoked by alias); 7 Apr 2008 15:21:55 -0000 Received: (qmail 11591 invoked by uid 9514); 7 Apr 2008 15:21:54 -0000 Date: Mon, 07 Apr 2008 15:21:00 -0000 Message-ID: <20080407152154.11576.qmail@sourceware.org> From: pmuldoon@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Reset watchpoint after noting trigger. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: fd38b34dcc23843a0dd48d914878a6c9b9418bae X-Git-Newrev: 9472675fd80d52cdc4f259133d0278511c0f3da9 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q2/txt/msg00057.txt.bz2 The branch, master has been updated via 9472675fd80d52cdc4f259133d0278511c0f3da9 (commit) from fd38b34dcc23843a0dd48d914878a6c9b9418bae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 9472675fd80d52cdc4f259133d0278511c0f3da9 Author: Phil Muldoon Date: Mon Apr 7 16:20:55 2008 +0100 Reset watchpoint after noting trigger. 2008-04-07 Phil Muldoon * WatchpointFunctions.java (resetWatchpoint): New. * IA32WatchpointFunctions.java (resetWatchpoint): Implement. * X8664WatchpointFunctions.java (resetWatchpoint): Ditto. 2008-04-07 Phil Muldoon * LinuxPtraceTaskState.java (Stepping.handleTrappedEvent): Reset watchpoint after noting trigger. (Running.handleTrappedEvent): Ditto. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/isa/watchpoints/ChangeLog | 6 ++++++ .../isa/watchpoints/IA32WatchpointFunctions.java | 13 +++++++++++++ .../frysk/isa/watchpoints/WatchpointFunctions.java | 12 ++++++++++++ .../isa/watchpoints/X8664WatchpointFunctions.java | 14 ++++++++++++++ frysk-core/frysk/proc/live/ChangeLog | 6 ++++++ .../frysk/proc/live/LinuxPtraceTaskState.java | 2 ++ 6 files changed, 53 insertions(+), 0 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/isa/watchpoints/ChangeLog b/frysk-core/frysk/isa/watchpoints/ChangeLog index 4c408b4..b58ecff 100644 --- a/frysk-core/frysk/isa/watchpoints/ChangeLog +++ b/frysk-core/frysk/isa/watchpoints/ChangeLog @@ -1,3 +1,9 @@ +2008-04-07 Phil Muldoon + + * WatchpointFunctions.java (resetWatchpoint): New. + * IA32WatchpointFunctions.java (resetWatchpoint): Implement. + * X8664WatchpointFunctions.java (resetWatchpoint): Ditto. + 2008-04-04 Phil Muldoon * X8664WatchpointFunctions.java (setWatchpoint): Set 2 byte watch to diff --git a/frysk-core/frysk/isa/watchpoints/IA32WatchpointFunctions.java b/frysk-core/frysk/isa/watchpoints/IA32WatchpointFunctions.java index c8964db..42d2fce 100644 --- a/frysk-core/frysk/isa/watchpoints/IA32WatchpointFunctions.java +++ b/frysk-core/frysk/isa/watchpoints/IA32WatchpointFunctions.java @@ -233,6 +233,19 @@ class IA32WatchpointFunctions extends WatchpointFunctions { return (debugStatus & (1L << index)) != 0; } + /** + * Resets the appropriate bit in the debug status register + * after a watchpoint has triggered, thereby reseting it. + * + * @param task - task to read the debug control + * register from. + * @param index - Debug register to reset. + */ + public void resetWatchpoint(Task task, int index) { + long debugStatus = readStatusRegister(task); + debugStatus &= ~(1L << index); + task.setRegister(IA32Registers.DEBUG_STATUS, debugStatus); + } /** * Reads the Debug control register. diff --git a/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java b/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java index 0eb247a..5270459 100644 --- a/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java +++ b/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java @@ -126,10 +126,22 @@ public abstract class WatchpointFunctions { * * @param task - task to read the debug control * register from. + * @param index - Debug register to check + */ public abstract boolean hasWatchpointTriggered(Task task, int index); /** + * Resets the appropriate bit in the debug status register + * after a watchpoint has triggered, thereby reseting it. + * + * @param task - task to read the debug control + * register from. + * @param index - Debug register to reset. + */ + public abstract void resetWatchpoint(Task task, int index); + + /** * Returns number of watchpoints for this architecture * * @return int number of usable watchpoints. diff --git a/frysk-core/frysk/isa/watchpoints/X8664WatchpointFunctions.java b/frysk-core/frysk/isa/watchpoints/X8664WatchpointFunctions.java index b227be6..11f5030 100644 --- a/frysk-core/frysk/isa/watchpoints/X8664WatchpointFunctions.java +++ b/frysk-core/frysk/isa/watchpoints/X8664WatchpointFunctions.java @@ -253,6 +253,20 @@ class X8664WatchpointFunctions extends WatchpointFunctions { return (debugStatus & (1L << index)) != 0; } + /** + * Resets the appropriate bit in the debug status register + * after a watchpoint has triggered, thereby reseting it. + * + * @param task - task to read the debug control + * register from. + * @param index - Debug register to reset. + */ + public void resetWatchpoint(Task task, int index) { + long debugStatus = readStatusRegister(task); + debugStatus &= ~(1L << index); + task.setRegister(X8664Registers.DEBUG_STATUS, debugStatus); + } + private boolean testBit(long register, int bitToTest) { return (register & (1L << bitToTest)) != 0; } diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog index 58b6fae..84dc832 100644 --- a/frysk-core/frysk/proc/live/ChangeLog +++ b/frysk-core/frysk/proc/live/ChangeLog @@ -1,3 +1,9 @@ +2008-04-07 Phil Muldoon + + * LinuxPtraceTaskState.java (Stepping.handleTrappedEvent): Reset + watchpoint after noting trigger. + (Running.handleTrappedEvent): Ditto. + 2008-04-07 Mark Wielaard * LinuxPtraceTaskState.java (Stepping.handleTrappedEvent): diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java b/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java index 7d737f9..8f35740 100644 --- a/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java +++ b/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java @@ -950,6 +950,7 @@ abstract class LinuxPtraceTaskState extends State { // Test if a watchpoint has fired if (watchpointFunction.hasWatchpointTriggered(task, i)) { frysk.isa.watchpoints.Watchpoint trigger = watchpointFunction.readWatchpoint(task, i); + watchpointFunction.resetWatchpoint(task, i); int blockers = task.notifyWatchpoint(trigger.getAddress(), trigger.getRange()); if (blockers == 0) return sendContinue(task, Signal.NONE); @@ -1084,6 +1085,7 @@ abstract class LinuxPtraceTaskState extends State { // Test if a watchpoint has fired if (watchpointFunction.hasWatchpointTriggered(task, i)) { frysk.isa.watchpoints.Watchpoint trigger = watchpointFunction.readWatchpoint(task, i); + watchpointFunction.resetWatchpoint(task, i); int blockers = task.notifyWatchpoint(trigger.getAddress(), trigger.getRange()); if (blockers == 0) return sendContinue(task, Signal.NONE); hooks/post-receive -- frysk system monitor/debugger