public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Set task pc before calling any Code observers on breakpoint. Fixes bug #6029.
@ 2008-04-11 17:29 mark
  0 siblings, 0 replies; only message in thread
From: mark @ 2008-04-11 17:29 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  40fbefd8950ef47a338fd60e10ab6ed234330fc2 (commit)
      from  8b5325ce144ef2766f64c016a1c089157a76ff8f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 40fbefd8950ef47a338fd60e10ab6ed234330fc2
Author: Mark Wielaard <mwielaard@redhat.com>
Date:   Fri Apr 11 19:22:53 2008 +0200

    Set task pc before calling any Code observers on breakpoint. Fixes bug #6029.
    
    frysk-core/frysk/proc/live/ChangeLog
    2008-04-11  Mark Wielaard  <mwielaard@redhat.com>
    
           * LinuxPtraceTaskState.java (Running.setupSteppingBreakpoint):
           Removed.
           (Running.handleTrappedEvent): Don't call
           setupSteppingBreakpoint().
           (Stepping.handleTrappedEvent): Don't do stepping breakpoint sanity
           check. Don't call setupSteppingBreakpoint().
           * LinuxPtraceTask.java (notifyCodeBreakpoint): Add stepping
           breakpoint sanity check. Set task pc when breakpoint found. Set
           steppingBreakpoint.
    
    frysk-core/frysk/stack/ChangeLog
    2008-04-11  Mark Wielaard  <mwielaard@redhat.com>
    
           * TestFrame.java (testBogusAddressPrevFrame): Resolved.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/proc/live/ChangeLog               |   12 ++++++++
 frysk-core/frysk/proc/live/LinuxPtraceTask.java    |   26 +++++++++++++++++-
 .../frysk/proc/live/LinuxPtraceTaskState.java      |   29 --------------------
 frysk-core/frysk/stack/ChangeLog                   |    4 +++
 frysk-core/frysk/stack/TestFrame.java              |    3 --
 5 files changed, 41 insertions(+), 33 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog
index c3c9dec..68dccd1 100644
--- a/frysk-core/frysk/proc/live/ChangeLog
+++ b/frysk-core/frysk/proc/live/ChangeLog
@@ -1,3 +1,15 @@
+2008-04-11  Mark Wielaard  <mwielaard@redhat.com>
+
+	* LinuxPtraceTaskState.java (Running.setupSteppingBreakpoint):
+	Removed.
+	(Running.handleTrappedEvent): Don't call
+	setupSteppingBreakpoint().
+	(Stepping.handleTrappedEvent): Don't do stepping breakpoint sanity
+	check. Don't call setupSteppingBreakpoint().
+	* LinuxPtraceTask.java (notifyCodeBreakpoint): Add stepping
+	breakpoint sanity check. Set task pc when breakpoint found. Set
+	steppingBreakpoint.
+	
 2008-04-10  Phil Muldoon  <pmuldoon@redhat.com>
 
 	* LinuxPtraceProc.java: Clean up some indention and add/fix
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTask.java b/frysk-core/frysk/proc/live/LinuxPtraceTask.java
index 8f651f3..a0f75c7 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceTask.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceTask.java
@@ -937,9 +937,33 @@ public class LinuxPtraceTask extends LiveTask {
      */
     int notifyCodeBreakpoint(long address) {
 	fine.log(this, "notifyCodeBreakpoint address", address);
-	Collection observers = ((LinuxPtraceProc)getProc()).breakpoints.getCodeObservers(address);
+	LinuxPtraceProc proc = (LinuxPtraceProc) getProc();
+	Collection observers = proc.breakpoints.getCodeObservers(address);
 	if (observers == null)
 	    return -1;
+
+	// Sanity check
+	if (steppingBreakpoint != null)
+	  throw new RuntimeException("Already breakpoint stepping: "
+				     + steppingBreakpoint);
+
+	// Reset pc, some architectures might leave the pc right after
+	// the breakpoint, but since we haven't actually executed the
+	// real instruction yet we want it to be at the actual address
+	// of the original instruction.
+	setPC(address);
+
+	// All logic for determining how and where to step the              
+	// Breakpoint is determined by Proc and                             
+	// Breakpoint.prepareStep() (called in sendContinue).               
+	Breakpoint bp = Breakpoint.create(address,proc);
+
+	// TODO: This should really move us to a new TaskState.             
+	// Currently we rely on the Task.steppingBreakpoint                 
+	// being set and the Breakpoint/Instruction having all              
+	// the state necessary.                                             
+	steppingBreakpoint = bp;
+
 	Iterator i = observers.iterator();
 	while (i.hasNext()) {
 	    TaskObserver.Code observer = (TaskObserver.Code) i.next();
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java b/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java
index 9a71530..50ebabd 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java
@@ -725,26 +725,6 @@ abstract class LinuxPtraceTaskState extends State {
 	    this.insyscall = insyscall;
 	}
 	
-	void setupSteppingBreakpoint(LinuxPtraceTask task, long address) {
-	    // Reset pc, this should maybe be moved into the Breakpoint,
-	    // but if the breakpoint gets removed before we step it, and
-	    // the architecture puts the pc just behind the breakpoint
-	    // address, then there is no good other place to get at the
-	    // original pc location.
-	    task.setPC(address);
-
-	    // All logic for determining how and where to step the
-	    // Breakpoint is determined by Proc and
-	    // Breakpoint.prepareStep() (called in sendContinue).
-	    Breakpoint bp = Breakpoint.create(address,((LinuxPtraceProc)task.getProc()));
-	
-	    // TODO: This should really move us to a new TaskState.
-	    // Currently we rely on the Task.steppingBreakpoint
-	    // being set and the Breakpoint/Instruction having all
-	    // the state necessary.
-	    task.steppingBreakpoint = bp;
-	}
-      
         /**
 	 * Tells the LinuxPtraceTask to continue, keeping in kind pending
 	 * breakpoints, with or without syscall tracing.
@@ -1006,7 +986,6 @@ abstract class LinuxPtraceTaskState extends State {
 	    int stepBlockers = task.notifyCodeBreakpoint(address);
 	    if (stepBlockers >= 0) {
 		// Prepare for stepping the breakpoint
-		setupSteppingBreakpoint(task, address);
 		blockers += stepBlockers;
 		isTrapHandled = true;
 	    } 
@@ -1146,14 +1125,6 @@ abstract class LinuxPtraceTaskState extends State {
 		long address = isa.getBreakpointAddress(task);
 		int breakpointBlockers = task.notifyCodeBreakpoint(address);
 		if (breakpointBlockers >= 0) {
-		    // Sanity check
-		    if (task.steppingBreakpoint != null)
-			throw new RuntimeException("Already breakpoint stepping: "
-						   + task.steppingBreakpoint);
-	      
-		    // Prepare for stepping the breakpoint
-		    setupSteppingBreakpoint(task, address);
-	      
 		    blockers += breakpointBlockers;
 		    isTrapHandled = true;
 		} else {
diff --git a/frysk-core/frysk/stack/ChangeLog b/frysk-core/frysk/stack/ChangeLog
index d16af8c..714e8dc 100644
--- a/frysk-core/frysk/stack/ChangeLog
+++ b/frysk-core/frysk/stack/ChangeLog
@@ -1,3 +1,7 @@
+2008-04-11  Mark Wielaard  <mwielaard@redhat.com>
+
+	* TestFrame.java (testBogusAddressPrevFrame): Resolved.
+
 2008-04-07  Mark Wielaard  <mwielaard@redhat.com>
 
 	* TestSignalStepFrame.java: New tests.
diff --git a/frysk-core/frysk/stack/TestFrame.java b/frysk-core/frysk/stack/TestFrame.java
index 327e1a6..c647efa 100644
--- a/frysk-core/frysk/stack/TestFrame.java
+++ b/frysk-core/frysk/stack/TestFrame.java
@@ -42,7 +42,6 @@ package frysk.stack;
 import java.util.Iterator;
 import java.util.List;
 
-//import frysk.proc.Proc;
 import frysk.config.Config;
 import frysk.proc.Action;
 import frysk.proc.Manager;
@@ -174,8 +173,6 @@ public class TestFrame extends TestLib {
     }
 
     public void testBogusAddressPrevFrame() throws ElfException {
-	if (unresolved(6029))
-	    return;
     	class CodeObserver1 implements TaskObserver.Code
 	{
 	    public boolean hit = false;


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-11 17:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-11 17:29 [SCM] master: Set task pc before calling any Code observers on breakpoint. Fixes bug #6029 mark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).