OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 private IProcess process; | 64 private IProcess process; |
65 | 65 |
66 private VmConnection connection; | 66 private VmConnection connection; |
67 | 67 |
68 private List<ServerDebugThread> threads = new ArrayList<ServerDebugThread>(); | 68 private List<ServerDebugThread> threads = new ArrayList<ServerDebugThread>(); |
69 | 69 |
70 private boolean firstBreak = true; | 70 private boolean firstBreak = true; |
71 | 71 |
72 private ServerBreakpointManager breakpointManager; | 72 private ServerBreakpointManager breakpointManager; |
73 | 73 |
74 // TODO(devoncarew): this "main" isolate is temporary, until the VM allows us
to | 74 private VmIsolate currentIsolate; |
75 // set wildcard breakpoints across all isolates. | |
76 private VmIsolate mainIsolate; | |
77 | 75 |
78 private IProject currentProject; | 76 private IProject currentProject; |
79 | 77 |
80 public ServerDebugTarget(ILaunch launch, IProcess process, int connectionPort)
{ | 78 public ServerDebugTarget(ILaunch launch, IProcess process, int connectionPort)
{ |
81 this(launch, process, null, connectionPort); | 79 this(launch, process, null, connectionPort); |
82 } | 80 } |
83 | 81 |
84 public ServerDebugTarget(ILaunch launch, IProcess process, String connectionHo
st, | 82 public ServerDebugTarget(ILaunch launch, IProcess process, String connectionHo
st, |
85 int connectionPort) { | 83 int connectionPort) { |
86 super(null); | 84 super(null); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 eclipseBpManager.addBreakpointManagerListener(this); | 192 eclipseBpManager.addBreakpointManagerListener(this); |
195 | 193 |
196 if (!eclipseBpManager.isEnabled()) { | 194 if (!eclipseBpManager.isEnabled()) { |
197 setBreakpointsActive(false); | 195 setBreakpointsActive(false); |
198 } | 196 } |
199 } | 197 } |
200 | 198 |
201 @Override | 199 @Override |
202 public void debuggerPaused(PausedReason reason, VmIsolate isolate, List<VmCall
Frame> frames, | 200 public void debuggerPaused(PausedReason reason, VmIsolate isolate, List<VmCall
Frame> frames, |
203 VmValue exception) { | 201 VmValue exception) { |
| 202 currentIsolate = isolate; |
| 203 |
204 boolean resumed = false; | 204 boolean resumed = false; |
205 | 205 |
206 if (firstBreak) { | 206 if (firstBreak) { |
207 firstBreak = false; | 207 firstBreak = false; |
208 | 208 |
209 // init everything | 209 // init everything |
210 firstIsolateInit(isolate); | 210 firstIsolateInit(isolate); |
211 | 211 |
212 if (PausedReason.breakpoint == reason) { | 212 if (PausedReason.breakpoint == reason) { |
213 DartBreakpoint breakpoint = getBreakpointFor(frames); | 213 DartBreakpoint breakpoint = getBreakpointFor(frames); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 return !isTerminated(); | 312 return !isTerminated(); |
313 } | 313 } |
314 | 314 |
315 @Override | 315 @Override |
316 public boolean isDisconnected() { | 316 public boolean isDisconnected() { |
317 return process.isTerminated(); | 317 return process.isTerminated(); |
318 } | 318 } |
319 | 319 |
320 @Override | 320 @Override |
321 public void isolateCreated(VmIsolate isolate) { | 321 public void isolateCreated(VmIsolate isolate) { |
322 if (mainIsolate == null) { | |
323 mainIsolate = isolate; | |
324 } | |
325 | |
326 addThread(new ServerDebugThread(this, isolate)); | 322 addThread(new ServerDebugThread(this, isolate)); |
327 } | 323 } |
328 | 324 |
329 @Override | 325 @Override |
330 public void isolateShutdown(VmIsolate isolate) { | 326 public void isolateShutdown(VmIsolate isolate) { |
331 removeThread(findThread(isolate)); | 327 removeThread(findThread(isolate)); |
332 } | 328 } |
333 | 329 |
334 @Override | 330 @Override |
335 public boolean isSuspended() { | 331 public boolean isSuspended() { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 return null; | 397 return null; |
402 } | 398 } |
403 | 399 |
404 return getBreakpointFor(frames.get(0)); | 400 return getBreakpointFor(frames.get(0)); |
405 } | 401 } |
406 | 402 |
407 protected DartBreakpoint getBreakpointFor(VmCallFrame frame) { | 403 protected DartBreakpoint getBreakpointFor(VmCallFrame frame) { |
408 return getBreakpointFor(frame.getLocation()); | 404 return getBreakpointFor(frame.getLocation()); |
409 } | 405 } |
410 | 406 |
411 // TODO(devoncarew): the concept of a main isolate needs to go away | 407 protected VmIsolate getCurrentIsolate() { |
412 protected VmIsolate getMainIsolate() { | 408 return currentIsolate; |
413 return mainIsolate; | |
414 } | 409 } |
415 | 410 |
416 @Override | 411 @Override |
417 protected ServerDebugTarget getTarget() { | 412 protected ServerDebugTarget getTarget() { |
418 return this; | 413 return this; |
419 } | 414 } |
420 | 415 |
421 private void addThread(ServerDebugThread thread) { | 416 private void addThread(ServerDebugThread thread) { |
422 threads.add(thread); | 417 threads.add(thread); |
423 | 418 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 } | 539 } |
545 | 540 |
546 private void sleep(int millis) { | 541 private void sleep(int millis) { |
547 try { | 542 try { |
548 Thread.sleep(millis); | 543 Thread.sleep(millis); |
549 } catch (Exception exception) { | 544 } catch (Exception exception) { |
550 } | 545 } |
551 } | 546 } |
552 | 547 |
553 } | 548 } |
OLD | NEW |