This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Remove breakpoints


Hi,

Looks like there's a slight oversight in removing breakpoints: they get removed from the global list of installed breakpoints, but the original insn is never reinstalled into the method's bytecode. The attached patch fixes that, and also moves the installation of the breakpoint to a more logical place.

Ok?

Keith

ChangeLog
2007-04-19  Keith Seitz  <keiths@redhat.com>

        * gnu/gcj/jvmti/BreakpointManager.java (newBreakpoint):
        Install the new breakpoint into the bytecode.
        (deleteBreakpoint): Remove the breakpoint from the bytecode.
        * gnu/gcj/jvmti/natBreakpoint.cc (initialize_native):
        Don't install the breakpoint here.
Index: gnu/gcj/jvmti/BreakpointManager.java
===================================================================
--- gnu/gcj/jvmti/BreakpointManager.java	(revision 123960)
+++ gnu/gcj/jvmti/BreakpointManager.java	(working copy)
@@ -1,6 +1,6 @@
 // BreakpointManager.java - A convenience class for dealing with breakpoints
 
-/* Copyright (C) 2006  Free Software Foundation
+/* Copyright (C) 2006, 2007  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -45,6 +45,7 @@
   {
     Breakpoint bp = new Breakpoint (method, location);
     Location loc = new Location (method, location);
+    bp.install ();
     _instance._breakpoints.put (loc, bp);
     return bp;
   }
@@ -58,7 +59,12 @@
   public static void deleteBreakpoint (long method, long location)
   {
     Location loc = new Location (method, location);
-    _instance._breakpoints.remove (loc);
+    Breakpoint bp = (Breakpoint) _instance._breakpoints.get (loc);
+    if (bp != null)
+      {
+	bp.remove ();
+	_instance._breakpoints.remove (loc);
+      }
   }
 
   /**
Index: gnu/gcj/jvmti/natBreakpoint.cc
===================================================================
--- gnu/gcj/jvmti/natBreakpoint.cc	(revision 123960)
+++ gnu/gcj/jvmti/natBreakpoint.cc	(working copy)
@@ -1,6 +1,6 @@
 // natBreakpoint.cc - C++ side of Breakpoint
 
-/* Copyright (C) 2006  Free Software Foundation
+/* Copyright (C) 2006, 2007  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -39,7 +39,6 @@
   pc_t code = imeth->get_insn (location);
   data = (RawDataManaged *) JvAllocBytes (sizeof (*code));
   memcpy (data, code, sizeof (*code));
-  install ();
 }
 
 void

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]