Changeset View
Changeset View
Standalone View
Standalone View
debuggers/lldb/unittests/test_lldb.cpp
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 87 | public: | |||
---|---|---|---|---|---|
90 | using EnvironmentGroupList::variables; | 90 | using EnvironmentGroupList::variables; | ||
91 | using EnvironmentGroupList::saveSettings; | 91 | using EnvironmentGroupList::saveSettings; | ||
92 | using EnvironmentGroupList::removeGroup; | 92 | using EnvironmentGroupList::removeGroup; | ||
93 | }; | 93 | }; | ||
94 | 94 | | |||
95 | class TestLaunchConfiguration : public ILaunchConfiguration | 95 | class TestLaunchConfiguration : public ILaunchConfiguration | ||
96 | { | 96 | { | ||
97 | public: | 97 | public: | ||
98 | TestLaunchConfiguration(const QUrl& executable = findExecutable("lldb_debugee"), | 98 | explicit TestLaunchConfiguration(const QUrl& executable = findExecutable("lldb_debugee"), | ||
99 | const QUrl& workingDirectory = QUrl()) { | 99 | const QUrl& workingDirectory = QUrl()) { | ||
100 | qDebug() << "FIND" << executable; | 100 | qDebug() << "FIND" << executable; | ||
101 | c = new KConfig(); | 101 | c = new KConfig(); | ||
102 | c->deleteGroup("launch"); | 102 | c->deleteGroup("launch"); | ||
103 | cfg = c->group("launch"); | 103 | cfg = c->group("launch"); | ||
104 | cfg.writeEntry("isExecutable", true); | 104 | cfg.writeEntry("isExecutable", true); | ||
105 | cfg.writeEntry("Executable", executable); | 105 | cfg.writeEntry("Executable", executable); | ||
106 | cfg.writeEntry("Working Directory", workingDirectory); | 106 | cfg.writeEntry("Working Directory", workingDirectory); | ||
Show All 12 Lines | 118 | private: | |||
119 | KConfigGroup cfg; | 119 | KConfigGroup cfg; | ||
120 | KConfig *c; | 120 | KConfig *c; | ||
121 | }; | 121 | }; | ||
122 | 122 | | |||
123 | class TestFrameStackModel : public LldbFrameStackModel | 123 | class TestFrameStackModel : public LldbFrameStackModel | ||
124 | { | 124 | { | ||
125 | public: | 125 | public: | ||
126 | 126 | | |||
127 | TestFrameStackModel(DebugSession* session) | 127 | explicit TestFrameStackModel(DebugSession* session) | ||
128 | : LldbFrameStackModel(session), fetchFramesCalled(0), fetchThreadsCalled(0) {} | 128 | : LldbFrameStackModel(session), fetchFramesCalled(0), fetchThreadsCalled(0) {} | ||
129 | 129 | | |||
130 | void fetchFrames(int threadNumber, int from, int to) override | 130 | void fetchFrames(int threadNumber, int from, int to) override | ||
131 | { | 131 | { | ||
132 | fetchFramesCalled++; | 132 | fetchFramesCalled++; | ||
133 | LldbFrameStackModel::fetchFrames(threadNumber, from, to); | 133 | LldbFrameStackModel::fetchFrames(threadNumber, from, to); | ||
134 | } | 134 | } | ||
135 | 135 | | |||
▲ Show 20 Lines • Show All 1535 Lines • ▼ Show 20 Line(s) | 1635 | { | |||
1671 | QVERIFY(locs.contains("argv")); | 1671 | QVERIFY(locs.contains("argv")); | ||
1672 | QVERIFY(locs.contains("x")); | 1672 | QVERIFY(locs.contains("x")); | ||
1673 | 1673 | | |||
1674 | breakpoints()->removeRow(0); | 1674 | breakpoints()->removeRow(0); | ||
1675 | session->run(); | 1675 | session->run(); | ||
1676 | WAIT_FOR_STATE(session, DebugSession::EndedState); | 1676 | WAIT_FOR_STATE(session, DebugSession::EndedState); | ||
1677 | } | 1677 | } | ||
1678 | 1678 | | |||
1679 | void LldbTest::testVariablesNonascii() | | |||
1680 | { | | |||
1681 | TestDebugSession *session = new TestDebugSession; | | |||
1682 | TestLaunchConfiguration cfg(findExecutable("lldb_debugeeqt")); | | |||
1683 | | ||||
1684 | session->variableController()->setAutoUpdate(KDevelop::IVariableController::UpdateLocals); | | |||
1685 | | ||||
1686 | QString fileName = findSourceFile("debugeeqt.cpp"); | | |||
1687 | breakpoints()->addCodeBreakpoint(QUrl::fromLocalFile(fileName), 30); | | |||
1688 | | ||||
1689 | QVERIFY(session->startDebugging(&cfg, m_iface)); | | |||
1690 | WAIT_FOR_STATE_AND_IDLE(session, DebugSession::PausedState); | | |||
1691 | | ||||
1692 | QCOMPARE(session->currentLine(), 30); | | |||
1693 | COMPARE_DATA(localVariableIndexAt(0, 1), QString("\"\u4f60\u597d\u4e16\u754c\"")); | | |||
1694 | | ||||
1695 | session->run(); | | |||
1696 | WAIT_FOR_STATE(session, DebugSession::EndedState); | | |||
1697 | } | | |||
1698 | | ||||
1699 | void LldbTest::testSwitchFrameLldbConsole() | 1679 | void LldbTest::testSwitchFrameLldbConsole() | ||
1700 | { | 1680 | { | ||
1701 | TestDebugSession *session = new TestDebugSession; | 1681 | TestDebugSession *session = new TestDebugSession; | ||
1702 | TestLaunchConfiguration cfg; | 1682 | TestLaunchConfiguration cfg; | ||
1703 | 1683 | | |||
1704 | TestFrameStackModel *stackModel = session->frameStackModel(); | 1684 | TestFrameStackModel *stackModel = session->frameStackModel(); | ||
1705 | 1685 | | |||
1706 | breakpoints()->addCodeBreakpoint(QUrl::fromLocalFile(m_debugeeFileName), 24); | 1686 | breakpoints()->addCodeBreakpoint(QUrl::fromLocalFile(m_debugeeFileName), 24); | ||
▲ Show 20 Lines • Show All 198 Lines • Show Last 20 Lines |