Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1380)

Unified Diff: editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/server/ServerBreakpointManager.java

Issue 607893008: Issue 19141. Update 'pause on exception' in all live isolates on preference change. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: move to ServerBreakpointManager Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/server/ServerDebugTarget.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/server/ServerBreakpointManager.java
diff --git a/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/server/ServerBreakpointManager.java b/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/server/ServerBreakpointManager.java
index 76c2e0b368a6bda2975e49c32c1046cdcabe7a25..43dec6dfd018a453dced9a22c105818bf9087334 100644
--- a/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/server/ServerBreakpointManager.java
+++ b/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/server/ServerBreakpointManager.java
@@ -17,7 +17,9 @@ package com.google.dart.tools.debug.core.server;
import com.google.dart.tools.core.DartCore;
import com.google.dart.tools.core.internal.util.ResourceUtil;
import com.google.dart.tools.debug.core.DartDebugCorePlugin;
+import com.google.dart.tools.debug.core.DartDebugCorePlugin.BreakOnExceptions;
import com.google.dart.tools.debug.core.breakpoints.DartBreakpoint;
+import com.google.dart.tools.debug.core.server.VmConnection.BreakOnExceptionsType;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarkerDelta;
@@ -66,7 +68,7 @@ class ServerBreakpointManager implements IBreakpointListener {
return;
}
// try to set
- getConnection().setBreakpoint(isolate, url, line, new VmCallback<VmBreakpoint>() {
+ connection.setBreakpoint(isolate, url, line, new VmCallback<VmBreakpoint>() {
@Override
public void handleResult(VmResult<VmBreakpoint> result) {
if (result.isError()) {
@@ -82,7 +84,8 @@ class ServerBreakpointManager implements IBreakpointListener {
}
}
- private ServerDebugTarget target;
+ private final ServerDebugTarget target;
+ private final VmConnection connection;
private VmIsolate mainIsolate;
@@ -94,6 +97,7 @@ class ServerBreakpointManager implements IBreakpointListener {
public ServerBreakpointManager(ServerDebugTarget target) {
this.target = target;
+ this.connection = target.getConnection();
}
@Override
@@ -123,7 +127,7 @@ class ServerBreakpointManager implements IBreakpointListener {
if (breakpoints != null) {
try {
for (VmBreakpoint bp : breakpoints) {
- getConnection().removeBreakpoint(bp.getIsolate(), bp);
+ connection.removeBreakpoint(bp.getIsolate(), bp);
}
} catch (IOException exception) {
DartDebugCorePlugin.logError(exception);
@@ -173,7 +177,6 @@ class ServerBreakpointManager implements IBreakpointListener {
return false;
}
// prepare line (requires lines table)
- VmConnection connection = getConnection();
int locationLine = location.getLineNumber(connection);
// check every breakpoint's line + file
for (IBreakpoint _bp : createdBreakpoints.keySet()) {
@@ -194,6 +197,26 @@ class ServerBreakpointManager implements IBreakpointListener {
return false;
}
+ public void setPauseOnExceptionForLiveIsolates() {
+ BreakOnExceptionsType pauseType = getPauseType();
+ for (VmIsolate isolate : liveIsolates) {
+ try {
+ connection.setPauseOnException(isolate, pauseType);
+ } catch (IOException e) {
+ DartDebugCorePlugin.logError(e);
+ }
+ }
+ }
+
+ public void setPauseOnExceptionSync(VmIsolate isolate) {
+ BreakOnExceptionsType pauseType = getPauseType();
+ try {
+ connection.setPauseOnExceptionSync(isolate, pauseType);
+ } catch (IOException e) {
+ DartDebugCorePlugin.logError(e);
+ }
+ }
+
protected void addCreatedBreakpoint(DartBreakpoint breakpoint, VmBreakpoint result) {
List<VmBreakpoint> breakpoints = createdBreakpoints.get(breakpoint);
if (breakpoints == null) {
@@ -220,7 +243,7 @@ class ServerBreakpointManager implements IBreakpointListener {
DartBreakpoint dartBreakpoint = getDartBreakpointFor(bp);
if (dartBreakpoint != null && isolate == mainIsolate) {
- int lineNo = bp.getLocation().getLineNumber(getConnection());
+ int lineNo = bp.getLocation().getLineNumber(connection);
if (lineNo != dartBreakpoint.getLine()) {
ignoredBreakpoints.add(dartBreakpoint);
@@ -268,8 +291,8 @@ class ServerBreakpointManager implements IBreakpointListener {
}
try {
- VmInterruptResult interruptResult = pause ? getConnection().interruptConditionally(isolate)
- : VmInterruptResult.createNoopResult(getConnection());
+ VmInterruptResult interruptResult = pause ? connection.interruptConditionally(isolate)
+ : VmInterruptResult.createNoopResult(connection);
for (DartBreakpoint breakpoint : breakpoints) {
if (breakpoint.isBreakpointEnabled()) {
@@ -301,9 +324,9 @@ class ServerBreakpointManager implements IBreakpointListener {
private void connectToIsolate(VmIsolate isolate) {
try {
- VmInterruptResult interruptResult = getConnection().interruptConditionally(isolate);
+ VmInterruptResult interruptResult = connection.interruptConditionally(isolate);
- getConnection().enableAllSteppingSync(isolate);
+ connection.enableAllSteppingSync(isolate);
// Set all existing breakpoints on the new isolate.
addBreakpoints(isolate, getSupportedBreakpoints(), false);
@@ -330,10 +353,6 @@ class ServerBreakpointManager implements IBreakpointListener {
return new File(filePath).toURI().toString();
}
- private VmConnection getConnection() {
- return target.getConnection();
- }
-
private String getPackagesUrlForFilePath(String filePath) {
File javaFile = new File(filePath);
IFile resourceFile = ResourceUtil.getFile(javaFile);
@@ -373,6 +392,19 @@ class ServerBreakpointManager implements IBreakpointListener {
return null;
}
+ private BreakOnExceptionsType getPauseType() {
+ BreakOnExceptions boe = DartDebugCorePlugin.getPlugin().getBreakOnExceptions();
+ BreakOnExceptionsType pauseType = BreakOnExceptionsType.none;
+
+ if (boe == BreakOnExceptions.uncaught) {
+ pauseType = BreakOnExceptionsType.unhandled;
+ } else if (boe == BreakOnExceptions.all) {
+ pauseType = BreakOnExceptionsType.all;
+ }
+
+ return pauseType;
+ }
+
private boolean supportsBreakpoint(IBreakpoint breakpoint) {
return target.supportsBreakpoint(breakpoint);
}
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/server/ServerDebugTarget.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698