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

Method testAttach

plugins/lldb/unittests/test_lldb.cpp:210–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210void LldbTest::testAttach()
211{
212 SKIP_IF_ATTACH_FORBIDDEN();
213
214 QString fileName = findSourceFile("debugeeslow.cpp");
215
216 KProcess debugeeProcess;
217 debugeeProcess << QStringLiteral("nice") << findExecutable(QStringLiteral("debuggee_debugeeslow")).toLocalFile();
218 debugeeProcess.start();
219 QVERIFY(debugeeProcess.waitForStarted());
220 QTest::qWait(100);
221
222 auto *session = new TestDebugSession;
223 session->attachToProcess(debugeeProcess.processId());
224
225 WAIT_FOR_A_WHILE(session, 100);
226
227 breakpoints()->addCodeBreakpoint(QUrl::fromLocalFile(fileName), 39); // the blank line in main()
228
229 // lldb-mi silently stops when attaching to a process. Force it continue to run.
230 session->addCommand(MI::ExecContinue, QString(), MI::CmdMaybeStartsRunning);
231 WAIT_FOR_A_WHILE(session, 2000);
232 WAIT_FOR_STATE_AND_IDLE(session, DebugSession::PausedState);
233
234 QCOMPARE(session->currentLine(), 40); // return 0; (LLDB automatically moves the breakpoint from its no-op line)
235
236#ifdef Q_OS_FREEBSD
237 QSKIP(
238 "The test freezes while waiting for the ended state; skipping after session->run() "
239 "makes the next test function testRemoteDebugging() freeze, so skip now");
240#endif
241 session->run();
242 WAIT_FOR_STATE(session, DebugSession::EndedState);
243}
244
245void LldbTest::testRemoteDebugging()
246{

Callers

nothing calls this directly

Calls 10

findSourceFileFunction · 0.85
toLocalFileMethod · 0.80
attachToProcessMethod · 0.80
currentLineMethod · 0.80
addCommandMethod · 0.60
findExecutableFunction · 0.50
QStringClass · 0.50
startMethod · 0.45
addCodeBreakpointMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected