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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/dartium/DartiumDebugStackFrame.java

Issue 64033002: Version 0.8.10.8 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 */ 56 */
57 public class DartiumDebugStackFrame extends DartiumDebugElement implements IStac kFrame, 57 public class DartiumDebugStackFrame extends DartiumDebugElement implements IStac kFrame,
58 IDartStackFrame, IExceptionStackFrame, IVariableResolver, IExpressionEvaluat or { 58 IDartStackFrame, IExceptionStackFrame, IVariableResolver, IExpressionEvaluat or {
59 private IThread thread; 59 private IThread thread;
60 private WebkitCallFrame webkitFrame; 60 private WebkitCallFrame webkitFrame;
61 61
62 private boolean isExceptionStackFrame; 62 private boolean isExceptionStackFrame;
63 63
64 private VariableCollector variableCollector = VariableCollector.empty(); 64 private VariableCollector variableCollector = VariableCollector.empty();
65 65
66 private IValue classValue;
67 private IValue globalScopeValue;
68
66 public DartiumDebugStackFrame(IDebugTarget target, IThread thread, WebkitCallF rame webkitFrame) { 69 public DartiumDebugStackFrame(IDebugTarget target, IThread thread, WebkitCallF rame webkitFrame) {
67 this(target, thread, webkitFrame, null); 70 this(target, thread, webkitFrame, null);
68 } 71 }
69 72
70 public DartiumDebugStackFrame(IDebugTarget target, IThread thread, WebkitCallF rame webkitFrame, 73 public DartiumDebugStackFrame(IDebugTarget target, IThread thread, WebkitCallF rame webkitFrame,
71 WebkitRemoteObject exception) { 74 WebkitRemoteObject exception) {
72 super(target); 75 super(target);
73 76
74 this.thread = thread; 77 this.thread = thread;
75 this.webkitFrame = webkitFrame; 78 this.webkitFrame = webkitFrame;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 IVariable thisVar = getThisVariable(); 164 IVariable thisVar = getThisVariable();
162 165
163 if (thisVar != null) { 166 if (thisVar != null) {
164 IValue thisValue = thisVar.getValue(); 167 IValue thisValue = thisVar.getValue();
165 168
166 for (IVariable var : thisValue.getVariables()) { 169 for (IVariable var : thisValue.getVariables()) {
167 if (var.getName().equals(varName)) { 170 if (var.getName().equals(varName)) {
168 return var; 171 return var;
169 } 172 }
170 } 173 }
174 }
171 175
172 // search statics for an instance method 176 // search statics
173 if (thisValue instanceof DartiumDebugValue) { 177 if (getClassValue() != null) {
174 IValue classValue = ((DartiumDebugValue) thisValue).getClassValue(); 178 for (IVariable var : getClassValue().getVariables()) {
175 179 if (var.getName().equals(varName)) {
176 if (classValue != null) { 180 return var;
177 for (IVariable var : classValue.getVariables()) {
178 if (var.getName().equals(varName)) {
179 return var;
180 }
181 }
182 } 181 }
183 } 182 }
184 } else {
185 // TODO(devoncarew): search in statics in a class function
186 // This will require a change to the WIP protocol.
187
188 } 183 }
189 184
190 // search globals 185 // search globals
191 IVariable globalVar = getGlobalVariable(); 186 if (getGlobalsScope() != null) {
192 187 for (IVariable var : getGlobalsScope().getVariables()) {
193 if (globalVar != null) {
194 for (IVariable var : globalVar.getValue().getVariables()) {
195 if (var.getName().equals(varName)) { 188 if (var.getName().equals(varName)) {
196 return var; 189 return var;
197 } 190 }
198 } 191 }
199 } 192 }
200 193
201 return null; 194 return null;
202 } 195 }
203 196
204 @SuppressWarnings("rawtypes") 197 @SuppressWarnings("rawtypes")
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } catch (IllegalArgumentException iae) { 422 } catch (IllegalArgumentException iae) {
430 // Dartium can send us bad paths: 423 // Dartium can send us bad paths:
431 // e:\b\build\slave\dartium-win-full\build ... rt\dart\CanvasRenderingCo ntext2DImpl.dart 424 // e:\b\build\slave\dartium-win-full\build ... rt\dart\CanvasRenderingCo ntext2DImpl.dart
432 DartDebugCorePlugin.logInfo("Illegal path from Dartium: " + url); 425 DartDebugCorePlugin.logInfo("Illegal path from Dartium: " + url);
433 } 426 }
434 } 427 }
435 428
436 return null; 429 return null;
437 } 430 }
438 431
439 protected IVariable getGlobalVariable() throws DebugException { 432 protected IValue getClassValue() throws DebugException {
440 for (IVariable var : getVariables()) { 433 if (classValue != null) {
441 if (var instanceof DartiumDebugVariable) { 434 return classValue;
442 if (((DartiumDebugVariable) var).isLibraryObject()) { 435 }
443 return var; 436
444 } 437 for (WebkitScope scope : webkitFrame.getScopeChain()) {
438 if (scope.isClass()) {
439 classValue = new DartiumDebugValue(getTarget(), null, scope.getObject()) ;
440 break;
445 } 441 }
446 } 442 }
447 443
448 return null; 444 return classValue;
445 }
446
447 protected IValue getGlobalsScope() throws DebugException {
448 if (globalScopeValue != null) {
449 return globalScopeValue;
450 }
451
452 for (WebkitScope scope : webkitFrame.getScopeChain()) {
453 if (scope.isGlobal()) {
454 globalScopeValue = new DartiumDebugValue(getTarget(), null, scope.getObj ect());
455 break;
456 }
457 }
458
459 return globalScopeValue;
449 } 460 }
450 461
451 protected String getMappedLocationPath() { 462 protected String getMappedLocationPath() {
452 SourceMapManager.SourceLocation targetLocation = getMappedLocation(); 463 SourceMapManager.SourceLocation targetLocation = getMappedLocation();
453 464
454 if (DartDebugCorePlugin.LOGGING) { 465 if (DartDebugCorePlugin.LOGGING) {
455 WebkitLocation sourceLocation = webkitFrame.getLocation(); 466 WebkitLocation sourceLocation = webkitFrame.getLocation();
456 WebkitScript script = getConnection().getDebugger().getScript(sourceLocati on.getScriptId()); 467 WebkitScript script = getConnection().getDebugger().getScript(sourceLocati on.getScriptId());
457 String scriptPath = script == null ? "null" : script.getUrl(); 468 String scriptPath = script == null ? "null" : script.getUrl();
458 469
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 return sourceMapManager.getMappingFor( 547 return sourceMapManager.getMappingFor(
537 file, 548 file,
538 location.getLineNumber(), 549 location.getLineNumber(),
539 location.getColumnNumber()); 550 location.getColumnNumber());
540 } else { 551 } else {
541 return null; 552 return null;
542 } 553 }
543 } 554 }
544 555
545 } 556 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698