diff options
author | kseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-19 00:10:10 +0000 |
---|---|---|
committer | kseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-19 00:10:10 +0000 |
commit | 21dff5743bdaa076e239ff0aaf45fca64d1b5a4b (patch) | |
tree | 1001778084e0218424d7169c87f3ac322899ec51 /libjava/gnu | |
parent | ddf62506020e33054a0299067c2ce3940582a54c (diff) | |
download | gcc-21dff5743bdaa076e239ff0aaf45fca64d1b5a4b.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125834 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu')
-rw-r--r-- | libjava/gnu/gcj/jvmti/Breakpoint.h | 7 | ||||
-rw-r--r-- | libjava/gnu/gcj/jvmti/Breakpoint.java | 40 | ||||
-rw-r--r-- | libjava/gnu/gcj/jvmti/BreakpointManager.java | 2 | ||||
-rw-r--r-- | libjava/gnu/gcj/jvmti/NormalBreakpoint.h | 33 | ||||
-rw-r--r-- | libjava/gnu/gcj/jvmti/NormalBreakpoint.java | 29 | ||||
-rw-r--r-- | libjava/gnu/gcj/jvmti/natBreakpoint.cc | 3 | ||||
-rw-r--r-- | libjava/gnu/gcj/jvmti/natNormalBreakpoint.cc | 31 |
7 files changed, 129 insertions, 16 deletions
diff --git a/libjava/gnu/gcj/jvmti/Breakpoint.h b/libjava/gnu/gcj/jvmti/Breakpoint.h index b522c77b15d..f614df9e5e1 100644 --- a/libjava/gnu/gcj/jvmti/Breakpoint.h +++ b/libjava/gnu/gcj/jvmti/Breakpoint.h @@ -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$; diff --git a/libjava/gnu/gcj/jvmti/Breakpoint.java b/libjava/gnu/gcj/jvmti/Breakpoint.java index 2d8fe1b249a..00b325aec13 100644 --- a/libjava/gnu/gcj/jvmti/Breakpoint.java +++ b/libjava/gnu/gcj/jvmti/Breakpoint.java @@ -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 (); } diff --git a/libjava/gnu/gcj/jvmti/BreakpointManager.java b/libjava/gnu/gcj/jvmti/BreakpointManager.java index 5ef1b08d4df..0eb9f33414b 100644 --- a/libjava/gnu/gcj/jvmti/BreakpointManager.java +++ b/libjava/gnu/gcj/jvmti/BreakpointManager.java @@ -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); diff --git a/libjava/gnu/gcj/jvmti/NormalBreakpoint.h b/libjava/gnu/gcj/jvmti/NormalBreakpoint.h new file mode 100644 index 00000000000..8ee4cbcb70c --- /dev/null +++ b/libjava/gnu/gcj/jvmti/NormalBreakpoint.h @@ -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__ diff --git a/libjava/gnu/gcj/jvmti/NormalBreakpoint.java b/libjava/gnu/gcj/jvmti/NormalBreakpoint.java new file mode 100644 index 00000000000..4ff48833af3 --- /dev/null +++ b/libjava/gnu/gcj/jvmti/NormalBreakpoint.java @@ -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 (); +} diff --git a/libjava/gnu/gcj/jvmti/natBreakpoint.cc b/libjava/gnu/gcj/jvmti/natBreakpoint.cc index 5dbd3f834dd..87016b089f5 100644 --- a/libjava/gnu/gcj/jvmti/natBreakpoint.cc +++ b/libjava/gnu/gcj/jvmti/natBreakpoint.cc @@ -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); } diff --git a/libjava/gnu/gcj/jvmti/natNormalBreakpoint.cc b/libjava/gnu/gcj/jvmti/natNormalBreakpoint.cc new file mode 100644 index 00000000000..be382408c8d --- /dev/null +++ b/libjava/gnu/gcj/jvmti/natNormalBreakpoint.cc @@ -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); +} |