MCPcopy Create free account
hub / github.com/KDE/kdevelop / addSession

Method addSession

kdevplatform/shell/debugcontroller.cpp:296–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296void DebugController::addSession(IDebugSession* session)
297{
298 qCDebug(SHELL) << session;
299 Q_ASSERT(session->variableController());
300 Q_ASSERT(session->breakpointController());
301 Q_ASSERT(session->frameStackModel());
302
303 //TODO support multiple sessions
304 if (m_currentSession) {
305 // Disconnect from no longer relevant signals of the previous session. But keep the stateChanged
306 // and killAllDebuggersNow connections because they are always applicable to all sessions.
307 disconnect(m_currentSession, &IDebugSession::showStepInSource, this, &DebugController::showStepInSource);
308 disconnect(m_currentSession, &IDebugSession::clearExecutionPoint, this, &DebugController::clearExecutionPoint);
309 disconnect(m_currentSession, &IDebugSession::raiseFramestackViews, this,
310 &DebugController::raiseFramestackViews);
311
312 // Remove the execution point, if any, of the previous session.
313 clearExecutionPoint();
314
315 // NOTE: stopping the debugger can synchronously transition m_currentSession into the
316 // ended state (e.g. if it is not started) and consequently set it to nullptr.
317 m_currentSession->stopDebugger();
318 }
319 auto* const previousSession = m_currentSession;
320 m_currentSession = session;
321
322 connect(session, &IDebugSession::stateChanged, this, &DebugController::debuggerStateChanged);
323 connect(session, &IDebugSession::showStepInSource, this, &DebugController::showStepInSource);
324 connect(session, &IDebugSession::clearExecutionPoint, this, &DebugController::clearExecutionPoint);
325 connect(session, &IDebugSession::raiseFramestackViews, this, &DebugController::raiseFramestackViews);
326 connect(this, &DebugController::killAllDebuggersNow, session, &IDebugSession::killDebuggerNow);
327
328 updateDebuggerState(session->state(), session);
329
330 Q_EMIT currentSessionChanged(session, previousSession);
331
332 if((Core::self()->setupFlags() & Core::NoUi)) return;
333
334
335 Sublime::MainWindow* mainWindow = Core::self()->uiControllerInternal()->activeSublimeWindow();
336 auto oldArea = mainWindow->area();
337 if (oldArea->objectName() != QLatin1String("debug")) {
338 ICore::self()->uiController()->switchToArea(QStringLiteral("debug"), IUiController::ThisWindow);
339 mainWindow->area()->setWorkingSet(oldArea->workingSet(), oldArea->workingSetPersistent(), oldArea);
340 }
341}
342
343void DebugController::clearExecutionPoint()
344{

Callers 4

TestDebugSessionClass · 0.45
TestDebugSessionMethod · 0.45
createSessionMethod · 0.45
TestDebugSessionMethod · 0.45

Calls 14

setupFlagsMethod · 0.80
activeSublimeWindowMethod · 0.80
uiControllerInternalMethod · 0.80
switchToAreaMethod · 0.80
uiControllerMethod · 0.80
workingSetPersistentMethod · 0.80
variableControllerMethod · 0.45
breakpointControllerMethod · 0.45
frameStackModelMethod · 0.45
stopDebuggerMethod · 0.45
stateMethod · 0.45
areaMethod · 0.45

Tested by 2

TestDebugSessionMethod · 0.36
TestDebugSessionMethod · 0.36