use of com.sun.jdi.ObjectReference in project jdk8u_jdk by JetBrains.
the class OomDebugTest method test1.
/*
* Test case: Object reference as method parameter.
*/
// called via reflection
@SuppressWarnings("unused")
private void test1() throws Exception {
System.out.println("DEBUG: ------------> Running test1");
try {
Field field = targetClass.fieldByName("fooCls");
ClassType clsType = (ClassType) field.type();
Method constructor = getConstructorForClass(clsType);
for (int i = 0; i < 15; i++) {
@SuppressWarnings({ "rawtypes", "unchecked" }) ObjectReference objRef = clsType.newInstance(mainThread, constructor, new ArrayList(0), ObjectReference.INVOKE_NONVIRTUAL);
if (objRef.isCollected()) {
System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
continue;
}
invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
}
} catch (InvocationException e) {
handleFailure(e);
}
}
use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class ShowInstancesByClassAction method isEnabled.
@Override
protected boolean isEnabled(@NotNull XValueNodeImpl node, @NotNull AnActionEvent e) {
final ObjectReference ref = getObjectReference(node);
final boolean enabled = ref != null && ref.virtualMachine().canGetInstanceInfo();
if (enabled) {
final String text = String.format("Show %s Objects...", StringUtil.getShortName(ref.referenceType().name()));
e.getPresentation().setText(text);
}
return enabled;
}
use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class JumpToAllocationSourceAction method getStack.
@Nullable
private List<StackFrameItem> getStack(AnActionEvent e) {
final Project project = e.getProject();
final XValueNodeImpl selectedNode = getSelectedNode(e.getDataContext());
final ObjectReference ref = selectedNode != null ? getObjectReference(selectedNode) : null;
if (project == null || ref == null) {
return null;
}
final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
if (session != null) {
final MemoryViewDebugProcessData data = DebuggerManager.getInstance(project).getDebugProcess(session.getDebugProcess().getProcessHandler()).getUserData(MemoryViewDebugProcessData.KEY);
return data != null ? data.getTrackedStacks().getStack(ref) : null;
}
return null;
}
use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class FilteringTask method run.
@Override
public void run() {
myCallback.started(myReferences.size());
int proceedCount;
for (proceedCount = 0; proceedCount < myReferences.size() && !myIsCancelled; proceedCount++) {
ObjectReference ref = myReferences.get(proceedCount);
CheckingResult result = myChecker.check(ref);
FilteringTaskCallback.Action action = FilteringTaskCallback.Action.CONTINUE;
switch(result.getResult()) {
case MATCH:
action = myCallback.matched(ref);
break;
case NO_MATCH:
action = myCallback.notMatched(ref);
break;
case ERROR:
action = myCallback.error(ref, result.getFailureDescription());
break;
}
if (action == FilteringTaskCallback.Action.STOP) {
break;
}
}
FilteringResult reason = myIsCancelled ? FilteringResult.INTERRUPTED : proceedCount == myReferences.size() ? FilteringResult.ALL_CHECKED : FilteringResult.LIMIT_REACHED;
myCallback.completed(reason);
}
use of com.sun.jdi.ObjectReference in project intellij-community by JetBrains.
the class LambdaAsyncMethodFilter method onReached.
@Override
public int onReached(SuspendContextImpl context, RequestHint hint) {
try {
StackFrameProxyImpl proxy = context.getFrameProxy();
if (proxy != null) {
Value lambdaReference = ContainerUtil.getOrElse(proxy.getArgumentValues(), myParamNo, null);
if (lambdaReference instanceof ObjectReference) {
final SourcePosition pos = myMethodFilter.getBreakpointPosition();
if (pos != null) {
Project project = context.getDebugProcess().getProject();
long lambdaId = ((ObjectReference) lambdaReference).uniqueID();
StepIntoBreakpoint breakpoint = new LambdaInstanceBreakpoint(project, lambdaId, pos, myMethodFilter);
ClassInstanceMethodFilter.setUpStepIntoBreakpoint(context, breakpoint, hint);
return RequestHint.RESUME;
}
}
}
} catch (EvaluateException ignore) {
}
return RequestHint.STOP;
}
Aggregations