# HG changeset patch # User Michael Van De Vanter # Date 1449541165 28800 # Node ID c04f6f51b9bf265553bf46f2d4f30bfef4ad6812 # Parent 1ea1e410ed3db838910d774e6d85d50b600350aa Truffle/Debugging: backout the changes in 1c3deda60a9e to the Breakpoint classes diff -r 1ea1e410ed3d -r c04f6f51b9bf truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Breakpoint.java --- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Breakpoint.java Mon Dec 07 11:20:42 2015 -0800 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Breakpoint.java Mon Dec 07 18:19:25 2015 -0800 @@ -33,10 +33,13 @@ import com.oracle.truffle.api.source.Source; /** - * Breakpoint in an executing {@link com.oracle.truffle.api.vm.PolyglotEngine}. - * - * @see Debugger + * Breakpoint in a {@link com.oracle.truffle.api.vm.PolyglotEngine} with + * {@link com.oracle.truffle.api.debug debugging turned on}. You can ask + * {@link Debugger#setLineBreakpoint(int, com.oracle.truffle.api.source.LineLocation, boolean)} or + * {@link Debugger#setTagBreakpoint(int, com.oracle.truffle.api.instrument.SyntaxTag, boolean)} to + * create an instance of {@link Breakpoint}. */ +@SuppressWarnings("javadoc") public abstract class Breakpoint { /** @@ -108,7 +111,7 @@ private State state; - protected Breakpoint(State state, int ignoreCount, boolean isOneShot) { + Breakpoint(State state, int ignoreCount, boolean isOneShot) { this.state = state; this.isOneShot = isOneShot; this.ignoreCount = ignoreCount; @@ -197,7 +200,7 @@ assert state == s; } - protected final void setState(State state) { + final void setState(State state) { this.state = state; } diff -r 1ea1e410ed3d -r c04f6f51b9bf truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Debugger.java --- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Debugger.java Mon Dec 07 11:20:42 2015 -0800 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Debugger.java Mon Dec 07 18:19:25 2015 -0800 @@ -154,7 +154,7 @@ * @throws IOException if the breakpoint can not be set. */ @TruffleBoundary - public LineBreakpoint setLineBreakpoint(int ignoreCount, LineLocation lineLocation, boolean oneShot) throws IOException { + public Breakpoint setLineBreakpoint(int ignoreCount, LineLocation lineLocation, boolean oneShot) throws IOException { return lineBreaks.create(ignoreCount, lineLocation, oneShot); } @@ -167,7 +167,7 @@ * @throws IOException if the breakpoint already set */ @TruffleBoundary - public TagBreakpoint setTagBreakpoint(int ignoreCount, SyntaxTag tag, boolean oneShot) throws IOException { + public Breakpoint setTagBreakpoint(int ignoreCount, SyntaxTag tag, boolean oneShot) throws IOException { return tagBreaks.create(ignoreCount, tag, oneShot); } diff -r 1ea1e410ed3d -r c04f6f51b9bf truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/LineBreakpoint.java --- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/LineBreakpoint.java Mon Dec 07 11:20:42 2015 -0800 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/LineBreakpoint.java Mon Dec 07 18:19:25 2015 -0800 @@ -31,25 +31,16 @@ * * @see Debugger */ -public abstract class LineBreakpoint extends Breakpoint { - - private final LineLocation lineLocation; +abstract class LineBreakpoint extends Breakpoint { - protected LineBreakpoint(State state, LineLocation lineLocation, int ignoreCount, boolean isOneShot) { + LineBreakpoint(State state, int ignoreCount, boolean isOneShot) { super(state, ignoreCount, isOneShot); - this.lineLocation = lineLocation; } /** * Gets the {@linkplain LineLocation source line location} that specifies where this breakpoint * will trigger. */ - public final LineLocation getLineLocation() { - return lineLocation; - } + public abstract LineLocation getLineLocation(); - @Override - public String getLocationDescription() { - return "Line: " + lineLocation.getShortDescription(); - } } diff -r 1ea1e410ed3d -r c04f6f51b9bf truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/LineBreakpointFactory.java --- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/LineBreakpointFactory.java Mon Dec 07 11:20:42 2015 -0800 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/LineBreakpointFactory.java Mon Dec 07 18:19:25 2015 -0800 @@ -271,6 +271,8 @@ private static final String SHOULD_NOT_HAPPEN = "LineBreakpointImpl: should not happen"; + private final LineLocation lineLocation; + // Cached assumption that the global status of line breakpoint activity has not changed. private Assumption breakpointsActiveAssumption; @@ -287,7 +289,9 @@ private List instruments = new ArrayList<>(); public LineBreakpointImpl(int ignoreCount, LineLocation lineLocation, boolean oneShot) { - super(ENABLED_UNRESOLVED, lineLocation, ignoreCount, oneShot); + super(ENABLED_UNRESOLVED, ignoreCount, oneShot); + this.lineLocation = lineLocation; + this.breakpointsActiveAssumption = LineBreakpointFactory.this.breakpointsActiveUnchanged.getAssumption(); this.isEnabled = true; this.enabledUnchangedAssumption = Truffle.getRuntime().createAssumption(BREAKPOINT_NAME + " enabled state unchanged"); @@ -464,6 +468,16 @@ warningLog.addWarning(String.format("Exception in %s: %s", getShortDescription(), ex.getMessage())); } + @Override + public String getLocationDescription() { + return "Line: " + lineLocation.getShortDescription(); + } + + @Override + public LineLocation getLineLocation() { + return lineLocation; + } + private final class UnconditionalLineBreakInstrumentListener extends DefaultStandardInstrumentListener { @Override diff -r 1ea1e410ed3d -r c04f6f51b9bf truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/TagBreakpoint.java --- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/TagBreakpoint.java Mon Dec 07 11:20:42 2015 -0800 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/TagBreakpoint.java Mon Dec 07 18:19:25 2015 -0800 @@ -31,24 +31,15 @@ * * @see Debugger */ -public abstract class TagBreakpoint extends Breakpoint { - - private final SyntaxTag tag; +abstract class TagBreakpoint extends Breakpoint { - protected TagBreakpoint(State state, SyntaxTag tag, int ignoreCount, boolean isOneShot) { + TagBreakpoint(State state, int ignoreCount, boolean isOneShot) { super(state, ignoreCount, isOneShot); - this.tag = tag; } /** * Gets the tag that specifies where this breakpoint will trigger. */ - public final SyntaxTag getTag() { - return tag; - } + public abstract SyntaxTag getTag(); - @Override - public String getLocationDescription() { - return "Tag " + tag.name(); - } } diff -r 1ea1e410ed3d -r c04f6f51b9bf truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/TagBreakpointFactory.java --- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/TagBreakpointFactory.java Mon Dec 07 11:20:42 2015 -0800 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/TagBreakpointFactory.java Mon Dec 07 18:19:25 2015 -0800 @@ -240,6 +240,8 @@ private static final String SHOULD_NOT_HAPPEN = "TagBreakpointImpl: should not happen"; + private final SyntaxTag tag; + // Cached assumption that the global status of tag breakpoint activity has not changed. private Assumption breakpointsActiveAssumption; @@ -256,7 +258,8 @@ private List instruments = new ArrayList<>(); private TagBreakpointImpl(int ignoreCount, SyntaxTag tag, boolean oneShot) { - super(ENABLED, tag, ignoreCount, oneShot); + super(ENABLED, ignoreCount, oneShot); + this.tag = tag; this.breakpointsActiveAssumption = TagBreakpointFactory.this.breakpointsActiveUnchanged.getAssumption(); this.isEnabled = true; this.enabledUnchangedAssumption = Truffle.getRuntime().createAssumption(BREAKPOINT_NAME + " enabled state unchanged"); @@ -353,7 +356,7 @@ @TruffleBoundary private String getShortDescription() { - return BREAKPOINT_NAME + "@" + getTag().name(); + return BREAKPOINT_NAME + "@" + tag.name(); } private void changeState(State after) { @@ -427,6 +430,16 @@ warningLog.addWarning(String.format("Exception in %s: %s", getShortDescription(), ex.getMessage())); } + @Override + public String getLocationDescription() { + return "Tag " + tag.name(); + } + + @Override + public SyntaxTag getTag() { + return tag; + } + private final class UnconditionalTagBreakInstrumentListener extends DefaultStandardInstrumentListener { @Override