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

View File

@ -1,3 +1,31 @@
2007-06-18 Keith Seitz <keiths@redhat.com>
* 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.
2007-06-14 Keith Seitz <keiths@redhat.com>
* include/java-interp.h (_Jv_LocalVarTableEntry): Add union

View File

@ -851,6 +851,7 @@ gnu/gcj/convert/natOutput_SJIS.cc \
gnu/gcj/io/natSimpleSHSStream.cc \
gnu/gcj/io/shs.cc \
gnu/gcj/jvmti/natBreakpoint.cc \
gnu/gcj/jvmti/natNormalBreakpoint.cc \
gnu/gcj/runtime/natFinalizerThread.cc \
gnu/gcj/runtime/natSharedLibLoader.cc \
gnu/gcj/runtime/natSystemClassLoader.cc \

View File

@ -80,6 +80,7 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/../compile \
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/confsubdir.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/enable.m4 \
$(top_srcdir)/../config/gxx-include-dir.m4 \
@ -94,10 +95,11 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/tls.m4 \
$(top_srcdir)/../config/unwind_ipinfo.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
$(top_srcdir)/mingwld.m4 $(top_srcdir)/pkg.m4 \
$(top_srcdir)/shlibpath.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltgcc.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/mingwld.m4 \
$(top_srcdir)/pkg.m4 $(top_srcdir)/shlibpath.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@ -304,6 +306,7 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc jvmti.cc exception.cc \
gnu/gcj/convert/natOutput_SJIS.cc \
gnu/gcj/io/natSimpleSHSStream.cc gnu/gcj/io/shs.cc \
gnu/gcj/jvmti/natBreakpoint.cc \
gnu/gcj/jvmti/natNormalBreakpoint.cc \
gnu/gcj/runtime/natFinalizerThread.cc \
gnu/gcj/runtime/natSharedLibLoader.cc \
gnu/gcj/runtime/natSystemClassLoader.cc \
@ -367,6 +370,7 @@ am__objects_2 = gnu/classpath/jdwp/natVMFrame.lo \
gnu/gcj/convert/natOutput_SJIS.lo \
gnu/gcj/io/natSimpleSHSStream.lo gnu/gcj/io/shs.lo \
gnu/gcj/jvmti/natBreakpoint.lo \
gnu/gcj/jvmti/natNormalBreakpoint.lo \
gnu/gcj/runtime/natFinalizerThread.lo \
gnu/gcj/runtime/natSharedLibLoader.lo \
gnu/gcj/runtime/natSystemClassLoader.lo \
@ -1357,7 +1361,8 @@ gnu_gcj_io_header_files = $(patsubst %.java,%.h,$(gnu_gcj_io_source_files))
gnu_gcj_jvmti_source_files = \
gnu/gcj/jvmti/Breakpoint.java \
gnu/gcj/jvmti/BreakpointManager.java \
gnu/gcj/jvmti/Location.java
gnu/gcj/jvmti/Location.java \
gnu/gcj/jvmti/NormalBreakpoint.java
gnu_gcj_jvmti_header_files = $(patsubst %.java,%.h,$(gnu_gcj_jvmti_source_files))
gnu_gcj_runtime_source_files = \
@ -8060,6 +8065,7 @@ gnu/gcj/convert/natOutput_SJIS.cc \
gnu/gcj/io/natSimpleSHSStream.cc \
gnu/gcj/io/shs.cc \
gnu/gcj/jvmti/natBreakpoint.cc \
gnu/gcj/jvmti/natNormalBreakpoint.cc \
gnu/gcj/runtime/natFinalizerThread.cc \
gnu/gcj/runtime/natSharedLibLoader.cc \
gnu/gcj/runtime/natSystemClassLoader.cc \
@ -8456,6 +8462,8 @@ gnu/gcj/jvmti/$(DEPDIR)/$(am__dirstamp):
@: > gnu/gcj/jvmti/$(DEPDIR)/$(am__dirstamp)
gnu/gcj/jvmti/natBreakpoint.lo: gnu/gcj/jvmti/$(am__dirstamp) \
gnu/gcj/jvmti/$(DEPDIR)/$(am__dirstamp)
gnu/gcj/jvmti/natNormalBreakpoint.lo: gnu/gcj/jvmti/$(am__dirstamp) \
gnu/gcj/jvmti/$(DEPDIR)/$(am__dirstamp)
gnu/gcj/runtime/$(am__dirstamp):
@$(mkdir_p) gnu/gcj/runtime
@: > gnu/gcj/runtime/$(am__dirstamp)
@ -8938,6 +8946,8 @@ mostlyclean-compile:
-rm -f gnu/gcj/io/shs.lo
-rm -f gnu/gcj/jvmti/natBreakpoint.$(OBJEXT)
-rm -f gnu/gcj/jvmti/natBreakpoint.lo
-rm -f gnu/gcj/jvmti/natNormalBreakpoint.$(OBJEXT)
-rm -f gnu/gcj/jvmti/natNormalBreakpoint.lo
-rm -f gnu/gcj/natCore.$(OBJEXT)
-rm -f gnu/gcj/natCore.lo
-rm -f gnu/gcj/runtime/natFinalizerThread.$(OBJEXT)
@ -9158,6 +9168,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/io/$(DEPDIR)/natSimpleSHSStream.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/io/$(DEPDIR)/shs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/jvmti/$(DEPDIR)/natBreakpoint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/jvmti/$(DEPDIR)/natNormalBreakpoint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/runtime/$(DEPDIR)/natFinalizerThread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/runtime/$(DEPDIR)/natSharedLibLoader.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/runtime/$(DEPDIR)/natStringBuffer.Plo@am__quote@

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$;

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 ();
}

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);

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__

View File

@ -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 ();
}

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);
}

View File

@ -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);
}

View File

@ -2619,26 +2619,21 @@ details. */
insn_breakpoint:
{
JvAssert (JVMTI_REQUESTED_EVENT (Breakpoint));
// Send JVMTI notification
using namespace ::java::lang;
jmethodID method = meth->self;
jlocation location = meth->insn_index (pc - 1);
Thread *thread = Thread::currentThread ();
JNIEnv *jni_env = _Jv_GetCurrentJNIEnv ();
// Save the insn here since the breakpoint could be removed
// before the JVMTI notification returns.
using namespace gnu::gcj::jvmti;
Breakpoint *bp
= BreakpointManager::getBreakpoint (reinterpret_cast<jlong> (method),
location);
JvAssert (bp != NULL);
// Save the insn here since the breakpoint could be removed
// before the JVMTI notification returns.
pc_t opc = reinterpret_cast<pc_t> (bp->getInsn ());
_Jv_JVMTI_PostEvent (JVMTI_EVENT_BREAKPOINT, thread, jni_env,
method, location);
bp->execute ();
// Continue execution
#ifdef DIRECT_THREADED

View File

@ -538,7 +538,8 @@ gnu/gcj/io.list: $(gnu_gcj_io_source_files)
gnu_gcj_jvmti_source_files = \
gnu/gcj/jvmti/Breakpoint.java \
gnu/gcj/jvmti/BreakpointManager.java \
gnu/gcj/jvmti/Location.java
gnu/gcj/jvmti/Location.java \
gnu/gcj/jvmti/NormalBreakpoint.java
gnu_gcj_jvmti_header_files = $(patsubst %.java,%.h,$(gnu_gcj_jvmti_source_files))