Executing multiple operations related to the debugger

Answered

Hello.

How to properly execute multiple operations related to the debugger? I'm trying first to drop a frame and then resume execution by running to a specific line. So the code looks like:

DataContext dataContext = DataManager.getInstance().getDataContext();
Project project = dataContext.getData(CommonDataKeys.PROJECT);
XDebuggerManager debuggerManager = XDebuggerManager.getInstance(project);
XDebugProcess debugProcess = debuggerManager.getCurrentSession().getDebugProcess();

XSourcePosition position = ... // calculate the position I want to resume

debugProcess
       .getDropFrameHandler().drop(debuggerManager.getCurrentSession().getCurrentStackFrame());
debuggerManager.getCurrentSession().runToPosition(position, true);

The first operation, i.e. dropping the frame works. But then I get ‘Skipped breakpoint at Foobar:9 because it happened inside debugger evaluation’. I assume I should somehow wait for the debugger to ‘settle’ before executing the second operation (i.e. run to position), but although I spent a few hours browsing through debugger-related classes I could not find a way to do that.

0
1 comment

I missed XDebugSession.addSessionListener() and then XDebugSessionListener.sessionPaused(). That seems to work.

0

Please sign in to leave a comment.