gcc/libjava/gnu/gcj/jvmti/BreakpointManager.java
Keith Seitz 02b1e78caf 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
2007-06-19 00:10:10 +00:00

83 lines
2.3 KiB
Java

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