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

Method testVariablesSwitchFrame

plugins/debuggercommon/tests/debuggertestbase.cpp:1904–1946  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1902}
1903
1904void DebuggerTestBase::testVariablesSwitchFrame()
1905{
1906 auto* const session = createTestDebugSession();
1907 TestLaunchConfiguration cfg;
1908
1909 session->variableController()->setAutoUpdate(IVariableController::UpdateLocals);
1910
1911 auto* const stackModel = session->frameStackModel();
1912
1913 addDebugeeBreakpoint(25);
1914 const ActiveStateSessionSpy sessionSpy(session);
1915 START_DEBUGGING_AND_WAIT_FOR_PAUSED_STATE_E(session, cfg, sessionSpy);
1916
1917 auto localsIndex = variableCollection()->index(1, 0);
1918 COMPARE_DATA(localsIndex, VariableCollection::defaultLocalsSectionTitle());
1919
1920 int jRow;
1921 if (isLldb()) {
1922 // only the non-static variable `j` works
1923 QCOMPARE(variableCollection()->rowCount(localsIndex), 1);
1924 jRow = 0;
1925 } else {
1926 QCOMPARE(variableCollection()->rowCount(localsIndex), 2);
1927 COMPARE_DATA(variableCollection()->index(0, 0, localsIndex), "i");
1928 COMPARE_DATA(variableCollection()->index(0, 1, localsIndex), "1");
1929 jRow = 1;
1930 }
1931 COMPARE_DATA(variableCollection()->index(jRow, 0, localsIndex), "j");
1932 COMPARE_DATA(variableCollection()->index(jRow, 1, localsIndex), "1");
1933
1934 stackModel->setCurrentFrame(1);
1935 WAIT_FOR_STATE_AND_IDLE(session, IDebugSession::PausedState);
1936
1937 localsIndex = variableCollection()->index(1, 0);
1938 QCOMPARE(variableCollection()->rowCount(localsIndex), 4);
1939 COMPARE_DATA(variableCollection()->index(2, 0, localsIndex), "argc");
1940 COMPARE_DATA(variableCollection()->index(2, 1, localsIndex), "1");
1941 COMPARE_DATA(variableCollection()->index(3, 0, localsIndex), "argv");
1942
1943 breakpoints()->removeRow(0);
1944 session->run();
1945 WAIT_FOR_STATE(session, IDebugSession::EndedState);
1946}
1947
1948void DebuggerTestBase::testVariablesQuicklySwitchFrame()
1949{

Callers

nothing calls this directly

Calls 9

variableCollectionFunction · 0.85
setAutoUpdateMethod · 0.80
setCurrentFrameMethod · 0.80
removeRowMethod · 0.80
variableControllerMethod · 0.45
frameStackModelMethod · 0.45
indexMethod · 0.45
rowCountMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected