use of com.intellij.debugger.jdi.ThreadReferenceProxyImpl in project intellij-community by JetBrains.
the class StackCapturingLineBreakpoint method processLocatableEvent.
@Override
public boolean processLocatableEvent(SuspendContextCommandImpl action, LocatableEvent event) throws EventProcessingException {
SuspendContextImpl suspendContext = action.getSuspendContext();
if (suspendContext != null) {
ThreadReferenceProxyImpl thread = suspendContext.getThread();
if (thread != null) {
DebugProcessImpl process = suspendContext.getDebugProcess();
try {
StackFrameProxyImpl frameProxy = ContainerUtil.getFirstItem(thread.forceFrames());
if (frameProxy != null) {
Map<Object, List<StackFrameItem>> stacks = process.getUserData(CAPTURED_STACKS);
if (stacks == null) {
stacks = new CapturedStacksMap();
process.putUserData(CAPTURED_STACKS, Collections.synchronizedMap(stacks));
}
Value key = myCaptureEvaluator.evaluate(new EvaluationContextImpl(suspendContext, frameProxy));
if (key instanceof ObjectReference) {
List<StackFrameItem> frames = StackFrameItem.createFrames(suspendContext, true);
if (frames.size() > MAX_STACK_LENGTH) {
frames = frames.subList(0, MAX_STACK_LENGTH);
}
stacks.put(getKey((ObjectReference) key), frames);
}
}
} catch (EvaluateException e) {
LOG.debug(e);
process.printToConsole(DebuggerBundle.message("error.unable.to.evaluate.capture.expression", e.getMessage()) + "\n");
}
}
}
return false;
}
use of com.intellij.debugger.jdi.ThreadReferenceProxyImpl in project intellij-community by JetBrains.
the class SuspendContextImpl method setThread.
public void setThread(ThreadReference thread) {
assertNotResumed();
ThreadReferenceProxyImpl threadProxy = myDebugProcess.getVirtualMachineProxy().getThreadReferenceProxy(thread);
LOG.assertTrue(myThread == null || myThread == threadProxy);
myThread = threadProxy;
}
use of com.intellij.debugger.jdi.ThreadReferenceProxyImpl in project intellij-community by JetBrains.
the class SuspendManagerImpl method processVote.
private void processVote(final SuspendContextImpl suspendContext) {
LOG.assertTrue(suspendContext.myVotesToVote > 0);
suspendContext.myVotesToVote--;
if (LOG.isDebugEnabled()) {
LOG.debug("myVotesToVote = " + suspendContext.myVotesToVote);
}
if (suspendContext.myVotesToVote == 0) {
if (suspendContext.myIsVotedForResume) {
// resume in a separate request to allow other requests be processed (e.g. dependent bpts enable)
myDebugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
resume(suspendContext);
}
@Override
public Priority getPriority() {
return Priority.HIGH;
}
});
} else {
LOG.debug("vote paused");
myDebugProcess.logThreads();
myDebugProcess.cancelRunToCursorBreakpoint();
final ThreadReferenceProxyImpl thread = suspendContext.getThread();
myDebugProcess.deleteStepRequests(thread != null ? thread.getThreadReference() : null);
notifyPaused(suspendContext);
}
}
}
use of com.intellij.debugger.jdi.ThreadReferenceProxyImpl in project intellij-community by JetBrains.
the class DebugProcessImpl method doStep.
/**
*
* @param suspendContext
* @param stepThread
* @param size the step size. One of {@link StepRequest#STEP_LINE} or {@link StepRequest#STEP_MIN}
* @param depth
* @param hint may be null
*/
protected void doStep(final SuspendContextImpl suspendContext, final ThreadReferenceProxyImpl stepThread, int size, int depth, RequestHint hint) {
if (stepThread == null) {
return;
}
try {
final ThreadReference stepThreadReference = stepThread.getThreadReference();
if (LOG.isDebugEnabled()) {
LOG.debug("DO_STEP: creating step request for " + stepThreadReference);
}
deleteStepRequests(stepThreadReference);
EventRequestManager requestManager = getVirtualMachineProxy().eventRequestManager();
StepRequest stepRequest = requestManager.createStepRequest(stepThreadReference, size, depth);
if (!(hint != null && hint.isIgnoreFilters())) /*&& depth == StepRequest.STEP_INTO*/
{
checkPositionNotFiltered(stepThread, filters -> filters.forEach(f -> stepRequest.addClassExclusionFilter(f.getPattern())));
}
// suspend policy to match the suspend policy of the context:
// if all threads were suspended, then during stepping all the threads must be suspended
// if only event thread were suspended, then only this particular thread must be suspended during stepping
stepRequest.setSuspendPolicy(suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ? EventRequest.SUSPEND_EVENT_THREAD : EventRequest.SUSPEND_ALL);
if (hint != null) {
//noinspection HardCodedStringLiteral
stepRequest.putProperty("hint", hint);
}
stepRequest.enable();
} catch (ObjectCollectedException ignored) {
}
}
use of com.intellij.debugger.jdi.ThreadReferenceProxyImpl in project intellij-community by JetBrains.
the class DebugProcessEvents method preprocessEvent.
private static void preprocessEvent(SuspendContextImpl suspendContext, ThreadReference thread) {
ThreadReferenceProxyImpl oldThread = suspendContext.getThread();
suspendContext.setThread(thread);
if (oldThread == null) {
//this is the first event in the eventSet that we process
suspendContext.getDebugProcess().beforeSuspend(suspendContext);
}
}
Aggregations