use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class DebuggerContextImpl method createEvaluationContext.
@Nullable
public EvaluationContextImpl createEvaluationContext() {
DebuggerManagerThreadImpl.assertIsManagerThread();
StackFrameProxyImpl frameProxy = getFrameProxy();
ObjectReference objectReference;
try {
objectReference = frameProxy != null ? frameProxy.thisObject() : null;
} catch (EvaluateException e) {
LOG.info(e);
objectReference = null;
}
SuspendContextImpl context = getSuspendContext();
return context != null ? new EvaluationContextImpl(context, frameProxy, objectReference) : null;
}
use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class ToggleFieldBreakpointAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
if (project == null) {
return;
}
final SourcePosition place = getPlace(e);
if (place != null) {
Document document = PsiDocumentManager.getInstance(project).getDocument(place.getFile());
if (document != null) {
DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
BreakpointManager manager = debuggerManager.getBreakpointManager();
final int offset = place.getOffset();
final Breakpoint breakpoint = offset >= 0 ? manager.findBreakpoint(document, offset, FieldBreakpoint.CATEGORY) : null;
if (breakpoint == null) {
FieldBreakpoint fieldBreakpoint = manager.addFieldBreakpoint(document, offset);
if (fieldBreakpoint != null) {
if (DebuggerAction.isContextView(e)) {
final DebuggerTreeNodeImpl selectedNode = DebuggerAction.getSelectedNode(e.getDataContext());
if (selectedNode != null && selectedNode.getDescriptor() instanceof FieldDescriptorImpl) {
ObjectReference object = ((FieldDescriptorImpl) selectedNode.getDescriptor()).getObject();
if (object != null) {
long id = object.uniqueID();
InstanceFilter[] instanceFilters = new InstanceFilter[] { InstanceFilter.create(Long.toString(id)) };
fieldBreakpoint.setInstanceFilters(instanceFilters);
fieldBreakpoint.setInstanceFiltersEnabled(true);
}
}
}
final Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
if (editor != null) {
manager.editBreakpoint(fieldBreakpoint, editor);
}
}
} else {
manager.removeBreakpoint(breakpoint);
}
}
}
}
use of com.sun.jdi.ObjectReference in project che by eclipse.
the class JdiValueImpl method getVariables.
@Override
public JdiVariable[] getVariables() {
if (variables == null) {
if (isPrimitive()) {
variables = new JdiVariable[0];
} else {
if (isArray()) {
ArrayReference array = (ArrayReference) value;
int length = array.length();
variables = new JdiVariable[length];
for (int i = 0; i < length; i++) {
variables[i] = new JdiArrayElementImpl(i, array.getValue(i));
}
} else {
ObjectReference object = (ObjectReference) value;
ReferenceType type = object.referenceType();
List<Field> fields = type.allFields();
variables = new JdiVariable[fields.size()];
int i = 0;
for (Field f : fields) {
variables[i++] = new JdiFieldImpl(f, object);
}
// See JdiFieldImpl#compareTo(JdiFieldImpl).
Arrays.sort(variables);
}
}
}
return variables;
}
use of com.sun.jdi.ObjectReference in project gravel by gravel-st.
the class VMTargetRemoteTest method testDNU.
@Test
public void testDNU() throws Throwable {
ObjectReference promise = remote.evaluateForked("3 fromage");
ThreadReference thread = ((ThreadReference) remote.invokeMethod(promise, "thread"));
remote.invokeMethod(thread, "start");
ObjectReference state = (ObjectReference) remote.invokeMethod(thread, "getState");
StringReference str = (StringReference) remote.invokeMethod(state, "toString");
System.out.println(str.value());
printStack(thread);
// assertFalse(thread.isSuspended());
printThreadState();
System.out.println("VMTargetStarter.sleep(1000)");
VMTargetStarter.sleep(1000);
printStack(thread);
printThreadState();
boolean isFinished = ((BooleanValue) remote.invokeMethod(promise, "isFinished")).booleanValue();
assertFalse(isFinished);
printThreadState();
printStack(thread);
assertTrue(thread.isAtBreakpoint());
}
use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class InstancesTree method getSelectedReference.
@Nullable
ObjectReference getSelectedReference() {
TreePath selectionPath = getSelectionPath();
Object selectedItem = selectionPath != null ? selectionPath.getLastPathComponent() : null;
if (selectedItem instanceof XValueNodeImpl) {
XValueNodeImpl xValueNode = (XValueNodeImpl) selectedItem;
XValue valueContainer = xValueNode.getValueContainer();
if (valueContainer instanceof NodeDescriptorProvider) {
NodeDescriptor descriptor = ((NodeDescriptorProvider) valueContainer).getDescriptor();
if (descriptor instanceof ValueDescriptor) {
Value value = ((ValueDescriptor) descriptor).getValue();
if (value instanceof ObjectReference)
return (ObjectReference) value;
}
}
}
return null;
}
Aggregations