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

Method createBreakpoint

plugins/debuggercommon/mibreakpointcontroller.cpp:366–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366void MIBreakpointController::createBreakpoint(int row)
367{
368 if (debugSession()->debuggerStateIsOn(s_dbgNotStarted))
369 return;
370
371 BreakpointDataPtr breakpoint = m_breakpoints.at(row);
372 Breakpoint* modelBreakpoint = breakpointModel()->breakpoint(row);
373
374 Q_ASSERT(breakpoint->debuggerId < 0 && breakpoint->sent == 0);
375
376 if (modelBreakpoint->location().isEmpty())
377 return;
378
379 if (modelBreakpoint->kind() == Breakpoint::CodeBreakpoint) {
380 QString location;
381 if (modelBreakpoint->line() != -1) {
382 location = QStringLiteral("%0:%1")
383 .arg(modelBreakpoint->url().url(QUrl::PreferLocalFile | QUrl::StripTrailingSlash))
384 .arg(modelBreakpoint->line() + 1);
385 } else {
386 location = modelBreakpoint->location();
387 }
388
389 if (location == QLatin1String("catch throw")) {
390 location = QStringLiteral("exception throw");
391 }
392
393 // Note: We rely on '-f' to be automatically added by the MICommand logic
394 QString arguments;
395 if (!modelBreakpoint->enabled())
396 arguments += QLatin1String("-d ");
397 if (!modelBreakpoint->condition().isEmpty())
398 arguments += QStringLiteral("-c %0 ").arg(Utils::quoteExpression(modelBreakpoint->condition()));
399 if (modelBreakpoint->ignoreHits() != 0)
400 arguments += QStringLiteral("-i %0 ").arg(modelBreakpoint->ignoreHits());
401 arguments += Utils::quoteExpression(location);
402
403 BreakpointModel::ColumnFlags sent =
404 BreakpointModel::EnableColumnFlag |
405 BreakpointModel::ConditionColumnFlag |
406 BreakpointModel::IgnoreHitsColumnFlag |
407 BreakpointModel::LocationColumnFlag;
408 debugSession()->addCommand(BreakInsert, arguments,
409 new InsertedHandler(this, breakpoint, sent),
410 CmdImmediately);
411 } else {
412 QString opt;
413 if (modelBreakpoint->kind() == Breakpoint::ReadBreakpoint)
414 opt = QStringLiteral("-r ");
415 else if (modelBreakpoint->kind() == Breakpoint::AccessBreakpoint)
416 opt = QStringLiteral("-a ");
417
418 debugSession()->addCommand(BreakWatch,
419 opt + Utils::quoteExpression(modelBreakpoint->location()),
420 new InsertedHandler(this, breakpoint,
421 BreakpointModel::LocationColumnFlag),
422 CmdImmediately);
423 }

Callers

nothing calls this directly

Calls 13

breakpointModelFunction · 0.85
debuggerStateIsOnMethod · 0.80
breakpointMethod · 0.80
enabledMethod · 0.80
conditionMethod · 0.80
ignoreHitsMethod · 0.80
addCommandMethod · 0.60
atMethod · 0.45
isEmptyMethod · 0.45
locationMethod · 0.45
kindMethod · 0.45
lineMethod · 0.45

Tested by

no test coverage detected