MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / launchSession

Method launchSession

src/plugins/debugger/dap/dapdebugger.cpp:1523–1623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1521}
1522
1523void DAPDebugger::launchSession(int port, const QMap<QString, QVariant> &param, const QString &kitName)
1524{
1525 if (!port) {
1526 printOutput(tr("\nThe dap port is not ready, please retry.\n"), OutputPane::OutputFormat::ErrorMessage);
1527 return;
1528 }
1529
1530 printOutput(tr("Debugging starts"));
1531 QString launchTip = tr("Launch dap session with port %1 ...")
1532 .arg(port);
1533 printOutput(launchTip);
1534
1535 d->currentDebugKit = kitName;
1536 auto iniRequet = d->rtCfgProvider->initalizeRequest();
1537 bool bSuccess = false;
1538 if (!d->isRemote)
1539 bSuccess = d->currentSession->initialize(d->rtCfgProvider->ip(),
1540 port,
1541 iniRequet);
1542 else
1543 bSuccess = d->currentSession->initialize(param.value("ip").toString().toLatin1(),
1544 port,
1545 iniRequet);
1546
1547 if (!bSuccess) {
1548 updateRunState(DAPDebugger::RunState::kNoRun);
1549 notify(2, tr("Debugging service initialization failed"));
1550 qCritical() << "startDebug failed!";
1551 return;
1552 }
1553
1554 // Launch debuggee.
1555 switch (d->debugState) {
1556 case Normal: {
1557 auto &ctx = dpfInstance.serviceContext();
1558 LanguageService *service = ctx.service<LanguageService>(LanguageService::name());
1559 if (service) {
1560 auto generator = service->create<LanguageGenerator>(kitName);
1561 if (generator) {
1562 if (generator->isLaunchNotAttach()) {
1563 dap::LaunchRequest request = generator->launchDAP(param);
1564 bSuccess &= d->currentSession->launch(request);
1565 } else {
1566 dap::AttachRequest request = generator->attachDAP(port, param);
1567 bSuccess &= d->currentSession->attach(request);
1568 }
1569 }
1570 } else {
1571 bSuccess &= false;
1572 }
1573 break;
1574 }
1575 case Attaching: {
1576 dap::object obj;
1577 obj["processId"] = param.value("targetPath").toString().toStdString();
1578 dap::AttachRequest request;
1579 request.name = kitName.toStdString(); //kitName: gdb
1580 request.connect = obj;

Callers

nothing calls this directly

Calls 15

notifyFunction · 0.85
initalizeRequestMethod · 0.80
ipMethod · 0.80
createApplicationPaneMethod · 0.80
setStopHandlerMethod · 0.80
defaultPaneMethod · 0.80
getOutputPaneByIdMethod · 0.80
bindToolBarToPaneMethod · 0.80
nameFunction · 0.50
initializeMethod · 0.45
toStringMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected