From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libjava/gnu/gcj/jvmti/Breakpoint.h | 55 +++++++++++++++++++ libjava/gnu/gcj/jvmti/Breakpoint.java | 73 +++++++++++++++++++++++++ libjava/gnu/gcj/jvmti/BreakpointManager.h | 40 ++++++++++++++ libjava/gnu/gcj/jvmti/BreakpointManager.java | 82 ++++++++++++++++++++++++++++ libjava/gnu/gcj/jvmti/Location.h | 39 +++++++++++++ libjava/gnu/gcj/jvmti/Location.java | 60 ++++++++++++++++++++ libjava/gnu/gcj/jvmti/NormalBreakpoint.h | 33 +++++++++++ libjava/gnu/gcj/jvmti/NormalBreakpoint.java | 29 ++++++++++ libjava/gnu/gcj/jvmti/natBreakpoint.cc | 73 +++++++++++++++++++++++++ libjava/gnu/gcj/jvmti/natNormalBreakpoint.cc | 31 +++++++++++ 10 files changed, 515 insertions(+) create mode 100644 libjava/gnu/gcj/jvmti/Breakpoint.h create mode 100644 libjava/gnu/gcj/jvmti/Breakpoint.java create mode 100644 libjava/gnu/gcj/jvmti/BreakpointManager.h create mode 100644 libjava/gnu/gcj/jvmti/BreakpointManager.java create mode 100644 libjava/gnu/gcj/jvmti/Location.h create mode 100644 libjava/gnu/gcj/jvmti/Location.java create mode 100644 libjava/gnu/gcj/jvmti/NormalBreakpoint.h create mode 100644 libjava/gnu/gcj/jvmti/NormalBreakpoint.java create mode 100644 libjava/gnu/gcj/jvmti/natBreakpoint.cc create mode 100644 libjava/gnu/gcj/jvmti/natNormalBreakpoint.cc (limited to 'libjava/gnu/gcj/jvmti') diff --git a/libjava/gnu/gcj/jvmti/Breakpoint.h b/libjava/gnu/gcj/jvmti/Breakpoint.h new file mode 100644 index 000000000..f614df9e5 --- /dev/null +++ b/libjava/gnu/gcj/jvmti/Breakpoint.h @@ -0,0 +1,55 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_gcj_jvmti_Breakpoint__ +#define __gnu_gcj_jvmti_Breakpoint__ + +#pragma interface + +#include +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawDataManaged; + namespace jvmti + { + class Breakpoint; + } + } + } +} + +#ifdef DIRECT_THREADED +void _Jv_RewriteBreakpointInsn (jmethodID, jlocation, pc_t); +#endif + +class gnu::gcj::jvmti::Breakpoint : public ::java::lang::Object +{ + +#ifdef DIRECT_THREADED +friend void (::_Jv_RewriteBreakpointInsn (jmethodID, jlocation, pc_t)); +#endif + +public: + Breakpoint(jlong, jlong); + Breakpoint(); +private: + void _save_insn(); +public: + virtual void install(); + virtual void remove(); + virtual ::gnu::gcj::RawDataManaged * getInsn(); + 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$; +}; + +#endif // __gnu_gcj_jvmti_Breakpoint__ diff --git a/libjava/gnu/gcj/jvmti/Breakpoint.java b/libjava/gnu/gcj/jvmti/Breakpoint.java new file mode 100644 index 000000000..00b325aec --- /dev/null +++ b/libjava/gnu/gcj/jvmti/Breakpoint.java @@ -0,0 +1,73 @@ +// Breakpoint.java - a base class for interpreter breakpoints + +/* Copyright (C) 2006, 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; + +import gnu.gcj.RawDataManaged; + +/** + * 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 abstract class Breakpoint +{ + // Location of this breakpoint + protected long method; + protected long location; + + // The original instruction that this breakpoint replaced + private RawDataManaged data; + + /** + * Constructs a new Breakpoint + * + * @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; + } + + 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 (); + + /** + * Returns the original instruction at the location where + * this breakpoint was set + */ + public RawDataManaged getInsn () + { + return data; + } + + /** + * Execute the actions of this breakpoint + */ + public abstract void execute (); +} diff --git a/libjava/gnu/gcj/jvmti/BreakpointManager.h b/libjava/gnu/gcj/jvmti/BreakpointManager.h new file mode 100644 index 000000000..d53be50d2 --- /dev/null +++ b/libjava/gnu/gcj/jvmti/BreakpointManager.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_gcj_jvmti_BreakpointManager__ +#define __gnu_gcj_jvmti_BreakpointManager__ + +#pragma interface + +#include +extern "Java" +{ + namespace gnu + { + namespace gcj + { + namespace jvmti + { + class Breakpoint; + class BreakpointManager; + } + } + } +} + +class gnu::gcj::jvmti::BreakpointManager : public ::java::lang::Object +{ + + BreakpointManager(); +public: + static ::gnu::gcj::jvmti::Breakpoint * newBreakpoint(jlong, jlong); + static void deleteBreakpoint(jlong, jlong); + static ::gnu::gcj::jvmti::Breakpoint * getBreakpoint(jlong, jlong); +private: + static ::gnu::gcj::jvmti::BreakpointManager * _instance; + ::java::util::Hashtable * __attribute__((aligned(__alignof__( ::java::lang::Object)))) _breakpoints; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_gcj_jvmti_BreakpointManager__ diff --git a/libjava/gnu/gcj/jvmti/BreakpointManager.java b/libjava/gnu/gcj/jvmti/BreakpointManager.java new file mode 100644 index 000000000..0eb9f3341 --- /dev/null +++ b/libjava/gnu/gcj/jvmti/BreakpointManager.java @@ -0,0 +1,82 @@ +// BreakpointManager.java - A convenience class for dealing with breakpoints + +/* Copyright (C) 2006, 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; + +import java.util.Hashtable; + +/** + * A class which manages breakpoints in the VM interpreter engine. + * + * BreakpointManager is a location manager that the interpreter + * uses to lookup the original instruction for any given installed + * breakpoint. JVMTI does not allow multiple breakpoints to be set + * at any given location. + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class BreakpointManager +{ + private static BreakpointManager _instance = new BreakpointManager (); + + // List of breakpoints indexed by Location + private Hashtable _breakpoints; + + private BreakpointManager () + { + _breakpoints = new Hashtable (); + } + + /** + * Creates a new breakpoint. SetBreakpoint will verify the validity + * of the arguments. + * + * @param method method in which to set breakpoint (a jmethodID) + * @param location index where the breakpoint is to be set (a jlocation) + */ + public static Breakpoint newBreakpoint (long method, long location) + { + NormalBreakpoint bp = new NormalBreakpoint (method, location); + Location loc = new Location (method, location); + bp.install (); + _instance._breakpoints.put (loc, bp); + return bp; + } + + /** + * Deletes the breakpoint at the given Location + * + * @param method method in which to clear breakpoint + * @param location index of breakpoint in method + */ + public static void deleteBreakpoint (long method, long location) + { + Location loc = new Location (method, location); + Breakpoint bp = (Breakpoint) _instance._breakpoints.get (loc); + if (bp != null) + { + bp.remove (); + _instance._breakpoints.remove (loc); + } + } + + /** + * Returns the breakpoint at the given location or null if none installed + * at location + * + * @param method the jmethodID of the breakpoint location + * @param location the index in the method + */ + public static Breakpoint getBreakpoint (long method, long location) + { + Location loc = new Location (method, location); + return (Breakpoint) _instance._breakpoints.get (loc); + } +} diff --git a/libjava/gnu/gcj/jvmti/Location.h b/libjava/gnu/gcj/jvmti/Location.h new file mode 100644 index 000000000..7a00a2d26 --- /dev/null +++ b/libjava/gnu/gcj/jvmti/Location.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_gcj_jvmti_Location__ +#define __gnu_gcj_jvmti_Location__ + +#pragma interface + +#include +extern "Java" +{ + namespace gnu + { + namespace gcj + { + namespace jvmti + { + class Location; + } + } + } +} + +class gnu::gcj::jvmti::Location : public ::java::lang::Object +{ + +public: + Location(jlong, jlong); + virtual jint hashCode(); + virtual jboolean equals(::java::lang::Object *); + virtual ::java::lang::String * toString(); +private: + jlong __attribute__((aligned(__alignof__( ::java::lang::Object)))) method; + jlong location; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_gcj_jvmti_Location__ diff --git a/libjava/gnu/gcj/jvmti/Location.java b/libjava/gnu/gcj/jvmti/Location.java new file mode 100644 index 000000000..8fae4dde7 --- /dev/null +++ b/libjava/gnu/gcj/jvmti/Location.java @@ -0,0 +1,60 @@ +// Location.java - a wrapper class for breakpoint locations in JVMTI + +/* Copyright (C) 2006 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; + +import java.lang.Long; + +/** + * This class represents a breakpoint location (pair). + * BreakpointManager uses this class as a key in the Map of installed + * breakpoints. + * + * @author Keith Seitz (keiths@redhat.com) + */ +public class Location +{ + // method (a jmethodID in JVMTI) + private long method; + + // index (a jlocation in JVMTI) + private long location; + + /** + * Constructor + * + * @param method the method defined by this location (a jmethodID) + * @param location the integer index of the insn in the method (a jlocation) + */ + public Location (long method, long location) + { + this.method = method; + this.location = location; + } + + public int hashCode () + { + return toString ().hashCode (); + } + + public boolean equals (Object obj) + { + Location loc = (Location) obj; + return (loc.method == method && loc.location == location); + } + + /** + * Converts the Location to a String + */ + public String toString () + { + return Long.toHexString (method) + "." + Long.toString (location); + } +} diff --git a/libjava/gnu/gcj/jvmti/NormalBreakpoint.h b/libjava/gnu/gcj/jvmti/NormalBreakpoint.h new file mode 100644 index 000000000..8ee4cbcb7 --- /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 +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 000000000..4ff48833a --- /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 new file mode 100644 index 000000000..87016b089 --- /dev/null +++ b/libjava/gnu/gcj/jvmti/natBreakpoint.cc @@ -0,0 +1,73 @@ +// natBreakpoint.cc - C++ side of Breakpoint + +/* Copyright (C) 2006, 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 +#include +#include +#include +#include +#include +#include + +#include +#include + +static _Jv_InterpMethod * +get_interp_method (jlong method) +{ + jmethodID id = reinterpret_cast (method); + jclass klass = _Jv_GetMethodDeclaringClass (id); + JvAssert (_Jv_IsInterpretedClass (klass)); + _Jv_MethodBase *base + = _Jv_FindInterpreterMethod (klass, id); + JvAssert (base != NULL); + return reinterpret_cast<_Jv_InterpMethod *> (base); +} + +void +gnu::gcj::jvmti::Breakpoint::_save_insn () +{ + _Jv_InterpMethod *imeth = get_interp_method (method); + + // copy contents of insn at location into data + pc_t code = imeth->get_insn (location); + data = (RawDataManaged *) JvAllocBytes (sizeof (*code)); + memcpy (data, code, sizeof (*code)); +} + +void +gnu::gcj::jvmti::Breakpoint::install () +{ + _save_insn (); + _Jv_InterpMethod *imeth = get_interp_method (method); + imeth->install_break (location); +} + +void +gnu::gcj::jvmti::Breakpoint::remove () +{ + _Jv_InterpMethod *imeth = get_interp_method (method); + imeth->set_insn (location, reinterpret_cast (data)); +} + +#ifdef DIRECT_THREADED +void +_Jv_RewriteBreakpointInsn (jmethodID mid, jlocation loc, pc_t new_insn) +{ + using namespace ::gnu::gcj::jvmti; + Breakpoint *bp + = BreakpointManager::getBreakpoint (reinterpret_cast (mid), loc); + if (bp != NULL) + { + pc_t old_insn = (pc_t) bp->data; + old_insn->insn = new_insn; + } +} +#endif // DIRECT_THREADED diff --git a/libjava/gnu/gcj/jvmti/natNormalBreakpoint.cc b/libjava/gnu/gcj/jvmti/natNormalBreakpoint.cc new file mode 100644 index 000000000..be382408c --- /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 +#include +#include +#include +#include "jvmti-int.h" + +#include +#include + +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); +} -- cgit v1.2.3