use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class InstanceValueDescriptor method getDescriptorEvaluation.
@Override
public PsiExpression getDescriptorEvaluation(DebuggerContext debuggerContext) throws EvaluateException {
PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myProject).getElementFactory();
ObjectReference ref = ((ObjectReference) getValue());
String name = NamesUtils.getUniqueName(ref).replace("@", "");
String presentation = String.format("%s_DebugLabel", name);
return elementFactory.createExpressionFromText(presentation, ContextUtil.getContextElement(debuggerContext));
}
use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class ClassInstanceMethodFilter method onReached.
@Override
public int onReached(SuspendContextImpl context, RequestHint hint) {
StackFrameProxyImpl proxy = context.getFrameProxy();
if (proxy != null) {
try {
ObjectReference reference = proxy.thisObject();
if (reference != null) {
StepIntoBreakpoint breakpoint = DebuggerManagerEx.getInstanceEx(context.getDebugProcess().getProject()).getBreakpointManager().addStepIntoBreakpoint(myMethodFilter);
if (breakpoint != null) {
breakpoint.addInstanceFilter(reference.uniqueID());
breakpoint.setInstanceFiltersEnabled(true);
setUpStepIntoBreakpoint(context, breakpoint, hint);
return RequestHint.RESUME;
}
}
} catch (EvaluateException ignored) {
}
}
return RequestHint.STOP;
}
use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class ConstructorInstancesTracker method obsolete.
public void obsolete() {
if (myNewObjects != null) {
myNewObjects.forEach(ObjectReference::enableCollection);
}
myNewObjects = null;
if (!myIsBackgroundMode || myIsBackgroundTrackingEnabled) {
myBreakpoint.enable();
}
final XDebugSession session = XDebuggerManager.getInstance(myProject).getCurrentSession();
if (session != null) {
final DebugProcess process = DebuggerManager.getInstance(myProject).getDebugProcess(session.getDebugProcess().getProcessHandler());
final MemoryViewDebugProcessData data = process.getUserData(MemoryViewDebugProcessData.KEY);
if (data != null) {
data.getTrackedStacks().release();
}
}
}
use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class ShowInstancesByClassAction method perform.
@Override
protected void perform(XValueNodeImpl node, @NotNull String nodeName, AnActionEvent e) {
final Project project = e.getProject();
if (project != null) {
final XDebugSession debugSession = XDebuggerManager.getInstance(project).getCurrentSession();
final ObjectReference ref = getObjectReference(node);
if (debugSession != null && ref != null) {
final ReferenceType referenceType = ref.referenceType();
new InstancesWindow(debugSession, l -> {
final List<ObjectReference> instances = referenceType.instances(l);
return instances == null ? Collections.emptyList() : instances;
}, referenceType.name()).show();
}
}
}
use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class ThisEvaluator method evaluate.
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Value objRef = context.getThisObject();
if (myIterations > 0) {
ObjectReference thisRef = (ObjectReference) objRef;
for (int idx = 0; idx < myIterations && thisRef != null; idx++) {
thisRef = getOuterObject(thisRef);
}
objRef = thisRef;
}
if (objRef == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.this.not.avalilable"));
}
return objRef;
}
Aggregations