FIXME: use same configuration process as startDebugging
| 348 | |
| 349 | // FIXME: use same configuration process as startDebugging |
| 350 | bool MIDebugSession::attachToProcess(int pid) |
| 351 | { |
| 352 | qCDebug(DEBUGGERCOMMON) << "Attach to process" << pid; |
| 353 | |
| 354 | emit showMessage(i18n("Attaching to process %1", pid), 1000); |
| 355 | |
| 356 | if (debuggerStateIsOn(s_dbgNotStarted)) { |
| 357 | // FIXME: use global launch configuration rather than nullptr |
| 358 | if (!startDebugger(nullptr)) { |
| 359 | return false; |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | setDebuggerStateOn(s_attached); |
| 364 | |
| 365 | //set current state to running, after attaching we will get *stopped response |
| 366 | setDebuggerStateOn(s_appRunning); |
| 367 | |
| 368 | addCommand(TargetAttach, QString::number(pid), |
| 369 | this, &MIDebugSession::handleTargetAttach, |
| 370 | CmdHandlesError); |
| 371 | |
| 372 | addCommand(std::make_unique<SentinelCommand>(breakpointController(), &MIBreakpointController::initSendBreakpoints)); |
| 373 | |
| 374 | raiseEvent(connected_to_program); |
| 375 | |
| 376 | emit raiseFramestackViews(); |
| 377 | |
| 378 | return true; |
| 379 | } |
| 380 | |
| 381 | void MIDebugSession::handleTargetAttach(const MI::ResultRecord& r) |
| 382 | { |