@Override public Map<IWatchable, IValue> getWatchableValues() { try { StackFrame stackFrame = getStackFrame(); Map<IWatchable, IValue> result = new HashMap<IWatchable, IValue>(); if (stackFrame != null) { Map<LocalVariable, Value> map = stackFrame.getValues(stackFrame.visibleVariables()); for (LocalVariable variable : map.keySet()) { result.put( new JavaLocalVariable(variable, this, myClassFqName, stackFrame.thread()), JavaValue.fromJDIValue(map.get(variable), myClassFqName, stackFrame.thread())); } ObjectReference thisObject = stackFrame.thisObject(); if (thisObject != null) { JavaThisObject object = new JavaThisObject(thisObject, this, myClassFqName, stackFrame.thread()); result.put(object, object.getValue()); } } return result; } catch (AbsentInformationException ex) { // doing nothing return Collections.emptyMap(); } }
public void threadGroupCreated(ThreadGroupReference threadGroupReference) { DebuggerManagerThreadImpl.assertIsManagerThread(); if (!isJ2ME()) { ThreadGroupReferenceProxyImpl proxy = new ThreadGroupReferenceProxyImpl(this, threadGroupReference); myThreadGroups.put(threadGroupReference, proxy); } }
private static Map<String, LocalVariableProxyImpl> getVisibleVariables( final StackFrameProxyImpl frame) throws EvaluateException { final Map<String, LocalVariableProxyImpl> vars = new HashMap<String, LocalVariableProxyImpl>(); for (LocalVariableProxyImpl localVariableProxy : frame.visibleVariables()) { vars.put(localVariableProxy.name(), localVariableProxy); } return vars; }
public ThreadGroupReferenceProxyImpl getThreadGroupReferenceProxy(ThreadGroupReference group) { DebuggerManagerThreadImpl.assertIsManagerThread(); if (group == null) { return null; } ThreadGroupReferenceProxyImpl proxy = myThreadGroups.get(group); if (proxy == null) { if (!myIsJ2ME.isAvailable()) { proxy = new ThreadGroupReferenceProxyImpl(this, group); myThreadGroups.put(group, proxy); } } return proxy; }
/** @return a list of all ThreadReferenceProxies */ public Collection<ThreadReferenceProxyImpl> allThreads() { DebuggerManagerThreadImpl.assertIsManagerThread(); if (myAllThreadsDirty) { myAllThreadsDirty = false; final List<ThreadReference> currentThreads = myVirtualMachine.allThreads(); final Map<ThreadReference, ThreadReferenceProxyImpl> result = new HashMap<>(); for (final ThreadReference threadReference : currentThreads) { ThreadReferenceProxyImpl proxy = myAllThreads.get(threadReference); if (proxy == null) { proxy = new ThreadReferenceProxyImpl(this, threadReference); } result.put(threadReference, proxy); } myAllThreads = result; } return myAllThreads.values(); }
public ObjectReferenceProxyImpl getObjectReferenceProxy(ObjectReference objectReference) { if (objectReference != null) { if (objectReference instanceof ThreadReference) { return getThreadReferenceProxy((ThreadReference) objectReference); } else if (objectReference instanceof ThreadGroupReference) { return getThreadGroupReferenceProxy((ThreadGroupReference) objectReference); } else { ObjectReferenceProxyImpl proxy = myObjectReferenceProxies.get(objectReference); if (proxy == null) { if (objectReference instanceof StringReference) { proxy = new StringReferenceProxy(this, (StringReference) objectReference); } else { proxy = new ObjectReferenceProxyImpl(this, objectReference); } myObjectReferenceProxies.put(objectReference, proxy); } return proxy; } } return null; }
/** Get source object associated with a class or interface. Returns null if not available. */ public SourceModel sourceForClass(ReferenceType refType) { SourceModel sm = classToSource.get(refType); if (sm != null) { return sm; } try { String filename = refType.sourceName(); String refName = refType.name(); int iDot = refName.lastIndexOf('.'); String pkgName = (iDot >= 0) ? refName.substring(0, iDot + 1) : ""; String full = pkgName.replace('.', File.separatorChar) + filename; File path = sourcePath.resolve(full); if (path != null) { sm = sourceForFile(path); classToSource.put(refType, sm); return sm; } return null; } catch (AbsentInformationException e) { return null; } }