This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[RFA] Add NormalBreakpoint
- From: Keith Seitz <keiths at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Tue, 12 Jun 2007 12:47:37 -0700
- Subject: [RFA] Add NormalBreakpoint
Hi,
I've been working on getting VMVM.executeMethod working, and I need to
refactor our breakpoint support. The attached patch breaks
gnu.gcj.jvmti.Breakpoint into two classes. "Breakpoint" will be a base
class for breakpoint classes. "NormalBreakpoint" is (as it sounds) a
"normal" breakpoint. Functionally this patch is a nop.
QCC?
Keith
ChangeLog
2007-06-12 Keith Seitz <keiths@redhat.com>
* gnu/gcj/jvmti/Breakpoint.java (type): New data member.
(method): Change from private to protected.
(location): Likewise.
(Breakpoint): Change argument list to take only integer type.
(initialize_native): Renamed to ...
(_save_insn): ... this to make function more explicit.
(type): New method.
* gnu/gcj/jvmti/NormalBreakpoint.java: New file.
* gnu/gcj/jvmti/BreakpointManager.java (newBreakpoint):
Instantiate a NormalBreakpoint instead of the Breakpoint
base class.
Index: gnu/gcj/jvmti/Breakpoint.java
===================================================================
--- gnu/gcj/jvmti/Breakpoint.java (revision 125581)
+++ gnu/gcj/jvmti/Breakpoint.java (working copy)
@@ -1,6 +1,6 @@
-// Breakpoint.java - a breakpoint in the interpreter
+// Breakpoint.java - a base class for interpreter breakpoints
-/* Copyright (C) 2006 Free Software Foundation
+/* Copyright (C) 2006, 2007 Free Software Foundation
This file is part of libgcj.
@@ -13,37 +13,45 @@
import gnu.gcj.RawDataManaged;
/**
- * Class representing a Breakpoint.
+ * Base class representing a type of breakpoint in the interpreter.
+ * This class deals with saving insns and installing and
+ * uninstalling insns in the interpreter for all breakpoint classes.
*
* @author Keith Seitz (keiths@redhat.com)
*/
public class Breakpoint
{
+ // Type of this breakpoint
+ protected int type;
+
// Location of this breakpoint
- private long method;
- private long location;
+ protected long method;
+ protected long location;
// The original instruction that this breakpoint replaced
private RawDataManaged data;
/**
- * Constructs a new Breakpoint. SetBreakpoint will verify the
- * validity of the arguments.
+ * Constructs a new Breakpoint
*
- * @param method the method (a jmethodID)
- * @param location the jlocation of the breakpoint (a jlocation)
+ * @param type the type of breakpoint
*/
- public Breakpoint (long method, long location)
+ public Breakpoint (int type)
{
- this.method = method;
- this.location = location;
- initialize_native ();
+ this.type = type;
}
- private native void initialize_native ();
+ private native void _save_insn ();
+ /**
+ * Installs the breakpoint into the interpreter
+ */
public native void install ();
+ /**
+ * Removes the breakpoint from the interpreter, re-installing
+ * the original instruction.
+ */
public native void remove ();
/**
@@ -54,4 +62,12 @@
{
return data;
}
+
+ /**
+ * Returns the type of this breakpoint.
+ */
+ public int type ()
+ {
+ return this.type;
+ }
}
Index: gnu/gcj/jvmti/NormalBreakpoint.java
===================================================================
--- gnu/gcj/jvmti/NormalBreakpoint.java (revision 0)
+++ gnu/gcj/jvmti/NormalBreakpoint.java (revision 0)
@@ -0,0 +1,31 @@
+// NormalBreakpoint.java - a "normal" breakpoint in the interpreter
+
+/* Copyright (C) 2007 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package gnu.gcj.jvmti;
+
+/**
+ * This class represents a "normal" breakpoint in the interpreter.
+ * When the interpreter hits this breakpoint type, it will send out
+ * a JVMTI breakpoint notification.
+ *
+ * @author Keith Seitz (keiths@redhat.com)
+ */
+public class NormalBreakpoint
+ extends Breakpoint
+{
+ public static final int TYPE = 0;
+
+ public NormalBreakpoint (long method, long location)
+ {
+ super (TYPE);
+ this.method = method;
+ this.location = location;
+ }
+}
Index: gnu/gcj/jvmti/BreakpointManager.java
===================================================================
--- gnu/gcj/jvmti/BreakpointManager.java (revision 125581)
+++ gnu/gcj/jvmti/BreakpointManager.java (working copy)
@@ -43,7 +43,7 @@
*/
public static Breakpoint newBreakpoint (long method, long location)
{
- Breakpoint bp = new Breakpoint (method, location);
+ NormalBreakpoint bp = new NormalBreakpoint (method, location);
Location loc = new Location (method, location);
bp.install ();
_instance._breakpoints.put (loc, bp);