void IPCEngineHost::insertBreakpoint(BreakpointModelId id) { breakHandler()->notifyBreakpointInsertProceeding(id); QByteArray p; { QDataStream s(&p, QIODevice::WriteOnly); SET_NATIVE_BYTE_ORDER(s); s << id; s << breakHandler()->breakpointData(id); } rpcCall(AddBreakpoint, p); }
void IPCEngineHost::changeBreakpoint(BreakpointId id) { breakHandler()->notifyBreakpointChangeProceeding(id); QByteArray p; { QDataStream s(&p, QIODevice::WriteOnly); SET_NATIVE_BYTE_ORDER(s); s << id; s << breakHandler()->breakpointData(id); } rpcCall(RemoveBreakpoint, p); }
BreakpointMarker::BreakpointMarker(BreakpointModelId id, const QString &fileName, int lineNumber) : BaseTextMark(fileName, lineNumber), m_id(id) { setIcon(breakHandler()->icon(m_id)); setPriority(TextEditor::ITextMark::NormalPriority); //qDebug() << "CREATE MARKER " << fileName << lineNumber; }
void PdbEngine::removeBreakpoint(BreakpointModelId id) { BreakHandler *handler = breakHandler(); QTC_CHECK(handler->state(id) == BreakpointRemoveRequested); handler->notifyBreakpointRemoveProceeding(id); BreakpointResponse br = handler->response(id); showMessage(_("DELETING BP %1 IN %2").arg(br.id.toString()) .arg(handler->fileName(id))); postCommand("clear " + br.id.toByteArray()); // Pretend it succeeds without waiting for response. handler->notifyBreakpointRemoveOk(id); }
void PdbEngine::removeBreakpoint(BreakpointId id) { BreakHandler *handler = breakHandler(); QTC_ASSERT(handler->state(id) == BreakpointRemoveRequested, /**/); handler->notifyBreakpointRemoveProceeding(id); BreakpointResponse br = handler->response(id); showMessage(_("DELETING BP %1 IN %2").arg(br.number) .arg(handler->fileName(id))); postCommand("clear " + QByteArray::number(br.number)); // Pretend it succeeds without waiting for response. handler->notifyBreakpointRemoveOk(id); }
void PdbEngine::insertBreakpoint(BreakpointModelId id) { BreakHandler *handler = breakHandler(); QTC_CHECK(handler->state(id) == BreakpointInsertRequested); handler->notifyBreakpointInsertProceeding(id); QByteArray loc; if (handler->type(id) == BreakpointByFunction) loc = handler->functionName(id).toLatin1(); else loc = handler->fileName(id).toLocal8Bit() + ':' + QByteArray::number(handler->lineNumber(id)); postCommand("break " + loc, CB(handleBreakInsert), QVariant(id)); }
void PdbEngine::handleBreakInsert(const PdbResponse &response) { //qDebug() << "BP RESPONSE: " << response.data; // "Breakpoint 1 at /pdb/math.py:10" BreakpointId id(response.cookie.toInt()); BreakHandler *handler = breakHandler(); QTC_ASSERT(response.data.startsWith("Breakpoint "), return); int pos1 = response.data.indexOf(" at "); QTC_ASSERT(pos1 != -1, return); QByteArray bpnr = response.data.mid(11, pos1 - 11); int pos2 = response.data.lastIndexOf(":"); QByteArray file = response.data.mid(pos1 + 4, pos2 - pos1 - 4); QByteArray line = response.data.mid(pos2 + 1); BreakpointResponse br; br.number = bpnr.toInt(); br.fileName = _(file); br.lineNumber = line.toInt(); handler->setResponse(id, br); }
void BreakpointMarker::updateFileName(const QString &fileName) { BaseTextMark::updateFileName(fileName); breakHandler()->updateFileNameFromMarker(m_id, fileName); }
void BreakpointMarker::clicked() { breakHandler()->removeBreakpoint(m_id); }
void BreakpointMarker::dragToLine(int lineNumber) { breakHandler()->changeLineNumberFromMarker(m_id, lineNumber); }
void BreakpointMarker::updateLineNumber(int lineNumber) { BaseTextMark::updateLineNumber(lineNumber); breakHandler()->updateLineNumberFromMarker(m_id, lineNumber); }
void BreakpointMarker::removedFromEditor() { breakHandler()->removeBreakpoint(m_id); }
void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload) { switch (f) { default: { showMessage(QLatin1String("IPC Error: unhandled id in guest to host call")); const QString logMessage = tr("Fatal engine shutdown. Incompatible binary or IPC error."); showMessage(logMessage, LogError); showStatusMessage(logMessage); } nuke(); break; case IPCEngineGuest::NotifyEngineSetupOk: notifyEngineSetupOk(); break; case IPCEngineGuest::NotifyEngineSetupFailed: notifyEngineSetupFailed(); break; case IPCEngineGuest::NotifyEngineRunFailed: notifyEngineRunFailed(); break; case IPCEngineGuest::NotifyInferiorSetupOk: attemptBreakpointSynchronization(); notifyInferiorSetupOk(); break; case IPCEngineGuest::NotifyInferiorSetupFailed: notifyInferiorSetupFailed(); break; case IPCEngineGuest::NotifyEngineRunAndInferiorRunOk: notifyEngineRunAndInferiorRunOk(); break; case IPCEngineGuest::NotifyEngineRunAndInferiorStopOk: notifyEngineRunAndInferiorStopOk(); break; case IPCEngineGuest::NotifyInferiorRunRequested: notifyInferiorRunRequested(); break; case IPCEngineGuest::NotifyInferiorRunOk: notifyInferiorRunOk(); break; case IPCEngineGuest::NotifyInferiorRunFailed: notifyInferiorRunFailed(); break; case IPCEngineGuest::NotifyInferiorStopOk: notifyInferiorStopOk(); break; case IPCEngineGuest::NotifyInferiorSpontaneousStop: notifyInferiorSpontaneousStop(); break; case IPCEngineGuest::NotifyInferiorStopFailed: notifyInferiorStopFailed(); break; case IPCEngineGuest::NotifyInferiorExited: notifyInferiorExited(); break; case IPCEngineGuest::NotifyInferiorShutdownOk: notifyInferiorShutdownOk(); break; case IPCEngineGuest::NotifyInferiorShutdownFailed: notifyInferiorShutdownFailed(); break; case IPCEngineGuest::NotifyEngineSpontaneousShutdown: notifyEngineSpontaneousShutdown(); break; case IPCEngineGuest::NotifyEngineShutdownOk: notifyEngineShutdownOk(); break; case IPCEngineGuest::NotifyEngineShutdownFailed: notifyEngineShutdownFailed(); break; case IPCEngineGuest::NotifyInferiorIll: notifyInferiorIll(); break; case IPCEngineGuest::NotifyEngineIll: notifyEngineIll(); break; case IPCEngineGuest::NotifyInferiorPid: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); quint64 pid; s >> pid; notifyInferiorPid(pid); } break; case IPCEngineGuest::ShowStatusMessage: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); QString msg; qint64 timeout; s >> msg; s >> timeout; showStatusMessage(msg, timeout); } break; case IPCEngineGuest::ShowMessage: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); QString msg; qint16 channel; qint64 timeout; s >> msg; s >> channel; s >> timeout; showMessage(msg, channel, timeout); } break; case IPCEngineGuest::CurrentFrameChanged: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); quint64 token; s >> token; resetLocation(); StackHandler *sh = stackHandler(); sh->setCurrentIndex(token); if (!sh->currentFrame().isUsable() || QFileInfo(sh->currentFrame().file).exists()) gotoLocation(Location(sh->currentFrame(), true)); else if (!m_sourceAgents.contains(sh->currentFrame().file)) fetchFrameSource(token); foreach(SourceAgent *agent, m_sourceAgents.values()) agent->updateLocationMarker(); } break; case IPCEngineGuest::CurrentThreadChanged: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); quint64 token; s >> token; threadsHandler()->setCurrentThreadId(token); } break; case IPCEngineGuest::ListFrames: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); StackFrames frames; s >> frames; stackHandler()->setFrames(frames); } break; case IPCEngineGuest::ListThreads: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); Threads threads; s >> threads; threadsHandler()->setThreads(threads); } break; case IPCEngineGuest::Disassembled: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); quint64 pc; DisassemblerLines lines; s >> pc; s >> lines; DisassemblerAgent *view = m_frameToDisassemblerAgent.take(pc); if (view) view->setContents(lines); } break; case IPCEngineGuest::UpdateWatchData: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); bool fullCycle; qint64 count; QList<WatchData> wd; s >> fullCycle; s >> count; for (qint64 i = 0; i < count; ++i) { WatchData d; s >> d; wd.append(d); } WatchHandler *wh = watchHandler(); if (!wh) break; wh->beginCycle(fullCycle); wh->insertBulkData(wd); wh->endCycle(fullCycle); } break; case IPCEngineGuest::NotifyAddBreakpointOk: { attemptBreakpointSynchronization(); QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointInsertOk(id); } break; case IPCEngineGuest::NotifyAddBreakpointFailed: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointInsertFailed(id); } break; case IPCEngineGuest::NotifyRemoveBreakpointOk: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointRemoveOk(id); } break; case IPCEngineGuest::NotifyRemoveBreakpointFailed: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointRemoveFailed(id); } break; case IPCEngineGuest::NotifyChangeBreakpointOk: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointChangeOk(id); } break; case IPCEngineGuest::NotifyChangeBreakpointFailed: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointChangeFailed(id); } break; case IPCEngineGuest::NotifyBreakpointAdjusted: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; BreakpointParameters d; s >> id >> d; breakHandler()->notifyBreakpointAdjusted(id, d); } break; case IPCEngineGuest::FrameSourceFetched: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); qint64 token; QString path; QString source; s >> token >> path >> source; SourceAgent *agent = new SourceAgent(this); agent->setSourceProducerName(startParameters().connParams.host); agent->setContent(path, source); m_sourceAgents.insert(path, agent); agent->updateLocationMarker(); } break; } }
BreakpointDialog::BreakpointDialog(BreakpointModelId id, QWidget *parent) : QDialog(parent), m_enabledParts(~0), m_previousType(UnknownBreakpointType), m_firstTypeChange(true) { setWindowTitle(tr("Edit Breakpoint Properties")); QGroupBox *groupBoxBasic = new QGroupBox(tr("Basic"), this); // Match BreakpointType (omitting unknown type). QStringList types; types << tr("File name and line number") << tr("Function name") << tr("Break on memory address") << tr("Break when C++ exception is thrown") << tr("Break when C++ exception is caught") << tr("Break when function \"main\" starts") << tr("Break when a new process is forked") << tr("Break when a new process is executed") << tr("Break when a system call is executed") << tr("Break on data access at fixed address") << tr("Break on data access at address given by expression") << tr("Break on QML signal emit") << tr("Break when JavaScript exception is thrown"); // We don't list UnknownBreakpointType, so 1 less: QTC_CHECK(types.size() + 1 == LastBreakpointType); m_comboBoxType = new QComboBox(groupBoxBasic); m_comboBoxType->setMaxVisibleItems(20); m_comboBoxType->addItems(types); m_labelType = new QLabel(tr("Breakpoint &type:"), groupBoxBasic); m_labelType->setBuddy(m_comboBoxType); m_pathChooserFileName = new Utils::PathChooser(groupBoxBasic); m_pathChooserFileName->setExpectedKind(Utils::PathChooser::File); m_labelFileName = new QLabel(tr("&File name:"), groupBoxBasic); m_labelFileName->setBuddy(m_pathChooserFileName); m_lineEditLineNumber = new QLineEdit(groupBoxBasic); m_labelLineNumber = new QLabel(tr("&Line number:"), groupBoxBasic); m_labelLineNumber->setBuddy(m_lineEditLineNumber); m_checkBoxEnabled = new QCheckBox(groupBoxBasic); m_labelEnabled = new QLabel(tr("&Enabled:"), groupBoxBasic); m_labelEnabled->setBuddy(m_checkBoxEnabled); m_lineEditAddress = new QLineEdit(groupBoxBasic); m_labelAddress = new QLabel(tr("&Address:"), groupBoxBasic); m_labelAddress->setBuddy(m_lineEditAddress); m_lineEditExpression = new QLineEdit(groupBoxBasic); m_labelExpression = new QLabel(tr("&Expression:"), groupBoxBasic); m_labelExpression->setBuddy(m_lineEditExpression); m_lineEditFunction = new QLineEdit(groupBoxBasic); m_labelFunction = new QLabel(tr("Fun&ction:"), groupBoxBasic); m_labelFunction->setBuddy(m_lineEditFunction); QGroupBox *groupBoxAdvanced = new QGroupBox(tr("Advanced"), this); m_checkBoxTracepoint = new QCheckBox(groupBoxAdvanced); m_labelTracepoint = new QLabel(tr("T&racepoint only:"), groupBoxAdvanced); m_labelTracepoint->setBuddy(m_checkBoxTracepoint); m_checkBoxOneShot = new QCheckBox(groupBoxAdvanced); m_labelOneShot = new QLabel(tr("&One shot only:"), groupBoxAdvanced); m_labelOneShot->setBuddy(m_checkBoxOneShot); const QString pathToolTip = tr("<html><head/><body><p>Determines how the path is specified " "when setting breakpoints:</p><ul>" "<li><i>Use Engine Default</i>: Preferred setting of the " "debugger engine.</li>" "<li><i>Use Full Path</i>: Pass full path, avoiding ambiguities " "should files of the same name exist in several modules. " "This is the engine default for CDB and LLDB.</li>" "<li><i>Use File Name</i>: Pass the file name only. This is " "useful when using a source tree whose location does " "not match the one used when building the modules. " "It is the engine default for GDB as using full paths can " "be slow with this engine.</li>" "</ul></body></html>"); m_comboBoxPathUsage = new QComboBox(groupBoxAdvanced); m_comboBoxPathUsage->addItem(tr("Use Engine Default")); m_comboBoxPathUsage->addItem(tr("Use Full Path")); m_comboBoxPathUsage->addItem(tr("Use File Name")); m_comboBoxPathUsage->setToolTip(pathToolTip); m_labelUseFullPath = new QLabel(tr("Pat&h:"), groupBoxAdvanced); m_labelUseFullPath->setBuddy(m_comboBoxPathUsage); m_labelUseFullPath->setToolTip(pathToolTip); const QString moduleToolTip = tr("Specifying the module (base name of the library or executable)\n" "for function or file type breakpoints can significantly speed up\n" "debugger start-up times (CDB, LLDB)."); m_lineEditModule = new QLineEdit(groupBoxAdvanced); m_lineEditModule->setToolTip(moduleToolTip); m_labelModule = new QLabel(tr("&Module:"), groupBoxAdvanced); m_labelModule->setBuddy(m_lineEditModule); m_labelModule->setToolTip(moduleToolTip); const QString commandsToolTip = tr("Debugger commands to be executed when the breakpoint is hit.\n" "This feature is only available for GDB."); m_textEditCommands = new SmallTextEdit(groupBoxAdvanced); m_textEditCommands->setToolTip(commandsToolTip); m_labelCommands = new QLabel(tr("&Commands:"), groupBoxAdvanced); m_labelCommands->setBuddy(m_textEditCommands); m_labelCommands->setToolTip(commandsToolTip); m_lineEditMessage = new QLineEdit(groupBoxAdvanced); m_labelMessage = new QLabel(tr("&Message:"), groupBoxAdvanced); m_labelMessage->setBuddy(m_lineEditMessage); m_lineEditCondition = new QLineEdit(groupBoxAdvanced); m_labelCondition = new QLabel(tr("C&ondition:"), groupBoxAdvanced); m_labelCondition->setBuddy(m_lineEditCondition); m_spinBoxIgnoreCount = new QSpinBox(groupBoxAdvanced); m_spinBoxIgnoreCount->setMinimum(0); m_spinBoxIgnoreCount->setMaximum(2147483647); m_labelIgnoreCount = new QLabel(tr("&Ignore count:"), groupBoxAdvanced); m_labelIgnoreCount->setBuddy(m_spinBoxIgnoreCount); m_lineEditThreadSpec = new QLineEdit(groupBoxAdvanced); m_labelThreadSpec = new QLabel(tr("&Thread specification:"), groupBoxAdvanced); m_labelThreadSpec->setBuddy(m_lineEditThreadSpec); m_buttonBox = new QDialogButtonBox(this); m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); if (id.isValid()) { if (DebuggerEngine *engine = breakHandler()->engine(id)) { if (!engine->hasCapability(BreakConditionCapability)) m_enabledParts &= ~ConditionPart; if (!engine->hasCapability(BreakModuleCapability)) m_enabledParts &= ~ModulePart; if (!engine->hasCapability(TracePointCapability)) m_enabledParts &= ~TracePointPart; } } QFormLayout *basicLayout = new QFormLayout(groupBoxBasic); basicLayout->addRow(m_labelType, m_comboBoxType); basicLayout->addRow(m_labelFileName, m_pathChooserFileName); basicLayout->addRow(m_labelLineNumber, m_lineEditLineNumber); basicLayout->addRow(m_labelEnabled, m_checkBoxEnabled); basicLayout->addRow(m_labelAddress, m_lineEditAddress); basicLayout->addRow(m_labelExpression, m_lineEditExpression); basicLayout->addRow(m_labelFunction, m_lineEditFunction); basicLayout->addRow(m_labelOneShot, m_checkBoxOneShot); QFormLayout *advancedLeftLayout = new QFormLayout(); advancedLeftLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); advancedLeftLayout->addRow(m_labelCondition, m_lineEditCondition); advancedLeftLayout->addRow(m_labelIgnoreCount, m_spinBoxIgnoreCount); advancedLeftLayout->addRow(m_labelThreadSpec, m_lineEditThreadSpec); advancedLeftLayout->addRow(m_labelUseFullPath, m_comboBoxPathUsage); advancedLeftLayout->addRow(m_labelModule, m_lineEditModule); QFormLayout *advancedRightLayout = new QFormLayout(); advancedRightLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); advancedRightLayout->addRow(m_labelCommands, m_textEditCommands); advancedRightLayout->addRow(m_labelTracepoint, m_checkBoxTracepoint); advancedRightLayout->addRow(m_labelMessage, m_lineEditMessage); QHBoxLayout *horizontalLayout = new QHBoxLayout(groupBoxAdvanced); horizontalLayout->addLayout(advancedLeftLayout); horizontalLayout->addSpacing(15); horizontalLayout->addLayout(advancedRightLayout); QVBoxLayout *verticalLayout = new QVBoxLayout(this); verticalLayout->addWidget(groupBoxBasic); verticalLayout->addSpacing(10); verticalLayout->addWidget(groupBoxAdvanced); verticalLayout->addSpacing(10); verticalLayout->addWidget(m_buttonBox); verticalLayout->setStretchFactor(groupBoxAdvanced, 10); connect(m_comboBoxType, SIGNAL(activated(int)), SLOT(typeChanged(int))); connect(m_buttonBox, SIGNAL(accepted()), SLOT(accept())); connect(m_buttonBox, SIGNAL(rejected()), SLOT(reject())); }
BreakpointDialog::BreakpointDialog(BreakpointModelId id, QWidget *parent) : QDialog(parent), m_enabledParts(~0), m_previousType(UnknownType), m_firstTypeChange(true) { m_ui.setupUi(this); m_ui.comboBoxType->setMaxVisibleItems(20); if (id.isValid()) { if (DebuggerEngine *engine = breakHandler()->engine(id)) { if (!engine->hasCapability(BreakConditionCapability)) m_enabledParts &= ~ConditionPart; if (!engine->hasCapability(BreakModuleCapability)) m_enabledParts &= ~ModulePart; if (!engine->hasCapability(TracePointCapability)) m_enabledParts &= ~TracePointPart; } } // Match BreakpointType (omitting unknown type). QStringList types; types << tr("File name and line number") << tr("Function name") << tr("Break on memory address") << tr("Break when C++ exception is thrown") << tr("Break when C++ exception is caught") << tr("Break when function \"main\" starts") << tr("Break when a new process is forked") << tr("Break when a new process is executed") << tr("Break when a system call is executed") << tr("Break on data access at fixed address") << tr("Break on data access at address given by expression") << tr("Break on QML signal emit") << tr("Break when JavaScript exception is thrown"); QTC_ASSERT(types.size() == BreakpointAtJavaScriptThrow, return); m_ui.comboBoxType->addItems(types); m_ui.pathChooserFileName->setExpectedKind(Utils::PathChooser::File); connect(m_ui.comboBoxType, SIGNAL(activated(int)), SLOT(typeChanged(int))); const QString moduleToolTip = tr("Specifying the module (base name of the library or executable)\n" "for function or file type breakpoints can significantly speed up\n" "debugger start-up times (CDB, LLDB)."); m_ui.labelModule->setToolTip(moduleToolTip); m_ui.lineEditModule->setToolTip(moduleToolTip); const QString commandToolTip = tr("Debugger command to be executed when the breakpoint is hit.\n" "GDB allows for specifying a sequence of commands separated by " "the delimiter '\\n'."); m_ui.lineEditCommand->setToolTip(commandToolTip); m_ui.labelCommand->setToolTip(commandToolTip); m_ui.spinBoxIgnoreCount->setMinimum(0); m_ui.spinBoxIgnoreCount->setMaximum(2147483647); const QString pathToolTip = tr("<html><head/><body><p>Determines how the path is specified " "when setting breakpoints:</p><ul>" "<li><i>Use Engine Default</i>: Preferred setting of the " "debugger engine.</li>" "<li><i>Use Full Path</i>: Pass full path, avoiding ambiguities " "should files of the same name exist in several modules. " "This is the engine default for CDB and LLDB.</li>" "<li><i>Use File Name</i>: Pass the file name only. This is " "useful when using a source tree whose location does " "not match the one used when building the modules. " "It is the engine default for GDB as using full paths can " "be slow with this engine.</li>" "</ul></body></html>"); m_ui.labelUseFullPath->setToolTip(pathToolTip); m_ui.comboBoxPathUsage->setToolTip(pathToolTip); }
bool PdbEngine::acceptsBreakpoint(BreakpointModelId id) const { const QString fileName = breakHandler()->fileName(id); return fileName.endsWith(QLatin1String(".py")); }