Breakpoint.java: Make abstract.

* gnu/gcj/jvmti/Breakpoint.java: Make abstract.
        (method): Change from private to protected.
        (location): Likewise.
        (Breakpoint): Change argument list to take only integer type.
        Add default constructor.
        (initialize_native): Renamed to ...
        (_save_insn): ... this to make function more explicit.
        (execute): New method.
        * gnu/gcj/jvmti/Breakpoint.h: Regenerate.
        * gnu/gcj/jvmti/natBreakpoint.cc (initialize_native): Rename to...
        (_save_insn): ... this.
        (install): Save the original instruction.
        * gnu/gcj/jvmti/NormalBreakpoint.java: New file.
        * gnu/gcj/jvmti/NormalBreakpoint.h: New file.
        * gnu/gcj/jvmti/natNormalBreakpoint.cc: New file.
        * gnu/gcj/jvmti/BreakpointManager.java (newBreakpoint):
        Instantiate a NormalBreakpoint instead of Breakpoint.
        * interpret-run.cc (insn_breakpoint): Remove breakpoint actions
        and call Breakpoint.execute to do them.
        * classpath/lib/gnu/gcj/jvmti/Breakpoint.class: Regenerate.
        * classpath/lib/gnu/gcj/jvmti/BreakpointManager.class: Likewise.
        * classpath/lib/gnu/gcj/jvmti/NormalBreakpoint.class: New file.
        * sources.am: Regenerate.
        * Makefile.am (nat_source_files): Add natNormalBreakpoint.cc.
        * Makefile.in: Regenerated.

From-SVN: r125834
This commit is contained in:
Keith Seitz
2007-06-19 00:10:10 +00:00
committed by Keith Seitz
parent f7b950b935
commit 02b1e78caf
15 changed files with 180 additions and 31 deletions
+5 -2
View File
@@ -35,15 +35,18 @@ friend void (::_Jv_RewriteBreakpointInsn (jmethodID, jlocation, pc_t));
public:
Breakpoint(jlong, jlong);
Breakpoint();
private:
void initialize_native();
void _save_insn();
public:
virtual void install();
virtual void remove();
virtual ::gnu::gcj::RawDataManaged * getInsn();
private:
virtual void execute() = 0;
public: // actually protected
jlong __attribute__((aligned(__alignof__( ::java::lang::Object)))) method;
jlong location;
private:
::gnu::gcj::RawDataManaged * data;
public:
static ::java::lang::Class class$;
+28 -12
View File
@@ -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,48 @@ package gnu.gcj.jvmti;
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
public abstract class Breakpoint
{
// 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 method the method in which to set the breakpoint
* @param location the location at which to set the breakpoint
*/
public Breakpoint (long method, long location)
{
this.method = method;
this.location = location;
initialize_native ();
}
private native void initialize_native ();
public Breakpoint ()
{
}
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 +65,9 @@ public class Breakpoint
{
return data;
}
/**
* Execute the actions of this breakpoint
*/
public abstract void execute ();
}
+1 -1
View File
@@ -43,7 +43,7 @@ public class BreakpointManager
*/
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);
+33
View File
@@ -0,0 +1,33 @@
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __gnu_gcj_jvmti_NormalBreakpoint__
#define __gnu_gcj_jvmti_NormalBreakpoint__
#pragma interface
#include <gnu/gcj/jvmti/Breakpoint.h>
extern "Java"
{
namespace gnu
{
namespace gcj
{
namespace jvmti
{
class NormalBreakpoint;
}
}
}
}
class gnu::gcj::jvmti::NormalBreakpoint : public ::gnu::gcj::jvmti::Breakpoint
{
public:
NormalBreakpoint(jlong, jlong);
virtual void execute();
static ::java::lang::Class class$;
};
#endif // __gnu_gcj_jvmti_NormalBreakpoint__
@@ -0,0 +1,29 @@
// 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 NormalBreakpoint (long method, long id)
{
super (method, id);
}
public native void execute ();
}
+2 -1
View File
@@ -32,7 +32,7 @@ get_interp_method (jlong method)
}
void
gnu::gcj::jvmti::Breakpoint::initialize_native ()
gnu::gcj::jvmti::Breakpoint::_save_insn ()
{
_Jv_InterpMethod *imeth = get_interp_method (method);
@@ -45,6 +45,7 @@ gnu::gcj::jvmti::Breakpoint::initialize_native ()
void
gnu::gcj::jvmti::Breakpoint::install ()
{
_save_insn ();
_Jv_InterpMethod *imeth = get_interp_method (method);
imeth->install_break (location);
}
@@ -0,0 +1,31 @@
// natNormalBreakpoint.cc - C++ side of NormalBreakpoint
/* 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. */
#include <config.h>
#include <gcj/cni.h>
#include <java-interp.h>
#include <jvmti.h>
#include "jvmti-int.h"
#include <gnu/gcj/jvmti/NormalBreakpoint.h>
#include <java/lang/Thread.h>
void
gnu::gcj::jvmti::NormalBreakpoint::execute ()
{
using namespace ::java::lang;
Thread *thread = Thread::currentThread ();
JNIEnv *jni_env = _Jv_GetCurrentJNIEnv ();
JvAssert (JVMTI_REQUESTED_EVENT (Breakpoint));
_Jv_JVMTI_PostEvent (JVMTI_EVENT_BREAKPOINT, thread, jni_env,
method, location);
}