From 14fdf9b797d7564a3572971bc108f69adf5dc010 Mon Sep 17 00:00:00 2001 From: konsoletyper Date: Wed, 13 Aug 2014 21:34:46 +0400 Subject: [PATCH] Adds attribute, indicating that breakpoint was installed in TeaVM --- .../org/teavm/model/util/LocationGraphBuilder.java | 2 +- teavm-eclipse-plugin/.classpath | 4 ++-- .../teavm/eclipse/debugger/TeaVMDebugTarget.java | 13 +++++-------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/teavm-core/src/main/java/org/teavm/model/util/LocationGraphBuilder.java b/teavm-core/src/main/java/org/teavm/model/util/LocationGraphBuilder.java index 3179fafdf..96341b79d 100644 --- a/teavm-core/src/main/java/org/teavm/model/util/LocationGraphBuilder.java +++ b/teavm-core/src/main/java/org/teavm/model/util/LocationGraphBuilder.java @@ -99,7 +99,7 @@ class LocationGraphBuilder { for (Map.Entry> entry : graphBuilder.entrySet()) { InstructionLocation[] successors = entry.getValue().toArray(new InstructionLocation[0]); for (int i = 0; i < successors.length; ++i) { - if (successors[i].getLine() < 0) { + if (successors[i] != null && successors[i].getLine() < 0) { successors[i] = null; } } diff --git a/teavm-eclipse-plugin/.classpath b/teavm-eclipse-plugin/.classpath index 4fff742fb..b1eb14910 100644 --- a/teavm-eclipse-plugin/.classpath +++ b/teavm-eclipse-plugin/.classpath @@ -27,8 +27,8 @@ - - + + diff --git a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMDebugTarget.java b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMDebugTarget.java index f61d12034..0bec93917 100644 --- a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMDebugTarget.java +++ b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMDebugTarget.java @@ -2,7 +2,6 @@ package org.teavm.eclipse.debugger; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarkerDelta; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugEvent; @@ -31,7 +30,7 @@ public class TeaVMDebugTarget implements IDebugTarget, IStep { private TeaVMDebugProcess process; private TeaVMThread thread; ConcurrentMap breakpointMap = new ConcurrentHashMap<>(); - ConcurrentMap breakpointBackMap = new ConcurrentHashMap<>(); + ConcurrentMap breakpointBackMap = new ConcurrentHashMap<>(); public TeaVMDebugTarget(ILaunch launch, final Debugger teavmDebugger, ChromeRDPServer server) { this.launch = launch; @@ -78,17 +77,15 @@ public class TeaVMDebugTarget implements IDebugTarget, IStep { } private void updateBreakpoint(Breakpoint teavmBreakpoint) { - IBreakpoint breakpoint = breakpointBackMap.get(teavmBreakpoint); + IJavaLineBreakpoint breakpoint = breakpointBackMap.get(teavmBreakpoint); if (breakpoint != null) { try { if (!teavmBreakpoint.isValid() && teavmDebugger.isAttached()) { - breakpoint.getMarker().setAttribute(IMarker.PROBLEM, - "Can't transfer this breakpoint to browser"); - breakpoint.getMarker().setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING); + breakpoint.getMarker().setAttribute("org.eclipse.jdt.debug.core.installCount", 0); } else { - breakpoint.getMarker().setAttribute(IMarker.PROBLEM, null); - breakpoint.getMarker().setAttribute(IMarker.SEVERITY, null); + breakpoint.getMarker().setAttribute("org.eclipse.jdt.debug.core.installCount", 1); } + DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged(breakpoint); } catch (CoreException e) { throw new RuntimeException(e); }