use of com.intellij.xdebugger.frame.XExecutionStack in project intellij-community by JetBrains.
the class XFramesView method processSessionEvent.
@Override
public void processSessionEvent(@NotNull SessionEvent event, @NotNull XDebugSession session) {
myRefresh = event == SessionEvent.SETTINGS_CHANGED;
if (event == SessionEvent.BEFORE_RESUME) {
return;
}
XStackFrame currentStackFrame = session.getCurrentStackFrame();
XSuspendContext suspendContext = session.getSuspendContext();
if (event == SessionEvent.FRAME_CHANGED) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (currentStackFrame != null) {
myFramesList.setSelectedValue(currentStackFrame, true);
mySelectedFrameIndex = myFramesList.getSelectedIndex();
myExecutionStacksWithSelection.put(mySelectedStack, mySelectedFrameIndex);
}
return;
}
myLaterInvocator.offer(() -> {
if (event != SessionEvent.SETTINGS_CHANGED) {
mySelectedFrameIndex = 0;
mySelectedStack = null;
myVisibleRect = null;
} else {
myVisibleRect = myFramesList.getVisibleRect();
}
myListenersEnabled = false;
myBuilders.values().forEach(StackFramesListBuilder::dispose);
myBuilders.clear();
if (suspendContext == null) {
requestClear();
return;
}
if (event == SessionEvent.PAUSED) {
// clear immediately
cancelClear();
clear();
}
XExecutionStack[] executionStacks = suspendContext.getExecutionStacks();
addExecutionStacks(Arrays.asList(executionStacks));
XExecutionStack activeExecutionStack = mySelectedStack != null ? mySelectedStack : suspendContext.getActiveExecutionStack();
myThreadComboBox.setSelectedItem(activeExecutionStack);
myThreadsPanel.removeAll();
myThreadsPanel.add(myToolbar.getComponent(), BorderLayout.EAST);
final boolean invisible = executionStacks.length == 1 && StringUtil.isEmpty(executionStacks[0].getDisplayName());
if (!invisible) {
myThreadsPanel.add(myThreadComboBox, BorderLayout.CENTER);
}
myToolbar.setAddSeparatorFirst(!invisible);
updateFrames(activeExecutionStack, session);
});
}
use of com.intellij.xdebugger.frame.XExecutionStack in project ballerina by ballerina-lang.
the class BallerinaDebugProcess method getWorkerID.
@Nullable
private String getWorkerID(@Nullable XSuspendContext context) {
if (context != null) {
XExecutionStack activeExecutionStack = context.getActiveExecutionStack();
if (activeExecutionStack instanceof BallerinaSuspendContext.BallerinaExecutionStack) {
return ((BallerinaSuspendContext.BallerinaExecutionStack) activeExecutionStack).getMyWorkerID();
}
}
getSession().getConsoleView().print("Error occurred while getting the thread ID.", ConsoleViewContentType.ERROR_OUTPUT);
getSession().stop();
return null;
}
use of com.intellij.xdebugger.frame.XExecutionStack 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.xdebugger.frame.XExecutionStack in project intellij-community by JetBrains.
the class XDebugSessionImpl method showExecutionPoint.
@Override
public void showExecutionPoint() {
if (mySuspendContext != null) {
XExecutionStack executionStack = mySuspendContext.getActiveExecutionStack();
if (executionStack != null) {
XStackFrame topFrame = executionStack.getTopFrame();
if (topFrame != null) {
setCurrentStackFrame(executionStack, topFrame, true);
myDebuggerManager.showExecutionPosition();
}
}
}
}
use of com.intellij.xdebugger.frame.XExecutionStack in project intellij-community by JetBrains.
the class XFramesView method addExecutionStacks.
private void addExecutionStacks(List<? extends XExecutionStack> executionStacks) {
for (XExecutionStack executionStack : executionStacks) {
if (!myExecutionStacksWithSelection.contains(executionStack)) {
//noinspection unchecked
myThreadComboBox.addItem(executionStack);
myExecutionStacksWithSelection.put(executionStack, 0);
}
}
}
Aggregations