changeset 22474:c04f6f51b9bf

Truffle/Debugging: backout the changes in 1c3deda60a9e to the Breakpoint classes
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Mon, 07 Dec 2015 18:19:25 -0800
parents 1ea1e410ed3d
children c434681cd164
files truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Breakpoint.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/Debugger.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/LineBreakpoint.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/LineBreakpointFactory.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/TagBreakpoint.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/TagBreakpointFactory.java
diffstat 6 files changed, 46 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- 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;
     }
 
--- 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);
     }
 
--- 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();
-    }
 }
--- 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<ProbeInstrument> 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
--- 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();
-    }
 }
--- 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<ProbeInstrument> 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