use of com.intellij.debugger.engine.events.DebuggerCommandImpl in project intellij-community by JetBrains.
the class FreezeThreadAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
if (selectedNode == null) {
return;
}
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
for (final DebuggerTreeNodeImpl debuggerTreeNode : selectedNode) {
ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl) debuggerTreeNode.getDescriptor());
final ThreadReferenceProxyImpl thread = threadDescriptor.getThreadReference();
if (!threadDescriptor.isFrozen()) {
debugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
debugProcess.createFreezeThreadCommand(thread).run();
debuggerTreeNode.calcValue();
}
});
}
}
}
use of com.intellij.debugger.engine.events.DebuggerCommandImpl in project intellij-community by JetBrains.
the class DebuggerTree method rebuild.
public void rebuild(final DebuggerContextImpl context) {
ApplicationManager.getApplication().assertIsDispatchThread();
final DebugProcessImpl process = context.getDebugProcess();
if (process == null) {
// empty context, no process available yet
return;
}
myDebuggerContext = context;
saveState();
process.getManagerThread().schedule(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
getNodeFactory().setHistoryByContext(context);
}
@Override
public Priority getPriority() {
return Priority.NORMAL;
}
});
build(context);
}
use of com.intellij.debugger.engine.events.DebuggerCommandImpl in project smali by JesusFreke.
the class SmaliSteppingCommandProvider method getStepOverCommand.
@Override
public ResumeCommand getStepOverCommand(@NotNull final SuspendContextImpl suspendContext, boolean ignoreBreakpoints, int stepSize) {
final SourcePosition[] location = new SourcePosition[1];
suspendContext.getDebugProcess().getManagerThread().invokeAndWait(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
location[0] = ContextUtil.getSourcePosition(suspendContext);
}
});
if (location[0] != null && location[0].getFile().getLanguage() == SmaliLanguage.INSTANCE) {
return suspendContext.getDebugProcess().createStepOverCommand(suspendContext, ignoreBreakpoints, StepRequest.STEP_MIN);
}
return null;
}
use of com.intellij.debugger.engine.events.DebuggerCommandImpl in project android by JetBrains.
the class InstantRunManager method refreshDebugger.
private void refreshDebugger(@NotNull String packageName) {
// First we reapply the breakpoints on the new code, otherwise the breakpoints
// remain set on the old classes and will never be hit again.
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
DebuggerManagerEx debugger = DebuggerManagerEx.getInstanceEx(myProject);
if (!debugger.getSessions().isEmpty()) {
List<Breakpoint> breakpoints = debugger.getBreakpointManager().getBreakpoints();
for (Breakpoint breakpoint : breakpoints) {
if (breakpoint.isEnabled()) {
breakpoint.setEnabled(false);
breakpoint.setEnabled(true);
}
}
}
}
});
// Now we refresh the call-stacks and the variable panes.
DebuggerManagerEx debugger = DebuggerManagerEx.getInstanceEx(myProject);
for (final DebuggerSession session : debugger.getSessions()) {
Client client = session.getProcess().getProcessHandler().getUserData(AndroidSessionInfo.ANDROID_DEBUG_CLIENT);
if (client != null && client.isValid() && StringUtil.equals(packageName, client.getClientData().getClientDescription())) {
session.getProcess().getManagerThread().invoke(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
DebuggerContextImpl context = session.getContextManager().getContext();
SuspendContextImpl suspendContext = context.getSuspendContext();
if (suspendContext != null) {
XExecutionStack stack = suspendContext.getActiveExecutionStack();
if (stack != null) {
((JavaExecutionStack) stack).initTopFrame();
}
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
session.refresh(false);
XDebugSession xSession = session.getXDebugSession();
if (xSession != null) {
xSession.resume();
}
}
});
}
});
}
}
}
use of com.intellij.debugger.engine.events.DebuggerCommandImpl in project intellij-community by JetBrains.
the class InterruptThreadAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final DebuggerTreeNodeImpl[] nodes = getSelectedNodes(e.getDataContext());
if (nodes == null) {
return;
}
//noinspection ConstantConditions
final List<ThreadReferenceProxyImpl> threadsToInterrupt = new ArrayList<>();
for (final DebuggerTreeNodeImpl debuggerTreeNode : nodes) {
final NodeDescriptorImpl descriptor = debuggerTreeNode.getDescriptor();
if (descriptor instanceof ThreadDescriptorImpl) {
threadsToInterrupt.add(((ThreadDescriptorImpl) descriptor).getThreadReference());
}
}
if (!threadsToInterrupt.isEmpty()) {
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
if (debugProcess != null) {
debugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
protected void action() throws Exception {
boolean unsupported = false;
for (ThreadReferenceProxyImpl thread : threadsToInterrupt) {
try {
thread.getThreadReference().interrupt();
} catch (UnsupportedOperationException ignored) {
unsupported = true;
}
}
if (unsupported) {
final Project project = debugProcess.getProject();
XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Thread operation 'interrupt' is not supported by VM", MessageType.INFO).notify(project);
}
}
});
}
}
}
Aggregations