From c29a2429b92f12960d025d5e01b5be6e5dff8700 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 11 Feb 2009 19:41:01 +0100 Subject: [PATCH 01/32] Fixes: Play nice with the NSIS installer, accept the Installer hints under a group name, too. --- src/plugins/qt4projectmanager/qtversionmanager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 780de4ebc65..f79cc4b5964 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -241,12 +241,17 @@ void QtVersionManager::addNewVersionsFromInstaller() // or NewQtVersions="qt 4.3.2=c:\\qt\\qt432=c:\\qtcreator\\mingw\\=prependToPath; // Duplicate entries are not added, the first new version is set as default. QSettings *settings = Core::ICore::instance()->settings(); - if (!settings->contains(newQtVersionsKey)) + + if (!settings->contains(newQtVersionsKey) && + !settings->contains(QLatin1String("Installer/")+newQtVersionsKey)) return; // qDebug()<<"QtVersionManager::addNewVersionsFromInstaller()"; QString newVersionsValue = settings->value(newQtVersionsKey).toString(); + if (newVersionsValue.isEmpty()) + newVersionsValue = settings->value(QLatin1String("Installer/")+newQtVersionsKey).toString(); + QStringList newVersionsList = newVersionsValue.split(';', QString::SkipEmptyParts); bool defaultVersionWasReset = false; foreach (QString newVersion, newVersionsList) { @@ -281,6 +286,7 @@ void QtVersionManager::addNewVersionsFromInstaller() } } settings->remove(newQtVersionsKey); + settings->remove(QLatin1String("Installer/")+newQtVersionsKey); updateUniqueIdToIndexMap(); } From dd97e034c6cbe3dca2ca2d5c63b93753363d6d42 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 12 Feb 2009 08:22:39 +0100 Subject: [PATCH 02/32] Fixes: debuger: don't try to build cdbengine as long as it does not compile --- src/plugins/debugger/debugger.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index b3fd6257e1f..a87cf96ca32 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -84,7 +84,7 @@ HEADERS += $$PWD/modeltest.h DEFINES += USE_MODEL_TEST=1 } -win32 { +false { HEADERS += \ cdbdebugengine.h \ From d5dc6d10d76dafd7eb73c99938339317a9af0136 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 12 Feb 2009 09:55:59 +0100 Subject: [PATCH 03/32] Fixes: debugger: introduce early break after application initialization --- src/plugins/debugger/debuggermanager.cpp | 6 -- src/plugins/debugger/gdbengine.cpp | 106 ++++++++++++++++++++--- src/plugins/debugger/gdbengine.h | 3 + 3 files changed, 97 insertions(+), 18 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 423321fc7ba..60e91697b79 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -543,12 +543,6 @@ void DebuggerManager::notifyStartupFinished() { setStatus(DebuggerProcessReady); showStatusMessage(tr("Startup finished. Debugger ready."), -1); - if (m_startMode == attachExternal) { - // we continue the execution - engine()->continueInferior(); - } else { - engine()->runInferior(); - } } void DebuggerManager::notifyInferiorStopped() diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index f6413db72f9..051c0f78fbf 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -100,6 +100,9 @@ enum GdbCommandType GdbQuerySources, GdbAsyncOutput2, GdbExecRun, + GdbExecStart1, + GdbExecStart2, + GdbExecStart3, GdbExecRunToFunction, GdbExecStep, GdbExecNext, @@ -635,6 +638,7 @@ void GdbEngine::maybeHandleInferiorPidChanged(const QString &pid0) } if (pid == q->m_attachedPID) return; + //qDebug() << "FOUND PID " << pid; q->m_attachedPID = pid; qq->notifyInferiorPidChanged(pid); } @@ -686,8 +690,8 @@ void GdbEngine::sendCommand(const QString &command, int type, //qDebug() << qPrintable(currentTime()) << "RUNNING" << cmd.command; m_gdbProc.write(cmd.command.toLatin1() + "\r\n"); //emit gdbInputAvailable(QString(), " " + currentTime()); - emit gdbInputAvailable(QString(), "[" + currentTime() + "] " + cmd.command); - //emit gdbInputAvailable(QString(), cmd.command); + //emit gdbInputAvailable(QString(), "[" + currentTime() + "] " + cmd.command); + emit gdbInputAvailable(QString(), cmd.command); } if (temporarilyStopped) @@ -753,9 +757,18 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type, case GdbExecContinue: case GdbExecFinish: // evil code sharing - case GdbExecRun: handleExecRun(record); break; + + case GdbExecStart1: + handleExecStart1(record); + break; + case GdbExecStart2: + handleExecStart2(record); + break; + case GdbExecStart3: + handleExecStart3(record); + break; case GdbInfoProc: handleInfoProc(record); break; @@ -1134,6 +1147,34 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) const QString reason = data.findChild("reason").data(); QString console = data.findChild("consolestreamoutput").data(); + if (reason.isEmpty()) { + GdbMi frame = data.findChild("frame"); + if (frame.findChild("func").data() == "_start") { + // that's the "early stop" + frame.findChild("func").data() + '%'; + #if defined(Q_OS_WIN) + sendCommand("info proc", GdbInfoProc); + #endif + #if defined(Q_OS_LINUX) + sendCommand("info proc", GdbInfoProc); + #endif + #if defined(Q_OS_MAC) + sendCommand("info pid", GdbInfoProc, QVariant(), true); + #endif + sendCommand("-file-list-exec-source-files", GdbQuerySources); + sendCommand("set auto-solib-add on"); + sendCommand("sharedlibrary libc"); // for malloc + sendCommand("sharedlibrary libdl"); // for dlopen + tryLoadCustomDumpers(); + sendCommand("info shared", ModulesList, QVariant()); + // this will "continue" if done + attemptBreakpointSynchronization(); + return; + } + // fall through + } + +#if 0 if (console.contains("Stopped due to shared library event") || reason.isEmpty()) { ++m_shared; //if (m_shared == 2) @@ -1162,6 +1203,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) } return; } +#endif if (isExitedReason(reason)) { qq->notifyInferiorExited(); @@ -1218,7 +1260,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) if (reason == "breakpoint-hit") { q->showStatusMessage(tr("Stopped at breakpoint")); GdbMi frame = data.findChild("frame"); - //qDebug() << frame.toString(); + qDebug() << "HIT BREAKPOINT: " << frame.toString(); m_currentFrame = frame.findChild("addr").data() + '%' + frame.findChild("func").data() + '%'; @@ -1604,16 +1646,27 @@ bool GdbEngine::startDebugger() } } + if (q->startMode() == q->startInternal) { + sendCommand("-file-exec-and-symbols " + fileName, GdbFileExecAndSymbols); + //sendCommand("file " + fileName, GdbFileExecAndSymbols); + #ifdef Q_OS_MAC + sendCommand("sharedlibrary apply-load-rules all"); + #endif + //sendCommand("-gdb-set stop-on-solib-events 1"); + runInferior(); + } + if (q->startMode() == q->attachExternal) { sendCommand("attach " + QString::number(q->m_attachedPID)); } - if (q->startMode() == q->startInternal || q->startMode() == q->startExternal) { - sendCommand("-file-exec-and-symbols " + fileName, GdbFileExecAndSymbols); + if (q->startMode() == q->startExternal) { + //sendCommand("-file-exec-and-symbols " + fileName, GdbFileExecAndSymbols); + sendCommand("file " + fileName, GdbFileExecAndSymbols); #ifdef Q_OS_MAC sendCommand("sharedlibrary apply-load-rules all"); #endif - sendCommand("-file-list-exec-source-files", GdbQuerySources); + //sendCommand("-file-list-exec-source-files", GdbQuerySources); //sendCommand("-gdb-set stop-on-solib-events 1"); } @@ -1625,7 +1678,7 @@ bool GdbEngine::startDebugger() else qq->breakHandler()->setAllPending(); - QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization())); + //QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization())); return true; } @@ -1648,7 +1701,33 @@ void GdbEngine::runInferior() sendCommand("-exec-arguments " + q->m_processArgs.join(" ")); qq->notifyInferiorRunningRequested(); emit gdbInputAvailable(QString(), QString()); - sendCommand("-exec-run", GdbExecRun); + + sendCommand("set auto-solib-add off"); + sendCommand("x/2i _start", GdbExecStart1); +} + +void GdbEngine::handleExecStart1(const GdbResultRecord &response) +{ + if (response.resultClass == GdbResultDone) { + // stdout:&"x/2i _start\n" + // stdout:~"0x404540 <_start>:\txor %ebp,%ebp\n" + // stdout:~"0x404542 <_start+2>:\tmov %rdx,%r9\n" + QString msg = response.data.findChild("consolestreamoutput").data(); + QRegExp needle("0x([0-9a-f]+) <_start\\+.*>:"); + if (needle.indexIn(msg) != -1) { + //qDebug() << "STREAM: " << msg << needle.cap(1); + sendCommand("tbreak *0x" + needle.cap(1)); // GdbExecStart3); + sendCommand("-exec-run"); // GdbExecStart3); + } else { + qDebug() << "PARSING START ADDRESS FAILED" << msg; + } + } else if (response.resultClass == GdbResultError) { + qDebug() << "PARSING START ADDRESS FAILED" << response.toString(); + } +} + +void GdbEngine::handleExecStart3(const GdbResultRecord &response) +{ #if defined(Q_OS_WIN) sendCommand("info proc", GdbInfoProc); #endif @@ -1658,6 +1737,7 @@ void GdbEngine::runInferior() #if defined(Q_OS_MAC) sendCommand("info pid", GdbInfoProc, QVariant(), true); #endif + attemptBreakpointSynchronization(); } void GdbEngine::stepExec() @@ -2183,8 +2263,10 @@ void GdbEngine::attemptBreakpointSynchronization() //sendListBreakpoints(); } - if (!updateNeeded && q->status() == DebuggerProcessStartingUp) - qq->notifyStartupFinished(); + if (!updateNeeded && q->status() == DebuggerProcessStartingUp) { + // we continue the execution + continueInferior(); + } } @@ -3603,7 +3685,7 @@ void GdbEngine::updateLocals() // '2' is 'list with type and value' sendSynchronizedCommand("-stack-list-locals 2", StackListLocals); // stage 2/2 - tryLoadCustomDumpers(); + //tryLoadCustomDumpers(); } void GdbEngine::handleStackListArguments(const GdbResultRecord &record) diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index a603aee375d..14cb65d7cdf 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -185,6 +185,9 @@ private: void handleResultRecord(const GdbResultRecord &response); void handleFileExecAndSymbols(const GdbResultRecord &response); void handleExecRun(const GdbResultRecord &response); + void handleExecStart1(const GdbResultRecord &response); + void handleExecStart2(const GdbResultRecord &response); + void handleExecStart3(const GdbResultRecord &response); void handleExecJumpToLine(const GdbResultRecord &response); void handleExecRunToFunction(const GdbResultRecord &response); void handleInfoShared(const GdbResultRecord &response); From 68e856488b6feeb5346b33d833ee8968ef7bff35 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 12 Feb 2009 10:46:26 +0100 Subject: [PATCH 04/32] More testing. --- .../auto/cplusplus/semantic/tst_semantic.cpp | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/auto/cplusplus/semantic/tst_semantic.cpp b/tests/auto/cplusplus/semantic/tst_semantic.cpp index d2af748cddf..b30fe23c880 100644 --- a/tests/auto/cplusplus/semantic/tst_semantic.cpp +++ b/tests/auto/cplusplus/semantic/tst_semantic.cpp @@ -99,6 +99,7 @@ private slots: void typedef_2(); void typedef_3(); void const_1(); + void const_2(); }; void tst_Semantic::function_declaration_1() @@ -323,7 +324,7 @@ void tst_Semantic::typedef_3() void tst_Semantic::const_1() { QSharedPointer doc = document("\n" -"int foo(const void *s);\n" +"int foo(const int *s);\n" ); QCOMPARE(doc->errorCount, 0U); @@ -340,7 +341,30 @@ void tst_Semantic::const_1() QVERIFY(! arg->type().isConst()); QVERIFY(arg->type()->isPointerType()); QVERIFY(arg->type()->asPointerType()->elementType().isConst()); - QVERIFY(arg->type()->asPointerType()->elementType()->isVoidType()); + QVERIFY(arg->type()->asPointerType()->elementType()->isIntegerType()); +} + +void tst_Semantic::const_2() +{ + QSharedPointer doc = document("\n" +"int foo(char * const s);\n" + ); + + QCOMPARE(doc->errorCount, 0U); + QCOMPARE(doc->globals->symbolCount(), 1U); + + Declaration *decl = doc->globals->symbolAt(0)->asDeclaration(); + QVERIFY(decl); + QVERIFY(decl->type()->isFunctionType()); + Function *funTy = decl->type()->asFunctionType(); + QVERIFY(funTy->returnType()->isIntegerType()); + QCOMPARE(funTy->argumentCount(), 1U); + Argument *arg = funTy->argumentAt(0)->asArgument(); + QVERIFY(arg); + QVERIFY(arg->type().isConst()); + QVERIFY(arg->type()->isPointerType()); + QVERIFY(! arg->type()->asPointerType()->elementType().isConst()); + QVERIFY(arg->type()->asPointerType()->elementType()->isIntegerType()); } QTEST_APPLESS_MAIN(tst_Semantic) From 4839cc9392c919da8623a3668e04d8770a831967 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 12 Feb 2009 11:18:38 +0100 Subject: [PATCH 05/32] Fixes: debugger: work on more fine-grained breakpoints-in-plugins setting --- src/plugins/debugger/debuggermanager.h | 5 + src/plugins/debugger/debuggerplugin.cpp | 52 ++++++++--- src/plugins/debugger/gdbengine.cpp | 4 +- src/plugins/debugger/gdbengine.h | 1 - src/plugins/debugger/gdboptionpage.ui | 119 +++++++++++++++--------- 5 files changed, 122 insertions(+), 59 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 1c12a731643..a43feb7e96c 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -200,6 +200,11 @@ public: bool m_useToolTips; QString m_scriptFile; + + bool m_pluginAllBreakpoints; + bool m_pluginSelectedBreakpoints; + bool m_pluginNoBreakpoints; + QString m_pluginSelectedBreakpointsPattern; }; // diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index b8bffaa14eb..aa3fca911f6 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -274,15 +274,24 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File")); m_ui.scriptFileChooser->setPath(m_settings.m_scriptFile); m_ui.environmentEdit->setText(m_settings.m_gdbEnv); - m_ui.autoStartBox->setChecked(m_settings.m_autoRun); - m_ui.autoQuitBox->setChecked(m_settings.m_autoQuit); + + m_ui.radioButtonAllPluginBreakpoints-> + setChecked(m_settings.m_pluginAllBreakpoints); + m_ui.radioButtonSelectedPluginBreakpoints-> + setChecked(m_settings.m_pluginSelectedBreakpoints); + m_ui.radioButtonNoPluginBreakpoints-> + setChecked(m_settings.m_pluginNoBreakpoints); + m_ui.lineEditSelectedPluginBreakpointsPattern-> + setEnabled(m_settings.m_pluginSelectedBreakpoints); m_ui.checkBoxSkipKnownFrames->setChecked(m_settings.m_skipKnownFrames); m_ui.checkBoxDebugDumpers->setChecked(m_settings.m_debugDumpers); m_ui.checkBoxUseCustomDumpers->setChecked(m_settings.m_useCustomDumpers); - m_ui.checkBoxFastStart->setChecked(m_settings.m_useFastStart); m_ui.checkBoxUseToolTips->setChecked(m_settings.m_useToolTips); + connect(m_ui.radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)), + m_ui.lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool))); + #ifndef QT_DEBUG #if 0 cmd = am->registerAction(m_manager->m_dumpLogAction, @@ -294,14 +303,9 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) #endif // FIXME - m_ui.autoStartBox->hide(); - m_ui.autoQuitBox->hide(); m_ui.environmentEdit->hide(); m_ui.labelEnvironment->hide(); - m_ui.checkBoxFastStart->setChecked(false); - m_ui.checkBoxFastStart->hide(); - //m_dumpLogAction = new QAction(this); //m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes")); // @@ -315,16 +319,23 @@ void GdbOptionPage::apply() { m_settings.m_gdbCmd = m_ui.gdbLocationChooser->path(); m_settings.m_gdbEnv = m_ui.environmentEdit->text(); - m_settings.m_autoRun = m_ui.autoStartBox->isChecked(); - m_settings.m_autoQuit = m_ui.autoQuitBox->isChecked(); m_settings.m_scriptFile = m_ui.scriptFileChooser->path(); m_settings.m_skipKnownFrames = m_ui.checkBoxSkipKnownFrames->isChecked(); m_settings.m_debugDumpers = m_ui.checkBoxDebugDumpers->isChecked(); m_settings.m_useCustomDumpers = m_ui.checkBoxUseCustomDumpers->isChecked(); - m_settings.m_useFastStart = m_ui.checkBoxFastStart->isChecked(); m_settings.m_useToolTips = m_ui.checkBoxUseToolTips->isChecked(); + m_settings.m_pluginAllBreakpoints = + m_ui.radioButtonAllPluginBreakpoints->isChecked(); + m_settings.m_pluginSelectedBreakpoints = + m_ui.radioButtonSelectedPluginBreakpoints->isChecked(); + m_settings.m_pluginNoBreakpoints = + m_ui.radioButtonNoPluginBreakpoints->isChecked(); + m_settings.m_pluginSelectedBreakpointsPattern = + m_ui.lineEditSelectedPluginBreakpointsPattern->text(); + + *m_plugin->m_manager->settings() = m_settings; m_plugin->writeSettings(); } @@ -889,11 +900,16 @@ void DebuggerPlugin::writeSettings() const s->setValue("AutoRun", m->m_autoRun); s->setValue("AutoQuit", m->m_autoQuit); - s->setValue("UseFastStart", m->m_useFastStart); s->setValue("UseToolTips", m->m_useToolTips); s->setValue("UseCustomDumpers", m->m_useCustomDumpers); s->setValue("SkipKnowFrames", m->m_skipKnownFrames); s->setValue("DebugDumpers", m->m_debugDumpers); + + s->setValue("AllPluginBreakpoints", m->m_pluginAllBreakpoints); + s->setValue("SelectedPluginBreakpoints", m->m_pluginSelectedBreakpoints); + s->setValue("NoPluginBreakpoints", m->m_pluginNoBreakpoints); + s->setValue("SelectedPluginBreakpointsPattern", m->m_pluginSelectedBreakpointsPattern); + s->endGroup(); } @@ -911,6 +927,7 @@ void DebuggerPlugin::readSettings() QString defaultScript; s->beginGroup(QLatin1String("DebugMode")); + QByteArray ba = s->value("State", QByteArray()).toByteArray(); m_toggleLockedAction->setChecked(s->value("Locked", true).toBool()); m->m_gdbCmd = s->value("Location", defaultCommand).toString(); @@ -922,8 +939,17 @@ void DebuggerPlugin::readSettings() m->m_skipKnownFrames = s->value("SkipKnownFrames", false).toBool(); m->m_debugDumpers = s->value("DebugDumpers", false).toBool(); m->m_useCustomDumpers = s->value("UseCustomDumpers", true).toBool(); - m->m_useFastStart = s->value("UseFastStart", false).toBool(); m->m_useToolTips = s->value("UseToolTips", false).toBool(); + + m->m_pluginAllBreakpoints = + s->value("AllPluginBreakpoints", false).toBool(); + m->m_pluginSelectedBreakpoints = + s->value("SelectedPluginBreakpoints", false).toBool(); + m->m_pluginNoBreakpoints = + s->value("NoPluginBreakpoints", true).toBool(); + m->m_pluginSelectedBreakpointsPattern = + s->value("SelectedPluginBreakpointsPattern").toString(); + s->endGroup(); m_manager->mainWindow()->restoreState(ba); diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 051c0f78fbf..97bca9381fb 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -764,7 +764,7 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type, handleExecStart1(record); break; case GdbExecStart2: - handleExecStart2(record); + //handleExecStart2(record); break; case GdbExecStart3: handleExecStart3(record); @@ -1726,7 +1726,7 @@ void GdbEngine::handleExecStart1(const GdbResultRecord &response) } } -void GdbEngine::handleExecStart3(const GdbResultRecord &response) +void GdbEngine::handleExecStart3(const GdbResultRecord &) { #if defined(Q_OS_WIN) sendCommand("info proc", GdbInfoProc); diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index 14cb65d7cdf..fbb56a1b4d5 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -186,7 +186,6 @@ private: void handleFileExecAndSymbols(const GdbResultRecord &response); void handleExecRun(const GdbResultRecord &response); void handleExecStart1(const GdbResultRecord &response); - void handleExecStart2(const GdbResultRecord &response); void handleExecStart3(const GdbResultRecord &response); void handleExecJumpToLine(const GdbResultRecord &response); void handleExecRunToFunction(const GdbResultRecord &response); diff --git a/src/plugins/debugger/gdboptionpage.ui b/src/plugins/debugger/gdboptionpage.ui index ef485ccbf83..e6c46c9bc3a 100644 --- a/src/plugins/debugger/gdboptionpage.ui +++ b/src/plugins/debugger/gdboptionpage.ui @@ -6,22 +6,16 @@ 0 0 - 465 - 372 + 398 + 385 Form - - - 6 - - - 9 - - - + + + Locations @@ -74,7 +68,70 @@ - + + + + Behaviour of breakpoint setting in plugins + + + + + + This is the slowest but safest option. + + + Try to set breakpoints in plugins always automatically. + + + + + + + Try to set breakpoints in selected plugins + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 10 + 10 + + + + + + + + Matching regular expression: + + + + + + + + + + + + Never set breakpoints in plugins automatically + + + + + + + Checking this will make the debugger try to use code to format certain data (QObject, QString, std::string etc.) nicely. @@ -84,17 +141,7 @@ - - - - Checking this will make the debugger start fast by loading only very few debug symbols on start up. This might lead to situations where breakpoints can not be set properly. So uncheck this option if you experience breakpoint related problems. - - - Fast debugger start - - - - + When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic @@ -105,7 +152,7 @@ - + Checking this will make enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default. @@ -115,7 +162,7 @@ - + This is an internal tool to make debugging the Custom Data Dumper code easier. Using this action is in general not needed unless you want do debug Qt Creator itself. @@ -125,29 +172,15 @@ - - - - Auto run executable on debugger startup - - - - - - - Quit debugger when the executable exits - - - - - + + Qt::Vertical - 415 - 41 + 10 + 1 From 8b9dd766c822a9f7b929ae14eab3e2e402307c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Thu, 12 Feb 2009 11:41:52 +0100 Subject: [PATCH 06/32] More intelligent function argument widget Now it shows immediately when there is only a single signature of a given method/constructor. --- src/plugins/cpptools/cppcodecompletion.cpp | 63 ++++++++++------------ src/plugins/cpptools/cppcodecompletion.h | 5 +- 2 files changed, 29 insertions(+), 39 deletions(-) diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index f9ea3b0bbe9..ca1ef24bd4e 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -518,7 +518,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) if (exprTy->isReferenceType()) exprTy = exprTy->asReferenceType()->elementType(); - if (m_completionOperator == T_LPAREN && completeFunction(exprTy, resolvedTypes, context)) { + if (m_completionOperator == T_LPAREN && completeConstructorOrFunction(exprTy, resolvedTypes)) { return m_startPosition; } else if ((m_completionOperator == T_DOT || m_completionOperator == T_ARROW) && completeMember(resolvedTypes, context)) { @@ -551,7 +551,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) foreach (const TypeOfExpression::Result &result, results) { if (result.first->isClassType()) { FullySpecifiedType exprTy = result.first; - if (completeConstructors(exprTy->asClassType())) + if (completeConstructorOrFunction(exprTy, QList())) return m_startPosition; break; } @@ -563,18 +563,29 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) return -1; } -bool CppCodeCompletion::completeFunction(FullySpecifiedType exprTy, - const QList &resolvedTypes, - const LookupContext &) +bool CppCodeCompletion::completeConstructorOrFunction(FullySpecifiedType exprTy, + const QList &resolvedTypes) { - if (Class *klass = exprTy->asClassType()) { - completeConstructors(klass); - } else { - ConvertToCompletionItem toCompletionItem(this); - Overview o; - o.setShowReturnTypes(true); - o.setShowArgumentNames(true); + ConvertToCompletionItem toCompletionItem(this); + Overview o; + o.setShowReturnTypes(true); + o.setShowArgumentNames(true); + if (Class *klass = exprTy->asClassType()) { + for (unsigned i = 0; i < klass->memberCount(); ++i) { + Symbol *member = klass->memberAt(i); + if (! member->type()->isFunctionType()) + continue; + else if (! member->identity()) + continue; + else if (! member->identity()->isEqualTo(klass->identity())) + continue; + if (TextEditor::CompletionItem item = toCompletionItem(member)) { + item.m_text = o(member->type(), member->name()); + m_completions.append(item); + } + } + } else { QSet signatures; foreach (TypeOfExpression::Result p, resolvedTypes) { FullySpecifiedType ty = p.first; @@ -594,6 +605,10 @@ bool CppCodeCompletion::completeFunction(FullySpecifiedType exprTy, } } + // If there is only one item, show the function argument widget immediately + if (m_completions.size() == 1) + complete(m_completions.takeFirst()); + return ! m_completions.isEmpty(); } @@ -887,30 +902,6 @@ void CppCodeCompletion::completeClass(const QList &candidates, } } -bool CppCodeCompletion::completeConstructors(Class *klass) -{ - ConvertToCompletionItem toCompletionItem(this); - Overview o; - o.setShowReturnTypes(true); - o.setShowArgumentNames(true); - - for (unsigned i = 0; i < klass->memberCount(); ++i) { - Symbol *member = klass->memberAt(i); - if (! member->type()->isFunctionType()) - continue; - else if (! member->identity()) - continue; - else if (! member->identity()->isEqualTo(klass->identity())) - continue; - if (TextEditor::CompletionItem item = toCompletionItem(member)) { - item.m_text = o(member->type(), member->name()); - m_completions.append(item); - } - } - - return ! m_completions.isEmpty(); -} - bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType, const QList &results, const LookupContext &context, diff --git a/src/plugins/cpptools/cppcodecompletion.h b/src/plugins/cpptools/cppcodecompletion.h index 02bcdc0f524..79f580236f9 100644 --- a/src/plugins/cpptools/cppcodecompletion.h +++ b/src/plugins/cpptools/cppcodecompletion.h @@ -86,9 +86,8 @@ private: void addMacros(const CPlusPlus::LookupContext &context); void addCompletionItem(CPlusPlus::Symbol *symbol); - bool completeFunction(CPlusPlus::FullySpecifiedType exprTy, - const QList &, - const CPlusPlus::LookupContext &context); + bool completeConstructorOrFunction(CPlusPlus::FullySpecifiedType exprTy, + const QList &); bool completeMember(const QList &, const CPlusPlus::LookupContext &context); From 113723bb0e5045d6551913b06646e95790d7ffbb Mon Sep 17 00:00:00 2001 From: dt Date: Thu, 12 Feb 2009 12:39:19 +0100 Subject: [PATCH 07/32] Fixes: Don't crash if we don't get any toolchain. Details: Stupid me. --- src/plugins/qt4projectmanager/qt4project.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 6a27c484b80..05be102b81c 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -457,8 +457,12 @@ void Qt4Project::updateCodeModel() const QString newQtLibsPath = versionInfo.value(QLatin1String("QT_INSTALL_LIBS")); ToolChain *tc = toolChain(activeBuildConfiguration()); - QByteArray predefinedMacros = tc->predefinedMacros(); - QList allHeaderPaths = tc->systemHeaderPaths(); + QByteArray predefinedMacros; + QList allHeaderPaths; + if (tc) { + predefinedMacros = tc->predefinedMacros(); + allHeaderPaths = tc->systemHeaderPaths(); + } foreach (HeaderPath headerPath, allHeaderPaths) { if (headerPath.kind() == HeaderPath::FrameworkHeaderPath) allFrameworkPaths.append(headerPath.path()); From 73ff2581c7781c3488c3b36a40205277824e3423 Mon Sep 17 00:00:00 2001 From: dt Date: Thu, 12 Feb 2009 12:44:49 +0100 Subject: [PATCH 08/32] Fixes: Add Linux icc to the supported toolchains. Details: Treat it the same as g++. --- src/plugins/projectexplorer/toolchain.h | 1 + src/plugins/qt4projectmanager/qt4project.cpp | 2 +- src/plugins/qt4projectmanager/qtversionmanager.cpp | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h index 455d480b860..0e7e16c5ffd 100644 --- a/src/plugins/projectexplorer/toolchain.h +++ b/src/plugins/projectexplorer/toolchain.h @@ -40,6 +40,7 @@ public: enum ToolChainType { GCC, + LinuxICC, MinGW, MSVC, WINCE, diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 05be102b81c..492dc2c50d0 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -419,7 +419,7 @@ ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfigurat m_test = ToolChain::createMSVCToolChain(version->msvcVersion()); } else if(t == ToolChain::WINCE) { m_test = ToolChain::createWinCEToolChain(version->msvcVersion(), version->wincePlatform()); - } else if(t == ToolChain::GCC) { + } else if(t == ToolChain::GCC || t == ToolChain::LinuxICC) { QStringList list = rootProjectNode()->variableValue(Internal::CxxCompilerVar); QString qmake_cxx = list.isEmpty() ? QString::null : list.first(); Environment env = Environment::systemEnvironment(); diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 8abc994e919..58f196b3ede 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -1191,6 +1191,8 @@ ProjectExplorer::ToolChain::ToolChainType QtVersion::toolchainType() const return ProjectExplorer::ToolChain::INVALID; else if (spec.startsWith("wince")) return ProjectExplorer::ToolChain::WINCE; + else if (spec.startsWith("linux-icc")) + return ProjectExplorer::ToolChain::LinuxICC; else return ProjectExplorer::ToolChain::GCC; } From 6f64b19ebf8f7859d7266aa283a65485c1b1b782 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 12 Feb 2009 13:04:01 +0100 Subject: [PATCH 09/32] Fixes: debugger: work on plugin breakpoints --- src/plugins/debugger/debuggermanager.cpp | 10 --- src/plugins/debugger/debuggermanager.h | 16 +++- src/plugins/debugger/debuggerplugin.cpp | 2 + src/plugins/debugger/gdbengine.cpp | 98 +++++++++--------------- src/plugins/debugger/gdbengine.h | 1 - 5 files changed, 51 insertions(+), 76 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 60e91697b79..213edee43c4 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -1082,22 +1082,12 @@ bool DebuggerManager::useCustomDumpers() const return m_settings.m_useCustomDumpers; } -bool DebuggerManager::useFastStart() const -{ - return 0; // && m_settings.m_useFastStart; -} - void DebuggerManager::setUseCustomDumpers(bool on) { m_settings.m_useCustomDumpers = on; engine()->setUseCustomDumpers(on); } -void DebuggerManager::setUseFastStart(bool on) -{ - m_settings.m_useFastStart = on; -} - void DebuggerManager::setDebugDumpers(bool on) { m_settings.m_debugDumpers = on; diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index a43feb7e96c..a3407a0aa59 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -170,7 +170,11 @@ private: virtual bool skipKnownFrames() const = 0; virtual bool debugDumpers() const = 0; virtual bool useCustomDumpers() const = 0; - virtual bool useFastStart() const = 0; + + virtual bool wantsAllPluginBreakpoints() const = 0; + virtual bool wantsSelectedPluginBreakpoints() const = 0; + virtual bool wantsNoPluginBreakpoints() const = 0; + virtual QString selectedPluginBreakpointsPattern() const = 0; virtual void reloadDisassembler() = 0; virtual void reloadModules() = 0; @@ -288,7 +292,6 @@ public slots: void setUseCustomDumpers(bool on); void setDebugDumpers(bool on); void setSkipKnownFrames(bool on); - void setUseFastStart(bool on); private slots: void showDebuggerOutput(const QString &prefix, const QString &msg); @@ -323,7 +326,14 @@ private: bool skipKnownFrames() const; bool debugDumpers() const; bool useCustomDumpers() const; - bool useFastStart() const; + bool wantsAllPluginBreakpoints() const + { return m_settings.m_pluginAllBreakpoints; } + bool wantsSelectedPluginBreakpoints() const + { return m_settings.m_pluginSelectedBreakpoints; } + bool wantsNoPluginBreakpoints() const + { return m_settings.m_pluginNoBreakpoints; } + QString selectedPluginBreakpointsPattern() const + { return m_settings.m_pluginSelectedBreakpointsPattern; } void notifyStartupFinished(); void notifyInferiorStopped(); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index aa3fca911f6..18c7e6d0c56 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -281,6 +281,8 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) setChecked(m_settings.m_pluginSelectedBreakpoints); m_ui.radioButtonNoPluginBreakpoints-> setChecked(m_settings.m_pluginNoBreakpoints); + m_ui.lineEditSelectedPluginBreakpointsPattern-> + setText(m_settings.m_pluginSelectedBreakpointsPattern); m_ui.lineEditSelectedPluginBreakpointsPattern-> setEnabled(m_settings.m_pluginSelectedBreakpoints); diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 97bca9381fb..8b4051f839d 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -254,7 +254,6 @@ void GdbEngine::init() { m_pendingRequests = 0; m_gdbVersion = 100; - m_shared = 0; m_outputCodec = QTextCodec::codecForLocale(); m_dataDumperState = DataDumperUninitialized; @@ -988,18 +987,6 @@ void GdbEngine::handleInfoShared(const GdbResultRecord &record) if (record.resultClass == GdbResultDone) { // let the modules handler do the parsing handleModulesList(record); - QList modules = qq->modulesHandler()->modules(); - bool reloadNeeded = false; - foreach (const Module &module, modules) { - // FIXME: read this from some list - if (!module.symbolsRead && !module.moduleName.contains("Q")) { - reloadNeeded = true; - sendCommand("sharedlibrary " + dotEscape(module.moduleName)); - } - } - if (reloadNeeded) - reloadModules(); - continueInferior(); } } @@ -1146,7 +1133,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) { const QString reason = data.findChild("reason").data(); - QString console = data.findChild("consolestreamoutput").data(); + QString msg = data.findChild("consolestreamoutput").data(); if (reason.isEmpty()) { GdbMi frame = data.findChild("frame"); if (frame.findChild("func").data() == "_start") { @@ -1162,11 +1149,27 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) sendCommand("info pid", GdbInfoProc, QVariant(), true); #endif sendCommand("-file-list-exec-source-files", GdbQuerySources); - sendCommand("set auto-solib-add on"); + sendCommand("sharedlibrary libc"); // for malloc sendCommand("sharedlibrary libdl"); // for dlopen tryLoadCustomDumpers(); - sendCommand("info shared", ModulesList, QVariant()); + + // intentionally after tryLoadCustomDumpers(), + // otherwise we'd interupt solib loading. + if (qq->wantsAllPluginBreakpoints()) { + sendCommand("set auto-solib-add on"); + sendCommand("set stop-on-solib-events 0"); + sendCommand("sharedlibrary .*"); + } else if (qq->wantsSelectedPluginBreakpoints()) { + sendCommand("set auto-solib-add on"); + sendCommand("set stop-on-solib-events 1"); + sendCommand("sharedlibrary "+qq->selectedPluginBreakpointsPattern()); + } else if (qq->wantsNoPluginBreakpoints()) { + // should be like that already + sendCommand("set auto-solib-add off"); + sendCommand("set stop-on-solib-events 0"); + } + reloadModules(); // this will "continue" if done attemptBreakpointSynchronization(); return; @@ -1174,36 +1177,19 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) // fall through } -#if 0 - if (console.contains("Stopped due to shared library event") || reason.isEmpty()) { - ++m_shared; - //if (m_shared == 2) - // tryLoadCustomDumpers(); - //qDebug() << "SHARED LIBRARY EVENT " << data.toString() << m_shared; - if (qq->useFastStart()) { - if (1 || m_shared <= 16) { // libpthread? - sendCommand("info shared", GdbInfoShared); - //sendCommand("sharedlibrary gdbdebugger "); - //continueInferior(); - } else { - // auto-load from now on - sendCommand("info shared"); - sendCommand("set auto-solib-add on"); - sendCommand("-file-list-exec-source-files", GdbQuerySources); - sendCommand("-break-list", BreakList); - //sendCommand("bt"); - //QVariant var = QVariant::fromValue(data); - //sendCommand("p 1", GdbAsyncOutput2, var); // dummy - continueInferior(); - } - } else { - // slow start requested. - q->showStatusMessage(tr("Loading %1...").arg(QString(data.toString()))); + static bool modulesDirty = false; + if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) { + if (qq->wantsSelectedPluginBreakpoints()) { + qDebug() << "SHARED LIBRARY EVENT " << data.toString(); + qDebug() << "PATTERN" << qq->selectedPluginBreakpointsPattern(); + sendCommand("sharedlibrary " + qq->selectedPluginBreakpointsPattern()); continueInferior(); + q->showStatusMessage(tr("Loading %1...").arg(QString(data.toString()))); + return; } - return; + modulesDirty = true; + // fall through } -#endif if (isExitedReason(reason)) { qq->notifyInferiorExited(); @@ -1256,11 +1242,17 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) } if (isStoppedReason(reason) || reason.isEmpty()) { + if (modulesDirty) { + sendCommand("-file-list-exec-source-files", GdbQuerySources); + sendCommand("-break-list", BreakList); + reloadModules(); + modulesDirty = false; + } // Need another round trip if (reason == "breakpoint-hit") { q->showStatusMessage(tr("Stopped at breakpoint")); GdbMi frame = data.findChild("frame"); - qDebug() << "HIT BREAKPOINT: " << frame.toString(); + //qDebug() << "HIT BREAKPOINT: " << frame.toString(); m_currentFrame = frame.findChild("addr").data() + '%' + frame.findChild("func").data() + '%'; @@ -1504,7 +1496,6 @@ void GdbEngine::exitDebugger() m_fullToShortName.clear(); m_varToType.clear(); m_dataDumperState = DataDumperUninitialized; - m_shared = 0; m_outputCollector.shutdown(); //q->settings()->m_debugDumpers = false; } @@ -1572,12 +1563,7 @@ bool GdbEngine::startDebugger() q->showStatusMessage(tr("Gdb Running")); sendCommand("show version", GdbShowVersion); - if (qq->useFastStart()) { - sendCommand("set auto-solib-add off"); - sendCommand("set stop-on-solib-events 1"); - } //sendCommand("-enable-timings"); - //sendCommand("set stop-on-solib-events 1"); sendCommand("set print static-members off"); // Seemingly doesn't work. //sendCommand("define hook-stop\n-thread-list-ids\n-stack-list-frames\nend"); //sendCommand("define hook-stop\nprint 4\nend"); @@ -4044,8 +4030,6 @@ void GdbEngine::tryLoadCustomDumpers() QString lib = q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.so"; if (QFileInfo(lib).isExecutable()) { //sendCommand("p dlopen"); - //if (qq->useFastStart()) - // sendCommand("set stop-on-solib-events 0"); QString flag = QString::number(RTLD_NOW); sendSynchronizedCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", WatchDumpCustomSetup); @@ -4053,8 +4037,6 @@ void GdbEngine::tryLoadCustomDumpers() sendSynchronizedCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")", WatchDumpCustomSetup); sendSynchronizedCommand("sharedlibrary " + dotEscape(lib)); - //if (qq->useFastStart()) - // sendCommand("set stop-on-solib-events 1"); } else { qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: " << lib << QFileInfo(lib).isExecutable(); @@ -4064,14 +4046,10 @@ void GdbEngine::tryLoadCustomDumpers() QString lib = q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.dylib"; if (QFileInfo(lib).isExecutable()) { //sendCommand("p dlopen"); // FIXME: remove me - //if (qq->useFastStart()) - // sendCommand("set stop-on-solib-events 0"); QString flag = QString::number(RTLD_NOW); sendSynchronizedCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", WatchDumpCustomSetup); sendSynchronizedCommand("sharedlibrary " + dotEscape(lib)); - //if (qq->useFastStart()) - // sendCommand("set stop-on-solib-events 1"); } else { qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: " << lib << QFileInfo(lib).isExecutable(); @@ -4080,15 +4058,11 @@ void GdbEngine::tryLoadCustomDumpers() #if defined(Q_OS_WIN) QString lib = q->m_buildDir + "/qtc-gdbmacros/debug/gdbmacros.dll"; if (QFileInfo(lib).exists()) { - //if (qq->useFastStart()) - // sendCommand("set stop-on-solib-events 0"); //sendCommand("handle SIGSEGV pass stop print"); //sendCommand("set unwindonsignal off"); sendSynchronizedCommand("call LoadLibraryA(\"" + lib + "\")", WatchDumpCustomSetup); sendSynchronizedCommand("sharedlibrary " + dotEscape(lib)); - //if (qq->useFastStart()) - // sendCommand("set stop-on-solib-events 1"); } else { qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: " << lib << QFileInfo(lib).isExecutable(); diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index fbb56a1b4d5..7973ef4c681 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -217,7 +217,6 @@ private: int m_oldestAcceptableToken; int m_gdbVersion; // 6.8.0 is 680 - int m_shared; // awful hack to keep track of used files QHash m_shortToFullName; From dee68a29c10542afc619f871b0a8788bea170b66 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 12 Feb 2009 13:31:19 +0100 Subject: [PATCH 10/32] Fixes: debugger: work on breakpoints in plugins --- src/plugins/debugger/debuggermanager.cpp | 4 +- src/plugins/debugger/debuggerplugin.cpp | 1 - src/plugins/debugger/gdbengine.cpp | 166 +++++------------------ src/plugins/debugger/gdbengine.h | 5 +- src/plugins/debugger/idebuggerengine.h | 1 - 5 files changed, 36 insertions(+), 141 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 213edee43c4..53eac322e45 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -561,7 +561,7 @@ void DebuggerManager::notifyInferiorUpdateFinished() void DebuggerManager::notifyInferiorRunningRequested() { setStatus(DebuggerInferiorRunningRequested); - showStatusMessage(tr("Running..."), 5000); + showStatusMessage(tr("Running requested..."), 5000); } void DebuggerManager::notifyInferiorRunning() @@ -579,7 +579,7 @@ void DebuggerManager::notifyInferiorExited() void DebuggerManager::notifyInferiorPidChanged(int pid) { //QMessageBox::warning(0, "PID", "PID: " + QString::number(pid)); - //qDebug() << "PID: " << pid; + qDebug() << "PID: " << pid; emit inferiorPidChanged(pid); } diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 18c7e6d0c56..d3e61c79c29 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -337,7 +337,6 @@ void GdbOptionPage::apply() m_settings.m_pluginSelectedBreakpointsPattern = m_ui.lineEditSelectedPluginBreakpointsPattern->text(); - *m_plugin->m_manager->settings() = m_settings; m_plugin->writeSettings(); } diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 8b4051f839d..9f0a3b3ace1 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -99,10 +99,8 @@ enum GdbCommandType GdbQueryPwd, GdbQuerySources, GdbAsyncOutput2, + GdbStart, GdbExecRun, - GdbExecStart1, - GdbExecStart2, - GdbExecStart3, GdbExecRunToFunction, GdbExecStep, GdbExecNext, @@ -460,13 +458,28 @@ void GdbEngine::handleResponse() break; } - case '~': - case '@': + case '~': { + QString data = GdbMi::parseCString(from, to); + m_pendingConsoleStreamOutput += data; + m_inbuffer = QByteArray(from, to - from); + break; + } + + case '@': { + QString data = GdbMi::parseCString(from, to); + m_pendingTargetStreamOutput += data; + m_inbuffer = QByteArray(from, to - from); + break; + } + case '&': { QString data = GdbMi::parseCString(from, to); - handleStreamOutput(data, c); - //dump(oldfrom, from, record.toString()); + m_pendingLogStreamOutput += data; m_inbuffer = QByteArray(from, to - from); + // On Windows, the contents seem to depend on the debugger + // version and/or OS version used. + if (data.startsWith("warning:")) + qq->showApplicationOutput(data); break; } @@ -759,14 +772,8 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type, handleExecRun(record); break; - case GdbExecStart1: - handleExecStart1(record); - break; - case GdbExecStart2: - //handleExecStart2(record); - break; - case GdbExecStart3: - handleExecStart3(record); + case GdbStart: + handleStart(record); break; case GdbInfoProc: handleInfoProc(record); @@ -1028,84 +1035,6 @@ void GdbEngine::handleExecRunToFunction(const GdbResultRecord &record) q->gotoLocation(file, line, true); } -void GdbEngine::handleStreamOutput(const QString &data, char code) -{ - // Linux - if (data.contains("[New Thread")) { - QRegExp re("\\[New Thread 0x([0-9a-f]*) \\(LWP ([0-9]*)\\)\\]"); - if (re.indexIn(data) != -1) - maybeHandleInferiorPidChanged(re.cap(2)); - } - - // Mac - if (data.contains("[Switching to process ")) { - QRegExp re("\\[Switching to process ([0-9]*) local thread 0x([0-9a-f]*)\\]"); - if (re.indexIn(data) != -1) - maybeHandleInferiorPidChanged(re.cap(1)); - } - - // present it twice: now and together with the next 'real' result - switch (code) { - case '~': - m_pendingConsoleStreamOutput += data; - break; - case '@': - m_pendingTargetStreamOutput += data; - break; - case '&': - m_pendingLogStreamOutput += data; - // On Windows, the contents seem to depend on the debugger - // version and/or OS version used. - if (data.startsWith("warning:")) - qq->showApplicationOutput(data); - break; - } - -#ifdef Q_OS_LINUX - if (data.startsWith("Pending break") && data.contains("\" resolved")) { - qDebug() << "SCHEDULING -break-list"; - //m_breakListOnStopNeeded = true; - } -#endif - -#if 0 - if (m_slurpingPTypeOutput) - qDebug() << "SLURP: " << output.data; - - // "No symbol \"__dlopen\" in current context." - // "No symbol \"dlopen\" in current context." - if (output.data.startsWith("No symbol ") - && output.data.contains("dlopen")) { - m_dlopened = true; - return; - } - - // output of 'ptype ' - if (output.data.startsWith("type = ")) { - if (output.data.endsWith("{") || output.data.endsWith("{\\n")) { - // multi-line output started here... - m_slurpingPTypeOutput = true; - m_slurpedPTypeOutput = output.data; - } else { - // Happens for simple types. Process it immediately - m_watchHandler->handleTypeContents(output.data); - } - return; - } - if (m_slurpingPTypeOutput) { - m_slurpedPTypeOutput += '\n'; - m_slurpedPTypeOutput += output.data; - if (output.data.startsWith("}")) { - // this is the last line... - m_slurpingPTypeOutput = false; - m_watchHandler->handleTypeContents(m_slurpedPTypeOutput); - m_slurpedPTypeOutput.clear(); - } - return; - } -#endif -} - static bool isExitedReason(const QString &reason) { return reason == QLatin1String("exited-normally") // inferior exited normally @@ -1633,13 +1562,17 @@ bool GdbEngine::startDebugger() } if (q->startMode() == q->startInternal) { + emit gdbInputAvailable(QString(), QString()); sendCommand("-file-exec-and-symbols " + fileName, GdbFileExecAndSymbols); //sendCommand("file " + fileName, GdbFileExecAndSymbols); #ifdef Q_OS_MAC sendCommand("sharedlibrary apply-load-rules all"); #endif - //sendCommand("-gdb-set stop-on-solib-events 1"); - runInferior(); + setTokenBarrier(); + if (!q->m_processArgs.isEmpty()) + sendCommand("-exec-arguments " + q->m_processArgs.join(" ")); + sendCommand("set auto-solib-add off"); + sendCommand("x/2i _start", GdbStart); } if (q->startMode() == q->attachExternal) { @@ -1678,21 +1611,7 @@ void GdbEngine::continueInferior() sendCommand("-exec-continue", GdbExecContinue); } -void GdbEngine::runInferior() -{ - q->resetLocation(); - // FIXME: this ignores important startup messages - setTokenBarrier(); - if (!q->m_processArgs.isEmpty()) - sendCommand("-exec-arguments " + q->m_processArgs.join(" ")); - qq->notifyInferiorRunningRequested(); - emit gdbInputAvailable(QString(), QString()); - - sendCommand("set auto-solib-add off"); - sendCommand("x/2i _start", GdbExecStart1); -} - -void GdbEngine::handleExecStart1(const GdbResultRecord &response) +void GdbEngine::handleStart(const GdbResultRecord &response) { if (response.resultClass == GdbResultDone) { // stdout:&"x/2i _start\n" @@ -1702,8 +1621,9 @@ void GdbEngine::handleExecStart1(const GdbResultRecord &response) QRegExp needle("0x([0-9a-f]+) <_start\\+.*>:"); if (needle.indexIn(msg) != -1) { //qDebug() << "STREAM: " << msg << needle.cap(1); - sendCommand("tbreak *0x" + needle.cap(1)); // GdbExecStart3); - sendCommand("-exec-run"); // GdbExecStart3); + sendCommand("tbreak *0x" + needle.cap(1)); + sendCommand("-exec-run"); + qq->notifyInferiorRunningRequested(); } else { qDebug() << "PARSING START ADDRESS FAILED" << msg; } @@ -1712,20 +1632,6 @@ void GdbEngine::handleExecStart1(const GdbResultRecord &response) } } -void GdbEngine::handleExecStart3(const GdbResultRecord &) -{ -#if defined(Q_OS_WIN) - sendCommand("info proc", GdbInfoProc); -#endif -#if defined(Q_OS_LINUX) - sendCommand("info proc", GdbInfoProc); -#endif -#if defined(Q_OS_MAC) - sendCommand("info pid", GdbInfoProc, QVariant(), true); -#endif - attemptBreakpointSynchronization(); -} - void GdbEngine::stepExec() { setTokenBarrier(); @@ -2244,12 +2150,7 @@ void GdbEngine::attemptBreakpointSynchronization() } } - if (updateNeeded) { - //interruptAndContinue(); - //sendListBreakpoints(); - } - - if (!updateNeeded && q->status() == DebuggerProcessStartingUp) { + if (!updateNeeded) { // we continue the execution continueInferior(); } @@ -4017,7 +3918,6 @@ void GdbEngine::assignValueInDebugger(const QString &expression, const QString & sendCommand("-var-assign assign " + value, WatchVarAssign); } - void GdbEngine::tryLoadCustomDumpers() { if (m_dataDumperState != DataDumperUninitialized) diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index 7973ef4c681..0b304e10660 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -113,7 +113,6 @@ private: void exitDebugger(); void continueInferior(); - void runInferior(); void interruptInferior(); void runToLineExec(const QString &fileName, int lineNumber); @@ -179,14 +178,12 @@ private slots: private: int terminationIndex(const QByteArray &buffer, int &length); - void handleStreamOutput(const QString &output, char code); + void handleStart(const GdbResultRecord &response); void handleAsyncOutput2(const GdbMi &data); void handleAsyncOutput(const GdbMi &data); void handleResultRecord(const GdbResultRecord &response); void handleFileExecAndSymbols(const GdbResultRecord &response); void handleExecRun(const GdbResultRecord &response); - void handleExecStart1(const GdbResultRecord &response); - void handleExecStart3(const GdbResultRecord &response); void handleExecJumpToLine(const GdbResultRecord &response); void handleExecRunToFunction(const GdbResultRecord &response); void handleInfoShared(const GdbResultRecord &response); diff --git a/src/plugins/debugger/idebuggerengine.h b/src/plugins/debugger/idebuggerengine.h index 1558d140ee6..ee1e15793f3 100644 --- a/src/plugins/debugger/idebuggerengine.h +++ b/src/plugins/debugger/idebuggerengine.h @@ -62,7 +62,6 @@ public: virtual void nextIExec() = 0; virtual void continueInferior() = 0; - virtual void runInferior() = 0; virtual void interruptInferior() = 0; virtual void runToLineExec(const QString &fileName, int lineNumber) = 0; From 7d15c4beee7d85eb8cf7a2ad833832df041111c4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 12 Feb 2009 16:06:23 +0100 Subject: [PATCH 11/32] Fixes: uic warning about duplicate name Details: Give the layout a name. --- src/plugins/debugger/gdboptionpage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/gdboptionpage.ui b/src/plugins/debugger/gdboptionpage.ui index e6c46c9bc3a..884080c1a30 100644 --- a/src/plugins/debugger/gdboptionpage.ui +++ b/src/plugins/debugger/gdboptionpage.ui @@ -19,7 +19,7 @@ Locations - + 9 From f60dcda6b6659046994811baeb3689875ec23521 Mon Sep 17 00:00:00 2001 From: dt Date: Thu, 12 Feb 2009 16:09:23 +0100 Subject: [PATCH 12/32] Fixes: Adjust the toolchain classes to make them work on windows. --- src/plugins/projectexplorer/toolchain.cpp | 26 ++++++++++++++----- src/plugins/qt4projectmanager/qt4project.cpp | 20 ++++++++++++-- .../qt4projectmanager/qtversionmanager.cpp | 9 ++++--- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index 96b16d59d31..32125bb1007 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -170,16 +170,24 @@ bool MinGWToolChain::equals(ToolChain *other) const void MinGWToolChain::addToEnvironment(ProjectExplorer::Environment &env) { + //qDebug()<<"MinGWToolChain::addToEnvironment"; QString binDir = m_mingwPath + "/bin"; if (QFileInfo(binDir).exists()) env.prependOrSetPath(binDir); +// if (QFileInfo(binDir).exists()) +// qDebug()<<"Adding "< MSVCToolChain::systemHeaderPaths() //TODO fix this code ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); addToEnvironment(env); -#ifdef QTCREATOR_WITH_MSVC_INCLUDES - return env.value("INCLUDE").split(QLatin1Char(';')); -#endif - return QList(); + QList headerPaths; + foreach(const QString &path, env.value("INCLUDE").split(QLatin1Char(';'))) { + headerPaths.append(HeaderPath(path, HeaderPath::GlobalHeaderPath)); + } + return headerPaths; } void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env) @@ -222,6 +231,8 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env) if (!m_valuesSet) { QSettings registry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7", QSettings::NativeFormat); + if (m_name.isEmpty()) + return; QString path = registry.value(m_name).toString(); ProjectExplorer::Environment oldEnv(env); QString desc; @@ -264,11 +275,12 @@ void MSVCToolChain::addToEnvironment(ProjectExplorer::Environment &env) m_valuesSet = true; } + //qDebug()<<"MSVC Environment:"; QList< QPair >::const_iterator it, end; end = m_values.constEnd(); for (it = m_values.constBegin(); it != end; ++it) { env.set((*it).first, (*it).second); - qDebug()<<"variable:"<<(*it).first<<"value:"<<(*it).second; + //qDebug()<<"variable:"<<(*it).first<<"value:"<<(*it).second; } } @@ -325,4 +337,6 @@ void WinCEToolChain::addToEnvironment(ProjectExplorer::Environment &env) CeSdkHandler cesdkhandler; cesdkhandler.parse(path); cesdkhandler.find(m_platform).addToEnvironment(env); + //qDebug()<<"WinCE Final Environment:"; + //qDebug()<addToEnvironment(env); qmake_cxx = env.searchInPath(qmake_cxx); m_test = ToolChain::createMinGWToolChain(qmake_cxx, version->mingwDirectory()); + qDebug()<<"Mingw ToolChain"; } else if(t == ToolChain::MSVC) { m_test = ToolChain::createMSVCToolChain(version->msvcVersion()); + //qDebug()<<"MSVC ToolChain ("<msvcVersion()<<")"; } else if(t == ToolChain::WINCE) { m_test = ToolChain::createWinCEToolChain(version->msvcVersion(), version->wincePlatform()); + //qDebug()<<"WinCE ToolChain ("<msvcVersion()<<","<wincePlatform()<<")"; } else if(t == ToolChain::GCC || t == ToolChain::LinuxICC) { QStringList list = rootProjectNode()->variableValue(Internal::CxxCompilerVar); QString qmake_cxx = list.isEmpty() ? QString::null : list.first(); @@ -426,8 +430,14 @@ ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfigurat qtVersion(activeBuildConfiguration())->addToEnvironment(env); qmake_cxx = env.searchInPath(qmake_cxx); m_test = ToolChain::createGccToolChain(qmake_cxx); + //qDebug()<<"GCC ToolChain ("<mkspec(); + qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines."; } + + if (m_test == m_toolChain) { delete m_test; } else { @@ -462,6 +472,12 @@ void Qt4Project::updateCodeModel() if (tc) { predefinedMacros = tc->predefinedMacros(); allHeaderPaths = tc->systemHeaderPaths(); + //qDebug()<<"Predifined Macros"; + //qDebug()<predefinedMacros(); + //qDebug()<<""; + //qDebug()<<"System Header Paths"; + //foreach(const HeaderPath &hp, tc->systemHeaderPaths()) + // qDebug()<path()); - qDebug()<<"Still existing paths :"< > removeList; foreach (QSharedPointer rc, runConfigurations()) { if (QSharedPointer qt4rc = rc.dynamicCast()) { if (!paths.contains(qt4rc->proFilePath())) { removeList.append(qt4rc); - qDebug()<<"Removing runConfiguration for "<proFilePath(); +// qDebug()<<"Removing runConfiguration for "<proFilePath(); } } } diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 58f196b3ede..2e7440bb571 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -1183,15 +1183,16 @@ ProjectExplorer::ToolChain::ToolChainType QtVersion::toolchainType() const if (!isValid()) return ProjectExplorer::ToolChain::INVALID; const QString &spec = mkspec(); +// qDebug()<<"spec="< Date: Fri, 13 Feb 2009 09:55:21 +0100 Subject: [PATCH 13/32] Fixes: Context help in Designer Task: 235520 Details: Display help of current property editor object --- src/plugins/designer/formwindoweditor.cpp | 24 +++++++++++++++++++++++ src/plugins/designer/formwindoweditor.h | 6 +++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp index a683dccd864..869443a9aaf 100644 --- a/src/plugins/designer/formwindoweditor.cpp +++ b/src/plugins/designer/formwindoweditor.cpp @@ -45,6 +45,8 @@ #include #include #include +#include +#include #include #include @@ -325,3 +327,25 @@ void FormWindowEditor::activate() { m_editorWidget->activate(); } + +QString FormWindowEditor::contextHelpId() const +{ + // TODO [13.2.09]: Replace this by QDesignerIntegrations context help Id + // in the upcoming version of Qt + QDesignerFormEditorInterface *core = FormEditorW::instance()->designerEditor(); + QObject *o = core->propertyEditor()->object(); + if (!o) + return QString(); + const QDesignerWidgetDataBaseInterface *db = core->widgetDataBase(); + const int dbIndex = db->indexOfObject(o, true); + if (dbIndex == -1) + return QString(); + QString className = db->item(dbIndex)->name(); + if (className == QLatin1String("Line")) + className = QLatin1String("QFrame"); + else if (className == QLatin1String("Spacer")) + className = QLatin1String("QSpacerItem"); + else if (className == QLatin1String("QLayoutWidget")) + className = QLatin1String("QLayout"); + return className; +} diff --git a/src/plugins/designer/formwindoweditor.h b/src/plugins/designer/formwindoweditor.h index e854ccac915..bce29c2f5a8 100644 --- a/src/plugins/designer/formwindoweditor.h +++ b/src/plugins/designer/formwindoweditor.h @@ -63,7 +63,6 @@ class EditorWidget; class FormWindowEditor : public Core::IEditor { Q_OBJECT - public: FormWindowEditor(const QList &context, QDesignerFormWindowInterface *form, @@ -84,8 +83,9 @@ public: bool restoreState(const QByteArray &state); // ContextInterface - QList context() const; - QWidget *widget(); + virtual QList context() const; + virtual QWidget *widget(); + virtual QString contextHelpId() const; QDesignerFormWindowInterface *formWindow() const; QWidget *integrationContainer(); From 441c630faed9e9a62b073c0a85025e7630696fa4 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Fri, 13 Feb 2009 10:16:12 +0100 Subject: [PATCH 14/32] Ship 4.5-rc1 with Linux bundles. --- scripts/shipping/prepare-linux-qt-for-shipping.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/shipping/prepare-linux-qt-for-shipping.sh b/scripts/shipping/prepare-linux-qt-for-shipping.sh index 2f49413ebdd..b8c058a84cb 100755 --- a/scripts/shipping/prepare-linux-qt-for-shipping.sh +++ b/scripts/shipping/prepare-linux-qt-for-shipping.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -version=4.4.3 +version="4.5-rc1" workdir=/home/berlin/dev/qt-${version}-temp destdir=/home/berlin/dev/qt-${version}-shipping/qt # "/qt" suffix for Bitrock dir=qt-x11-opensource-src-${version} From f25638f7f5c49f556cc0cbbdc51ace4898fdae24 Mon Sep 17 00:00:00 2001 From: dt Date: Fri, 13 Feb 2009 11:12:52 +0100 Subject: [PATCH 15/32] Fixes: Another crash Task: Found on irc. --- src/plugins/qt4projectmanager/qt4project.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 492dc2c50d0..569d2e82820 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -700,7 +700,9 @@ ProjectExplorer::Environment Qt4Project::baseEnvironment(const QString &buildCon { Environment env = useSystemEnvironment(buildConfiguration) ? Environment(QProcess::systemEnvironment()) : Environment(); qtVersion(buildConfiguration)->addToEnvironment(env); - toolChain(buildConfiguration)->addToEnvironment(env); + ToolChain *tc = toolChain(buildConfiguration); + if (tc) + tc->addToEnvironment(env); return env; } From 9cb615609c94069b12c5d6d310d6780d07e1b816 Mon Sep 17 00:00:00 2001 From: dt Date: Fri, 13 Feb 2009 12:02:58 +0100 Subject: [PATCH 16/32] Fixes: Another crash Task: Also from irc. --- src/plugins/qt4projectmanager/qt4project.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 2922987b105..19de5ea3a30 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -406,7 +406,7 @@ ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfigurat { qDebug()<<"Qt4Project::toolChain() for buildconfiguration:"<toolchainType(); if (t == ToolChain::MinGW) { @@ -436,9 +436,7 @@ ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfigurat qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines."; } - - - if (m_test == m_toolChain) { + if (ToolChain::equals(m_test, m_toolChain)) { delete m_test; } else { delete m_toolChain; From 7ad54e6313e5c6f0c1708fefd59af549c762d01b Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 13 Feb 2009 12:34:10 +0100 Subject: [PATCH 17/32] Fixes: debugger: start symbol is WinMainCRTStartup, not _start sometimes... --- src/plugins/debugger/gdbengine.cpp | 72 +++++++++++++++++++----------- src/plugins/debugger/gdbengine.h | 2 + 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 9f0a3b3ace1..663bd7c38cf 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -230,6 +230,15 @@ static bool isLeavableFunction(const QString &funcName, const QString &fileName) return false; } +static QString startSymbolName() +{ +#ifdef Q_OS_WIN + return "WinMainCRTStartup"; +#else + return "_start"; +#endif +} + /////////////////////////////////////////////////////////////////////// // @@ -251,6 +260,7 @@ GdbEngine::~GdbEngine() void GdbEngine::init() { m_pendingRequests = 0; + m_waitingForBreakpointSynchronizationToContinue = false; m_gdbVersion = 100; m_outputCodec = QTextCodec::codecForLocale(); m_dataDumperState = DataDumperUninitialized; @@ -650,7 +660,7 @@ void GdbEngine::maybeHandleInferiorPidChanged(const QString &pid0) } if (pid == q->m_attachedPID) return; - //qDebug() << "FOUND PID " << pid; + qDebug() << "FOUND PID " << pid; q->m_attachedPID = pid; qq->notifyInferiorPidChanged(pid); } @@ -750,8 +760,10 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record) --m_pendingRequests; PENDING_DEBUG(" TYPE " << cmd.type << " DECREMENTS PENDING TO: " << m_pendingRequests << cmd.command); - if (m_pendingRequests <= 0) + if (m_pendingRequests <= 0) { + PENDING_DEBUG(" .... AND TRIGGERS MODEL UPDATE"); updateWatchModel2(); + } } else { PENDING_DEBUG(" UNKNOWN TYPE " << cmd.type << " LEAVES PENDING AT: " << m_pendingRequests << cmd.command); @@ -1065,8 +1077,10 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) QString msg = data.findChild("consolestreamoutput").data(); if (reason.isEmpty()) { GdbMi frame = data.findChild("frame"); - if (frame.findChild("func").data() == "_start") { + if (frame.findChild("func").data() == startSymbolName()) { + // // that's the "early stop" + // frame.findChild("func").data() + '%'; #if defined(Q_OS_WIN) sendCommand("info proc", GdbInfoProc); @@ -1078,9 +1092,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) sendCommand("info pid", GdbInfoProc, QVariant(), true); #endif sendCommand("-file-list-exec-source-files", GdbQuerySources); - - sendCommand("sharedlibrary libc"); // for malloc - sendCommand("sharedlibrary libdl"); // for dlopen tryLoadCustomDumpers(); // intentionally after tryLoadCustomDumpers(), @@ -1098,11 +1109,12 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) sendCommand("set auto-solib-add off"); sendCommand("set stop-on-solib-events 0"); } - reloadModules(); // this will "continue" if done - attemptBreakpointSynchronization(); + m_waitingForBreakpointSynchronizationToContinue = true; + QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization())); return; } + qDebug() << "EMPTY REASON FOR STOPPED"; // fall through } @@ -1231,7 +1243,7 @@ void GdbEngine::handleAsyncOutput2(const GdbMi &data) // // Breakpoints // - //qDebug() << "BREAK ASYNC: " << output.toString(); + //qDebug() << "BREAK ASYNC: " << data.toString(); //sendListBreakpoints(); //attemptBreakpointSynchronization(); //if (m_breakListOnStopNeeded) @@ -1572,7 +1584,7 @@ bool GdbEngine::startDebugger() if (!q->m_processArgs.isEmpty()) sendCommand("-exec-arguments " + q->m_processArgs.join(" ")); sendCommand("set auto-solib-add off"); - sendCommand("x/2i _start", GdbStart); + sendCommand("x/2i " + startSymbolName(), GdbStart); } if (q->startMode() == q->attachExternal) { @@ -1597,8 +1609,6 @@ bool GdbEngine::startDebugger() else qq->breakHandler()->setAllPending(); - //QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization())); - return true; } @@ -1618,7 +1628,7 @@ void GdbEngine::handleStart(const GdbResultRecord &response) // stdout:~"0x404540 <_start>:\txor %ebp,%ebp\n" // stdout:~"0x404542 <_start+2>:\tmov %rdx,%r9\n" QString msg = response.data.findChild("consolestreamoutput").data(); - QRegExp needle("0x([0-9a-f]+) <_start\\+.*>:"); + QRegExp needle("0x([0-9a-f]+) <" + startSymbolName() + "\\+.*>:"); if (needle.indexIn(msg) != -1) { //qDebug() << "STREAM: " << msg << needle.cap(1); sendCommand("tbreak *0x" + needle.cap(1)); @@ -2080,11 +2090,14 @@ void GdbEngine::handleBreakInsert1(const GdbResultRecord &record, int index) void GdbEngine::attemptBreakpointSynchronization() { + // Non-lethal check for nested calls + static bool inBreakpointSychronization = false; + QTC_ASSERT(!inBreakpointSychronization, /**/); + inBreakpointSychronization = true; + BreakHandler *handler = qq->breakHandler(); - //qDebug() << "BREAKPOINT SYNCHRONIZATION "; foreach (BreakpointData *data, handler->takeRemovedBreakpoints()) { - //qDebug() << " SYNCHRONIZATION REMOVING" << data; QString bpNumber = data->bpNumber; if (!bpNumber.trimmed().isEmpty()) sendCommand("-break-delete " + bpNumber, BreakDelete, 0, true); @@ -2150,10 +2163,13 @@ void GdbEngine::attemptBreakpointSynchronization() } } - if (!updateNeeded) { + if (!updateNeeded && m_waitingForBreakpointSynchronizationToContinue) { + m_waitingForBreakpointSynchronizationToContinue = false; // we continue the execution continueInferior(); } + + inBreakpointSychronization = false; } @@ -3931,12 +3947,14 @@ void GdbEngine::tryLoadCustomDumpers() if (QFileInfo(lib).isExecutable()) { //sendCommand("p dlopen"); QString flag = QString::number(RTLD_NOW); - sendSynchronizedCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", + sendCommand("sharedlibrary libc"); // for malloc + sendCommand("sharedlibrary libdl"); // for dlopen + sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", WatchDumpCustomSetup); // some older systems like CentOS 4.6 prefer this: - sendSynchronizedCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")", + sendCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")", WatchDumpCustomSetup); - sendSynchronizedCommand("sharedlibrary " + dotEscape(lib)); + sendCommand("sharedlibrary " + dotEscape(lib)); } else { qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: " << lib << QFileInfo(lib).isExecutable(); @@ -3945,11 +3963,12 @@ void GdbEngine::tryLoadCustomDumpers() #if defined(Q_OS_MAC) QString lib = q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.dylib"; if (QFileInfo(lib).isExecutable()) { - //sendCommand("p dlopen"); // FIXME: remove me + sendCommand("sharedlibrary libc"); // for malloc + sendCommand("sharedlibrary libdl"); // for dlopen QString flag = QString::number(RTLD_NOW); - sendSynchronizedCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", + sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", WatchDumpCustomSetup); - sendSynchronizedCommand("sharedlibrary " + dotEscape(lib)); + sendCommand("sharedlibrary " + dotEscape(lib)); } else { qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: " << lib << QFileInfo(lib).isExecutable(); @@ -3958,11 +3977,12 @@ void GdbEngine::tryLoadCustomDumpers() #if defined(Q_OS_WIN) QString lib = q->m_buildDir + "/qtc-gdbmacros/debug/gdbmacros.dll"; if (QFileInfo(lib).exists()) { + sendCommand("sharedlibrary .*"); // for LoadLibraryA //sendCommand("handle SIGSEGV pass stop print"); //sendCommand("set unwindonsignal off"); - sendSynchronizedCommand("call LoadLibraryA(\"" + lib + "\")", + sendCommand("call LoadLibraryA(\"" + lib + "\")", WatchDumpCustomSetup); - sendSynchronizedCommand("sharedlibrary " + dotEscape(lib)); + sendCommand("sharedlibrary " + dotEscape(lib)); } else { qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: " << lib << QFileInfo(lib).isExecutable(); @@ -3970,9 +3990,9 @@ void GdbEngine::tryLoadCustomDumpers() #endif // retreive list of dumpable classes - sendSynchronizedCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)", + sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)", GdbQueryDataDumper1); - sendSynchronizedCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper2); + sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper2); } diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index 0b304e10660..f41990747d5 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -328,6 +328,8 @@ private: QString m_currentFrame; QMap m_varToType; + bool m_waitingForBreakpointSynchronizationToContinue; + DebuggerManager *q; IDebuggerManagerAccessForEngines *qq; }; From ba9ade6d0cb89baacf1ee6a42d2381d772f8938e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Fri, 13 Feb 2009 12:56:39 +0100 Subject: [PATCH 18/32] Fixed dock widget features on startup in locked state In locked state the dock widgets shouldn't have AllDockWidgetFeatures set, but rather NoDockWidgetFeatures. Otherwise a hidden one-pixel wide area exists that allows people to move/float a dockwidget, which can be confusing. Task: 244531 --- src/plugins/debugger/debuggermanager.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 53eac322e45..1898155a7ab 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -451,10 +451,7 @@ QDockWidget *DebuggerManager::createDockForWidget(QWidget *widget) { QDockWidget *dockWidget = new QDockWidget(widget->windowTitle(), m_mainWindow); dockWidget->setObjectName(widget->windowTitle()); - //dockWidget->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::RightDockWidgetArea); - dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas); // that space is needed. - //dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); - dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures); + dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); dockWidget->setTitleBarWidget(new QWidget(dockWidget)); dockWidget->setWidget(widget); connect(dockWidget->toggleViewAction(), SIGNAL(toggled(bool)), From 581dae100abf61d8c4d2a647cd7f546fda85d93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Fri, 13 Feb 2009 12:56:39 +0100 Subject: [PATCH 19/32] Fixed dock widget features on startup in locked state In locked state the dock widgets shouldn't have AllDockWidgetFeatures set, but rather NoDockWidgetFeatures. Otherwise a hidden one-pixel wide area exists that allows people to move/float a dockwidget, which can be confusing. Task: 244531 (cherry picked from commit ba9ade6d0cb89baacf1ee6a42d2381d772f8938e) --- src/plugins/debugger/debuggermanager.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 423321fc7ba..95b874a3f8a 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -451,10 +451,7 @@ QDockWidget *DebuggerManager::createDockForWidget(QWidget *widget) { QDockWidget *dockWidget = new QDockWidget(widget->windowTitle(), m_mainWindow); dockWidget->setObjectName(widget->windowTitle()); - //dockWidget->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::RightDockWidgetArea); - dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas); // that space is needed. - //dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); - dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures); + dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); dockWidget->setTitleBarWidget(new QWidget(dockWidget)); dockWidget->setWidget(widget); connect(dockWidget->toggleViewAction(), SIGNAL(toggled(bool)), From b2387fdda897c5e7698f1b3030ec7c7f7b58912e Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 13 Feb 2009 13:50:50 +0100 Subject: [PATCH 20/32] Fixes: debugger: load modules list early Details: feels better --- src/plugins/debugger/debuggerrunner.cpp | 9 +++-- src/plugins/debugger/gdbengine.cpp | 44 ++++++++++++++----------- src/plugins/debugger/gdbengine.h | 4 ++- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 7f3e42f47fa..21313428aef 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -107,11 +107,14 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager, : RunControl(runConfiguration), m_manager(manager), m_running(false) { connect(m_manager, SIGNAL(debuggingFinished()), - this, SLOT(debuggingFinished())); + this, SLOT(debuggingFinished()), + Qt::QueuedConnection); connect(m_manager, SIGNAL(applicationOutputAvailable(QString)), - this, SLOT(slotAddToOutputWindowInline(QString))); + this, SLOT(slotAddToOutputWindowInline(QString)), + Qt::QueuedConnection); connect(m_manager, SIGNAL(inferiorPidChanged(qint64)), - this, SLOT(bringApplicationToForeground(qint64))); + this, SLOT(bringApplicationToForeground(qint64)), + Qt::QueuedConnection); } void DebuggerRunControl::start() diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 663bd7c38cf..3238862d355 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -250,23 +250,16 @@ GdbEngine::GdbEngine(DebuggerManager *parent) { q = parent; qq = parent->engineInterface(); - init(); + initializeVariables(); + initializeConnections(); } GdbEngine::~GdbEngine() { } -void GdbEngine::init() +void GdbEngine::initializeConnections() { - m_pendingRequests = 0; - m_waitingForBreakpointSynchronizationToContinue = false; - m_gdbVersion = 100; - m_outputCodec = QTextCodec::codecForLocale(); - m_dataDumperState = DataDumperUninitialized; - - m_oldestAcceptableToken = -1; - // Gdb Process interaction connect(&m_gdbProc, SIGNAL(error(QProcess::ProcessError)), this, SLOT(gdbProcError(QProcess::ProcessError))); @@ -294,6 +287,22 @@ void GdbEngine::init() Qt::QueuedConnection); } +void GdbEngine::initializeVariables() +{ + m_dataDumperState = DataDumperUninitialized; + m_gdbVersion = 100; + + m_fullToShortName.clear(); + m_shortToFullName.clear(); + m_varToType.clear(); + + m_modulesListOutdated = true; + m_oldestAcceptableToken = -1; + m_outputCodec = QTextCodec::codecForLocale(); + m_pendingRequests = 0; + m_waitingForBreakpointSynchronizationToContinue = false; +} + void GdbEngine::gdbProcError(QProcess::ProcessError error) { QString msg; @@ -1109,6 +1118,8 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) sendCommand("set auto-solib-add off"); sendCommand("set stop-on-solib-events 0"); } + // nicer to see a bit of the world we live in + reloadModules(); // this will "continue" if done m_waitingForBreakpointSynchronizationToContinue = true; QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization())); @@ -1118,7 +1129,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) // fall through } - static bool modulesDirty = false; if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) { if (qq->wantsSelectedPluginBreakpoints()) { qDebug() << "SHARED LIBRARY EVENT " << data.toString(); @@ -1128,7 +1138,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) q->showStatusMessage(tr("Loading %1...").arg(QString(data.toString()))); return; } - modulesDirty = true; + m_modulesListOutdated = true; // fall through } @@ -1183,11 +1193,11 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) } if (isStoppedReason(reason) || reason.isEmpty()) { - if (modulesDirty) { + if (m_modulesListOutdated) { sendCommand("-file-list-exec-source-files", GdbQuerySources); sendCommand("-break-list", BreakList); reloadModules(); - modulesDirty = false; + m_modulesListOutdated = false; } // Need another round trip if (reason == "breakpoint-hit") { @@ -1345,7 +1355,6 @@ void GdbEngine::handleExecRun(const GdbResultRecord &response) if (response.resultClass == GdbResultRunning) { qq->notifyInferiorRunning(); q->showStatusMessage(tr("Running...")); - //reloadModules(); } else if (response.resultClass == GdbResultError) { QString msg = response.data.findChild("msg").data(); if (msg == "Cannot find bounds of current function") { @@ -1433,11 +1442,8 @@ void GdbEngine::exitDebugger() if (m_gdbProc.state() != QProcess::NotRunning) qDebug() << "PROBLEM STOPPING DEBUGGER"; - m_shortToFullName.clear(); - m_fullToShortName.clear(); - m_varToType.clear(); - m_dataDumperState = DataDumperUninitialized; m_outputCollector.shutdown(); + initializeVariables(); //q->settings()->m_debugDumpers = false; } diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index f41990747d5..58021fb765a 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -144,7 +144,8 @@ private: bool supportsThreads() const; - void init(); // called by destructor + void initializeConnections(); + void initializeVariables(); void queryFullName(const QString &fileName, QString *fullName); QString fullName(const QString &fileName); QString shortName(const QString &fullName); @@ -329,6 +330,7 @@ private: QMap m_varToType; bool m_waitingForBreakpointSynchronizationToContinue; + bool m_modulesListOutdated; DebuggerManager *q; IDebuggerManagerAccessForEngines *qq; From ae7864f9c0ba2778756a89c3d0e6c97b76902263 Mon Sep 17 00:00:00 2001 From: lowinu Date: Fri, 13 Feb 2009 13:53:11 +0100 Subject: [PATCH 21/32] Fixes: cpaster plugin options RevBy: andre Details: - the settings have not been taken into respect so far. --- src/plugins/cpaster/cpasterplugin.cpp | 4 +++- src/plugins/cpaster/settingspage.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index f0cda5147c2..82a8be37d72 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -185,7 +185,9 @@ void CodepasterPlugin::post() // Submit to codepaster - m_poster = new CustomPoster(serverUrl()); + m_poster = new CustomPoster(serverUrl(), + m_settingsPage->copyToClipBoard(), + m_settingsPage->displayOutput()); // Copied from cpaster. Otherwise lineendings will screw up if (!data.contains("\r\n")) { diff --git a/src/plugins/cpaster/settingspage.h b/src/plugins/cpaster/settingspage.h index a492030752c..98df299a5f6 100644 --- a/src/plugins/cpaster/settingspage.h +++ b/src/plugins/cpaster/settingspage.h @@ -65,8 +65,8 @@ public: QString username() const; QUrl serverUrl() const; - bool copyToClipBoard() const; - bool displayOutput() const; + inline bool copyToClipBoard() const { return m_copy; } + inline bool displayOutput() const { return m_output; } private: Ui_SettingsPage m_ui; From b6c15d1ba906f9e7ed124b91bd2d7adbd46953ea Mon Sep 17 00:00:00 2001 From: lowinu Date: Fri, 13 Feb 2009 12:52:01 +0100 Subject: [PATCH 22/32] Fixes: add timeout value to git plugin RevBy: tba Details: - as on windows some git commands take much longer it happens fairly often, that git timeouts. - added a timeout value to the option to let the user choose maximum timeout value (minimum is 10 seconds, maximum 5 minutes) --- src/plugins/git/gitclient.cpp | 8 ++++---- src/plugins/git/gitcommand.cpp | 11 ++++++----- src/plugins/git/gitcommand.h | 5 +++-- src/plugins/git/gitsettings.cpp | 10 +++++++--- src/plugins/git/gitsettings.h | 1 + src/plugins/git/settingspage.cpp | 2 ++ src/plugins/git/settingspage.ui | 33 ++++++++++++++++++++++++-------- 7 files changed, 48 insertions(+), 22 deletions(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index fe2394c019d..08bdac4ee60 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -207,20 +207,20 @@ void GitClient::diff(const QString &workingDirectory, QStringList arguments; arguments << QLatin1String("diff") << diffArgs; m_plugin->outputWindow()->append(formatCommand(binary, arguments)); - command->addJob(arguments); + command->addJob(arguments, m_settings.timeout); } else { // Files diff. if (!unstagedFileNames.empty()) { QStringList arguments; arguments << QLatin1String("diff") << diffArgs << QLatin1String("--") << unstagedFileNames; m_plugin->outputWindow()->append(formatCommand(binary, arguments)); - command->addJob(arguments); + command->addJob(arguments, m_settings.timeout); } if (!stagedFileNames.empty()) { QStringList arguments; arguments << QLatin1String("diff") << QLatin1String("--cached") << diffArgs << QLatin1String("--") << stagedFileNames; m_plugin->outputWindow()->append(formatCommand(binary, arguments)); - command->addJob(arguments); + command->addJob(arguments, m_settings.timeout); } } command->execute(); @@ -503,7 +503,7 @@ void GitClient::executeGit(const QString &workingDirectory, { m_plugin->outputWindow()->append(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments)); GitCommand *command = createCommand(workingDirectory, editor, outputToWindow); - command->addJob(arguments); + command->addJob(arguments, m_settings.timeout); command->execute(); } diff --git a/src/plugins/git/gitcommand.cpp b/src/plugins/git/gitcommand.cpp index fa62401b011..8362926cecc 100644 --- a/src/plugins/git/gitcommand.cpp +++ b/src/plugins/git/gitcommand.cpp @@ -55,8 +55,9 @@ static inline QStringList environmentToList(const ProjectExplorer::Environment & return ProjectExplorer::Environment::systemEnvironment().toStringList(); } -GitCommand::Job::Job(const QStringList &a) : - arguments(a) +GitCommand::Job::Job(const QStringList &a, int t) : + arguments(a), + timeout(t) { } @@ -67,9 +68,9 @@ GitCommand::GitCommand(const QString &workingDirectory, { } -void GitCommand::addJob(const QStringList &arguments) +void GitCommand::addJob(const QStringList &arguments, int timeout) { - m_jobs.push_back(Job(arguments)); + m_jobs.push_back(Job(arguments, timeout)); } void GitCommand::execute() @@ -109,7 +110,7 @@ void GitCommand::run() qDebug() << "GitCommand::run" << j << '/' << count << m_jobs.at(j).arguments; process.start(QLatin1String(Constants::GIT_BINARY), m_jobs.at(j).arguments); - if (!process.waitForFinished()) { + if (!process.waitForFinished(m_jobs.at(j).timeout * 1000)) { ok = false; error += QLatin1String("Error: Git timed out"); break; diff --git a/src/plugins/git/gitcommand.h b/src/plugins/git/gitcommand.h index a587b748761..32b76bf3485 100644 --- a/src/plugins/git/gitcommand.h +++ b/src/plugins/git/gitcommand.h @@ -49,7 +49,7 @@ public: ProjectExplorer::Environment &environment); - void addJob(const QStringList &arguments); + void addJob(const QStringList &arguments, int timeout); void execute(); private: @@ -61,9 +61,10 @@ Q_SIGNALS: private: struct Job { - explicit Job(const QStringList &a); + explicit Job(const QStringList &a, int t); QStringList arguments; + int timeout; }; QStringList environment() const; diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp index 2b528a72d2a..02a1acc1d9e 100644 --- a/src/plugins/git/gitsettings.cpp +++ b/src/plugins/git/gitsettings.cpp @@ -40,15 +40,17 @@ static const char *groupC = "Git"; static const char *sysEnvKeyC = "SysEnv"; static const char *pathKeyC = "Path"; static const char *logCountKeyC = "LogCount"; +static const char *timeoutKeyC = "TimeOut"; -enum { defaultLogCount = 10 }; +enum { defaultLogCount = 10 , defaultTimeOut = 30}; namespace Git { namespace Internal { GitSettings::GitSettings() : adoptPath(false), - logCount(defaultLogCount) + logCount(defaultLogCount), + timeout(defaultTimeOut) { } @@ -58,6 +60,7 @@ void GitSettings::fromSettings(QSettings *settings) adoptPath = settings->value(QLatin1String(sysEnvKeyC), false).toBool(); path = settings->value(QLatin1String(pathKeyC), QString()).toString(); logCount = settings->value(QLatin1String(logCountKeyC), defaultLogCount).toInt(); + timeout = settings->value(QLatin1String(timeoutKeyC), defaultTimeOut).toInt(); settings->endGroup(); } @@ -67,12 +70,13 @@ void GitSettings::toSettings(QSettings *settings) const settings->setValue(QLatin1String(sysEnvKeyC), adoptPath); settings->setValue(QLatin1String(pathKeyC), path); settings->setValue(QLatin1String(logCountKeyC), logCount); + settings->setValue(QLatin1String(timeoutKeyC), timeout); settings->endGroup(); } bool GitSettings::equals(const GitSettings &s) const { - return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount; + return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount && timeout == s.timeout; } } diff --git a/src/plugins/git/gitsettings.h b/src/plugins/git/gitsettings.h index 59169922605..c2463eb326d 100644 --- a/src/plugins/git/gitsettings.h +++ b/src/plugins/git/gitsettings.h @@ -56,6 +56,7 @@ struct GitSettings bool adoptPath; QString path; int logCount; + int timeout; }; inline bool operator==(const GitSettings &p1, const GitSettings &p2) diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp index a3b82194cec..121c7cd889b 100644 --- a/src/plugins/git/settingspage.cpp +++ b/src/plugins/git/settingspage.cpp @@ -52,6 +52,7 @@ GitSettings SettingsPageWidget::settings() const rc.path = m_ui.pathLineEdit->text(); rc.adoptPath = m_ui.environmentGroupBox->isChecked() && !rc.path.isEmpty(); rc.logCount = m_ui.logCountSpinBox->value(); + rc.timeout = m_ui.timeoutSpinBox->value(); return rc; } @@ -60,6 +61,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s) m_ui.environmentGroupBox->setChecked(s.adoptPath); m_ui.pathLineEdit->setText(s.path); m_ui.logCountSpinBox->setValue(s.logCount); + m_ui.timeoutSpinBox->setValue(s.timeout); } void SettingsPageWidget::setSystemPath() diff --git a/src/plugins/git/settingspage.ui b/src/plugins/git/settingspage.ui index 94c04493aab..1a594bf4313 100644 --- a/src/plugins/git/settingspage.ui +++ b/src/plugins/git/settingspage.ui @@ -7,7 +7,7 @@ 0 0 403 - 183 + 251 @@ -69,10 +69,14 @@ - - - QFormLayout::ExpandingFieldsGrow - + + + + + Log commit display count: + + + @@ -83,10 +87,23 @@ - - + + - Log commit display count: + Timeout (seconds): + + + + + + + 10 + + + 300 + + + 30 From 68d645fbf2734a894d3a91f16b984c23fb1bdfb5 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 13 Feb 2009 14:45:46 +0100 Subject: [PATCH 23/32] Fixes: debugger: put error message into log if loading of dumpers failed --- src/plugins/debugger/gdbengine.cpp | 33 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 3238862d355..07e842307a5 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -3946,11 +3946,12 @@ void GdbEngine::tryLoadCustomDumpers() return; PENDING_DEBUG("TRY LOAD CUSTOM DUMPERS"); - m_dataDumperState = DataDumperLoadTried; + m_dataDumperState = DataDumperUnavailable; #if defined(Q_OS_LINUX) QString lib = q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.so"; - if (QFileInfo(lib).isExecutable()) { + if (QFileInfo(lib).exists()) { + m_dataDumperState = DataDumperLoadTried; //sendCommand("p dlopen"); QString flag = QString::number(RTLD_NOW); sendCommand("sharedlibrary libc"); // for malloc @@ -3961,44 +3962,44 @@ void GdbEngine::tryLoadCustomDumpers() sendCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")", WatchDumpCustomSetup); sendCommand("sharedlibrary " + dotEscape(lib)); - } else { - qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: " - << lib << QFileInfo(lib).isExecutable(); } #endif #if defined(Q_OS_MAC) QString lib = q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.dylib"; - if (QFileInfo(lib).isExecutable()) { + if (QFileInfo(lib).exists()) { + m_dataDumperState = DataDumperLoadTried; sendCommand("sharedlibrary libc"); // for malloc sendCommand("sharedlibrary libdl"); // for dlopen QString flag = QString::number(RTLD_NOW); sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", WatchDumpCustomSetup); sendCommand("sharedlibrary " + dotEscape(lib)); - } else { - qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: " - << lib << QFileInfo(lib).isExecutable(); } #endif #if defined(Q_OS_WIN) QString lib = q->m_buildDir + "/qtc-gdbmacros/debug/gdbmacros.dll"; if (QFileInfo(lib).exists()) { + m_dataDumperState = DataDumperLoadTried; sendCommand("sharedlibrary .*"); // for LoadLibraryA //sendCommand("handle SIGSEGV pass stop print"); //sendCommand("set unwindonsignal off"); sendCommand("call LoadLibraryA(\"" + lib + "\")", WatchDumpCustomSetup); sendCommand("sharedlibrary " + dotEscape(lib)); - } else { - qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: " - << lib << QFileInfo(lib).isExecutable(); } #endif - // retreive list of dumpable classes - sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)", - GdbQueryDataDumper1); - sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper2); + if (m_dataDumperState == DataDumperLoadTried) { + // retreive list of dumpable classes + sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)", + GdbQueryDataDumper1); + sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper2); + } else { + gdbOutputAvailable("", QString("DEBUG HELPER LIBRARY IS NOT USABLE: " + " %1 EXISTS: %2, EXECUTABLE: %3").arg(lib) + .arg(QFileInfo(lib).exists()) + .arg(QFileInfo(lib).isExecutable())); + } } From 755dadfa7f1b9a86adbb3d71143a5970e809746a Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 13 Feb 2009 14:54:36 +0100 Subject: [PATCH 24/32] Fixes: debugger: don't run -file-list-exec-source-files too often --- src/plugins/debugger/gdbengine.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 07e842307a5..c0ce1fb7f6e 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -1194,8 +1194,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) if (isStoppedReason(reason) || reason.isEmpty()) { if (m_modulesListOutdated) { - sendCommand("-file-list-exec-source-files", GdbQuerySources); - sendCommand("-break-list", BreakList); reloadModules(); m_modulesListOutdated = false; } From 1f9a83e0739aa95037d0721837e05fb5ab50c6e4 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 13 Feb 2009 14:57:24 +0100 Subject: [PATCH 25/32] Fixes: debugger: remove some dead code --- src/plugins/debugger/gdbengine.cpp | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index c0ce1fb7f6e..aa96254d5a9 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -1195,6 +1195,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) if (isStoppedReason(reason) || reason.isEmpty()) { if (m_modulesListOutdated) { reloadModules(); +QT_END_INCLUDE_NAMESPACE m_modulesListOutdated = false; } // Need another round trip @@ -1248,30 +1249,6 @@ void GdbEngine::handleAsyncOutput2(const GdbMi &data) { qq->notifyInferiorStopped(); - // - // Breakpoints - // - //qDebug() << "BREAK ASYNC: " << data.toString(); - //sendListBreakpoints(); - //attemptBreakpointSynchronization(); - //if (m_breakListOnStopNeeded) - // sendListBreakpoints(); - - // something reasonably 'invariant' - // Linux: - //"79*stopped,reason="end-stepping-range",reason="breakpoint-hit",bkptno="1", - //thread-id="1",frame={addr="0x0000000000405d8f",func="run1", - //args=[{name="argc",value="1"},{name="argv",value="0x7fffb7c23058"}], - //file="test1.cpp",fullname="/home/apoenitz/dev/work/test1/test1.cpp" - //,line="261"}" - // Mac: (but only sometimes) - // "82*stopped,bkpt={number="0",type="step - // resume",disp="keep",enabled="y",addr="0x43127171",at="",thread="1",shlib="/Users/epreuss/dev/ide/main/bin/ - // workbench.app/Contents/PlugIns/Trolltech/libFind.1.0.0.dylib", - // frame="0xbfffd800",thread="1",times="1"}, - // // Stack // @@ -3461,8 +3438,6 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record, && msg.startsWith("The program being debugged stopped while") && msg.contains("qDumpObjectData440")) { // Fake full stop - sendCommand("-file-list-exec-source-files", GdbQuerySources); - sendCommand("-break-list", BreakList); sendCommand("p 0", GdbAsyncOutput2); // dummy return; } From e801434799f8f4b25028f63c2595bd810277edb7 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 13 Feb 2009 15:37:42 +0100 Subject: [PATCH 26/32] Improved the type pretty printer. --- src/libs/cplusplus/Overview.cpp | 9 +- src/libs/cplusplus/Overview.h | 5 +- src/libs/cplusplus/TypePrettyPrinter.cpp | 240 +++++++++++++---------- src/libs/cplusplus/TypePrettyPrinter.h | 28 +-- 4 files changed, 156 insertions(+), 126 deletions(-) diff --git a/src/libs/cplusplus/Overview.cpp b/src/libs/cplusplus/Overview.cpp index 2494d11ec5e..0f973753d0b 100644 --- a/src/libs/cplusplus/Overview.cpp +++ b/src/libs/cplusplus/Overview.cpp @@ -68,6 +68,11 @@ bool Overview::showReturnTypes() const return _showReturnTypes; } +unsigned Overview::markArgument() const +{ + return _markArgument; +} + void Overview::setMarkArgument(unsigned position) { _markArgument = position; @@ -98,9 +103,5 @@ QString Overview::prettyType(const FullySpecifiedType &ty, const QString &name) const { TypePrettyPrinter pp(this); - pp.setMarkArgument(_markArgument); - pp.setShowArgumentNames(_showArgumentNames); - pp.setShowReturnTypes(_showReturnTypes); - pp.setShowFunctionSignatures(_showFunctionSignatures); return pp(ty, name); } diff --git a/src/libs/cplusplus/Overview.h b/src/libs/cplusplus/Overview.h index fa1f3cf919f..6918ee45ff8 100644 --- a/src/libs/cplusplus/Overview.h +++ b/src/libs/cplusplus/Overview.h @@ -57,7 +57,10 @@ public: bool showFunctionSignatures() const; void setShowFunctionSignatures(bool showFunctionSignatures); - void setMarkArgument(unsigned position); // 1-based + // 1-based + // ### rename + unsigned markArgument() const; + void setMarkArgument(unsigned position); QString operator()(Name *name) const { return prettyName(name); } diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp index 6fd6a2cf245..6e46361b7f4 100644 --- a/src/libs/cplusplus/TypePrettyPrinter.cpp +++ b/src/libs/cplusplus/TypePrettyPrinter.cpp @@ -42,37 +42,12 @@ using namespace CPlusPlus; TypePrettyPrinter::TypePrettyPrinter(const Overview *overview) : _overview(overview), - _name(0), - _markArgument(0), - _showArgumentNames(false), - _showReturnTypes(false), - _showFunctionSignatures(true) + _name(0) { } TypePrettyPrinter::~TypePrettyPrinter() { } -bool TypePrettyPrinter::showArgumentNames() const -{ return _showArgumentNames; } - -void TypePrettyPrinter::setShowArgumentNames(bool showArgumentNames) -{ _showArgumentNames = showArgumentNames; } - -bool TypePrettyPrinter::showReturnTypes() const -{ return _showReturnTypes; } - -void TypePrettyPrinter::setShowReturnTypes(bool showReturnTypes) -{ _showReturnTypes = showReturnTypes; } - -bool TypePrettyPrinter::showFunctionSignatures() const -{ return _showFunctionSignatures; } - -void TypePrettyPrinter::setShowFunctionSignatures(bool showFunctionSignatures) -{ _showFunctionSignatures = showFunctionSignatures; } - -void TypePrettyPrinter::setMarkArgument(unsigned position) -{ _markArgument = position; } - const Overview *TypePrettyPrinter::overview() const { return _overview; } @@ -102,15 +77,16 @@ QString TypePrettyPrinter::operator()(const FullySpecifiedType &type, const QStr void TypePrettyPrinter::acceptType(const FullySpecifiedType &ty) { - if (ty.isConst()) - _text += QLatin1String("const "); - if (ty.isVolatile()) - _text += QLatin1String("volatile "); if (ty.isSigned()) - _text += QLatin1String("signed "); - if (ty.isUnsigned()) - _text += QLatin1String("unsigned "); + out(QLatin1String("signed ")); + + else if (ty.isUnsigned()) + out(QLatin1String("unsigned ")); + + const FullySpecifiedType previousFullySpecifiedType = _fullySpecifiedType; + _fullySpecifiedType = ty; accept(ty.type()); + _fullySpecifiedType = previousFullySpecifiedType; } QString TypePrettyPrinter::switchName(const QString &name) @@ -127,9 +103,9 @@ QString TypePrettyPrinter::switchText(const QString &name) return previousName; } -QList TypePrettyPrinter::switchPtrOperators(const QList &ptrOperators) +QList TypePrettyPrinter::switchPtrOperators(const QList &ptrOperators) { - QList previousPtrOperators = _ptrOperators; + QList previousPtrOperators = _ptrOperators; _ptrOperators = ptrOperators; return previousPtrOperators; } @@ -137,31 +113,53 @@ QList TypePrettyPrinter::switchPtrOperators(const QList &ptrOper void TypePrettyPrinter::applyPtrOperators(bool wantSpace) { for (int i = _ptrOperators.size() - 1; i != -1; --i) { - Type *op = _ptrOperators.at(i); + const FullySpecifiedType op = _ptrOperators.at(i); if (i == 0 && wantSpace) - _text += QLatin1Char(' '); + space(); - if (PointerType *ptrTy = op->asPointerType()) { - _text += QLatin1Char('*'); - if (ptrTy->elementType().isConst()) - _text += " const"; - if (ptrTy->elementType().isVolatile()) - _text += " volatile"; + if (op->isPointerType()) { + out(QLatin1Char('*')); + outCV(op); } else if (op->isReferenceType()) { - _text += QLatin1Char('&'); - } else if (PointerToMemberType *memPtrTy = op->asPointerToMemberType()) { - _text += QLatin1Char(' '); - _text += _overview->prettyName(memPtrTy->memberName()); - _text += QLatin1Char('*'); + out(QLatin1Char('&')); + } else if (const PointerToMemberType *memPtrTy = op->asPointerToMemberType()) { + space(); + out(_overview->prettyName(memPtrTy->memberName())); + out(QLatin1Char('*')); + outCV(op); } } } void TypePrettyPrinter::visit(VoidType *) { - _text += QLatin1String("void"); + out(QLatin1String("void")); + applyPtrOperators(); +} +void TypePrettyPrinter::visit(NamedType *type) +{ + out(overview()->prettyName(type->name())); + applyPtrOperators(); +} + +void TypePrettyPrinter::visit(Namespace *type) +{ + _text += overview()->prettyName(type->name()); + applyPtrOperators(); +} + +void TypePrettyPrinter::visit(Class *type) +{ + _text += overview()->prettyName(type->name()); + applyPtrOperators(); +} + + +void TypePrettyPrinter::visit(Enum *type) +{ + _text += overview()->prettyName(type->name()); applyPtrOperators(); } @@ -169,25 +167,25 @@ void TypePrettyPrinter::visit(IntegerType *type) { switch (type->kind()) { case IntegerType::Char: - _text += QLatin1String("char"); + out(QLatin1String("char")); break; case IntegerType::WideChar: - _text += QLatin1String("wchar_t"); + out(QLatin1String("wchar_t")); break; case IntegerType::Bool: - _text += QLatin1String("bool"); + out(QLatin1String("bool")); break; case IntegerType::Short: - _text += QLatin1String("short"); + out(QLatin1String("short")); break; case IntegerType::Int: - _text += QLatin1String("int"); + out(QLatin1String("int")); break; case IntegerType::Long: - _text += QLatin1String("long"); + out(QLatin1String("long")); break; case IntegerType::LongLong: - _text += QLatin1String("long long"); + out(QLatin1String("long long")); break; } @@ -198,13 +196,13 @@ void TypePrettyPrinter::visit(FloatType *type) { switch (type->kind()) { case FloatType::Float: - _text += QLatin1String("float"); + out(QLatin1String("float")); break; case FloatType::Double: - _text += QLatin1String("double"); + out(QLatin1String("double")); break; case FloatType::LongDouble: - _text += QLatin1String("long double"); + out(QLatin1String("long double")); break; } @@ -213,99 +211,135 @@ void TypePrettyPrinter::visit(FloatType *type) void TypePrettyPrinter::visit(PointerToMemberType *type) { - _ptrOperators.append(type); + outCV(type->elementType()); + space(); + + _ptrOperators.append(_fullySpecifiedType); acceptType(type->elementType()); } void TypePrettyPrinter::visit(PointerType *type) { - _ptrOperators.append(type); + outCV(type->elementType()); + space(); + + _ptrOperators.append(_fullySpecifiedType); acceptType(type->elementType()); } void TypePrettyPrinter::visit(ReferenceType *type) { - _ptrOperators.append(type); + outCV(type->elementType()); + space(); + + _ptrOperators.append(_fullySpecifiedType); acceptType(type->elementType()); } void TypePrettyPrinter::visit(ArrayType *type) { - _text += overview()->prettyType(type->elementType()); + out(overview()->prettyType(type->elementType())); if (! _ptrOperators.isEmpty()) { - _text += QLatin1Char('('); + out(QLatin1Char('(')); applyPtrOperators(false); if (! _name.isEmpty()) { - _text += _name; + out(_name); _name.clear(); } - _text += QLatin1Char(')'); + out(QLatin1Char(')')); } - _text += QLatin1String("[]"); -} - -void TypePrettyPrinter::visit(NamedType *type) -{ - _text += overview()->prettyName(type->name()); - applyPtrOperators(); + out(QLatin1String("[]")); } void TypePrettyPrinter::visit(Function *type) { - if (_showReturnTypes) - _text += _overview->prettyType(type->returnType()); + if (_overview->showReturnTypes()) + out(_overview->prettyType(type->returnType())); if (! _ptrOperators.isEmpty()) { - _text += QLatin1Char('('); + out(QLatin1Char('(')); applyPtrOperators(false); if (! _name.isEmpty()) { _text += _name; _name.clear(); } - _text += QLatin1Char(')'); - } else if (! _name.isEmpty() && _showFunctionSignatures) { - _text += QLatin1Char(' '); // ### fixme - _text += _name; + out(QLatin1Char(')')); + } else if (! _name.isEmpty() && _overview->showFunctionSignatures()) { + space(); + out(_name); _name.clear(); } - if (_showFunctionSignatures) { + if (_overview->showFunctionSignatures()) { Overview argumentText; - _text += QLatin1Char('('); + argumentText.setShowReturnTypes(true); + argumentText.setShowArgumentNames(false); + argumentText.setShowFunctionSignatures(true); + + out(QLatin1Char('(')); + for (unsigned index = 0; index < type->argumentCount(); ++index) { if (index != 0) - _text += QLatin1String(", "); + out(QLatin1String(", ")); if (Argument *arg = type->argumentAt(index)->asArgument()) { - if (index + 1 == _markArgument) - _text += QLatin1String(""); + if (index + 1 == _overview->markArgument()) + out(QLatin1String("")); + Name *name = 0; - if (_showArgumentNames) + + if (_overview->showArgumentNames()) name = arg->name(); - _text += argumentText(arg->type(), name); - if (index + 1 == _markArgument) - _text += QLatin1String(""); + + out(argumentText(arg->type(), name)); + + if (index + 1 == _overview->markArgument()) + out(QLatin1String("")); } } if (type->isVariadic()) - _text += QLatin1String("..."); + out(QLatin1String("...")); - _text += QLatin1Char(')'); - - if (type->isConst()) - _text += QLatin1String(" const"); - - if (type->isVolatile()) - _text += QLatin1String(" volatile"); + out(QLatin1Char(')')); + if (type->isConst() && type->isVolatile()) { + space(); + out("const volatile"); + } else if (type->isConst()) { + space(); + out("const"); + } else if (type->isVolatile()) { + space(); + out("volatile"); + } } } -void TypePrettyPrinter::visit(Namespace *type) -{ _text += overview()->prettyName(type->name()); } +void TypePrettyPrinter::space() +{ + if (_text.isEmpty()) + return; -void TypePrettyPrinter::visit(Class *type) -{ _text += overview()->prettyName(type->name()); } + const QChar ch = _text.at(_text.length() - 1); -void TypePrettyPrinter::visit(Enum *type) -{ _text += overview()->prettyName(type->name()); } + if (ch.isLetterOrNumber() || ch == QLatin1Char('_') || ch == QLatin1Char(')')) + _text += QLatin1Char(' '); +} + +void TypePrettyPrinter::out(const QString &text) +{ _text += text; } + +void TypePrettyPrinter::out(const QChar &ch) +{ _text += ch; } + +void TypePrettyPrinter::outCV(const FullySpecifiedType &ty) +{ + if (ty.isConst() && ty.isVolatile()) + out(QLatin1String("const volatile")); + + else if (ty.isConst()) + out(QLatin1String("const")); + + else if (ty.isVolatile()) + out(QLatin1String("volatile")); +} diff --git a/src/libs/cplusplus/TypePrettyPrinter.h b/src/libs/cplusplus/TypePrettyPrinter.h index 790999dc824..6191cf01af0 100644 --- a/src/libs/cplusplus/TypePrettyPrinter.h +++ b/src/libs/cplusplus/TypePrettyPrinter.h @@ -33,7 +33,8 @@ #ifndef TYPEPRETTYPRINTER_H #define TYPEPRETTYPRINTER_H -#include "TypeVisitor.h" +#include +#include #include #include @@ -50,23 +51,12 @@ public: const Overview *overview() const; - bool showArgumentNames() const; - void setShowArgumentNames(bool showArgumentNames); - - bool showReturnTypes() const; - void setShowReturnTypes(bool showReturnTypes); - - bool showFunctionSignatures() const; - void setShowFunctionSignatures(bool showFunctionSignatures); - - void setMarkArgument(unsigned position); // 1-based - QString operator()(const FullySpecifiedType &type); QString operator()(const FullySpecifiedType &type, const QString &name); protected: QString switchText(const QString &text = QString()); - QList switchPtrOperators(const QList &ptrOperators); + QList switchPtrOperators(const QList &ptrOperators); QString switchName(const QString &name); void applyPtrOperators(bool wantSpace = true); @@ -85,15 +75,17 @@ protected: virtual void visit(Class *type); virtual void visit(Enum *type); + void space(); + void out(const QString &text); + void out(const QChar &ch); + void outCV(const FullySpecifiedType &ty); + private: const Overview *_overview; QString _name; QString _text; - QList _ptrOperators; - unsigned _markArgument; - bool _showArgumentNames: 1; - bool _showReturnTypes: 1; - bool _showFunctionSignatures: 1; + FullySpecifiedType _fullySpecifiedType; + QList _ptrOperators; }; } // end of namespace CPlusPlus From 88bb93a66563621e63c0eb655c1c63683c4e527e Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 13 Feb 2009 15:54:50 +0100 Subject: [PATCH 27/32] --debug --- src/plugins/qt4projectmanager/qt4project.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 19de5ea3a30..d4741cdcfca 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -404,7 +404,8 @@ void Qt4Project::scheduleUpdateCodeModel() ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfiguration) const { - qDebug()<<"Qt4Project::toolChain() for buildconfiguration:"< Date: Fri, 13 Feb 2009 15:20:48 +0100 Subject: [PATCH 28/32] Reuse the function argument widget when possible Now that we're showing this thing instantly, we can no longer rely on the thing hiding cause of a focus change. --- src/plugins/cpptools/cppcodecompletion.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index ca1ef24bd4e..7bb3a36c40d 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -187,10 +187,10 @@ using namespace CppTools::Internal; FunctionArgumentWidget::FunctionArgumentWidget() : m_item(0) { - QObject *editorObject = Core::ICore::instance()->editorManager()->currentEditor(); + QObject *editorObject = Core::EditorManager::instance()->currentEditor(); m_editor = qobject_cast(editorObject); - m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint); + m_popupFrame = new QFrame(0, Qt::ToolTip | Qt::WindowStaysOnTopHint); m_popupFrame->setFocusPolicy(Qt::NoFocus); m_popupFrame->setAttribute(Qt::WA_DeleteOnClose); @@ -1069,7 +1069,10 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) Function *function = symbol->type()->asFunctionType(); QTC_ASSERT(function, return); - m_functionArgumentWidget = new FunctionArgumentWidget(); + // Recreate if necessary + if (!m_functionArgumentWidget) + m_functionArgumentWidget = new FunctionArgumentWidget; + m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot()); } } else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) { From 7c5fa0f06b6c184e4771060c627d9cf1e3ceb1c6 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 13 Feb 2009 16:55:24 +0100 Subject: [PATCH 29/32] Fixes: debugger: try fixing startup break on make --- src/plugins/debugger/gdbengine.cpp | 93 ++++++++++++++++-------------- src/plugins/debugger/gdbengine.h | 1 + 2 files changed, 51 insertions(+), 43 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index aa96254d5a9..381b28c4ef0 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -301,6 +301,7 @@ void GdbEngine::initializeVariables() m_outputCodec = QTextCodec::codecForLocale(); m_pendingRequests = 0; m_waitingForBreakpointSynchronizationToContinue = false; + m_waitingForFirstBreakpointToBeHit = false; } void GdbEngine::gdbProcError(QProcess::ProcessError error) @@ -1083,52 +1084,47 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) { const QString reason = data.findChild("reason").data(); - QString msg = data.findChild("consolestreamoutput").data(); - if (reason.isEmpty()) { - GdbMi frame = data.findChild("frame"); - if (frame.findChild("func").data() == startSymbolName()) { - // - // that's the "early stop" - // - frame.findChild("func").data() + '%'; - #if defined(Q_OS_WIN) - sendCommand("info proc", GdbInfoProc); - #endif - #if defined(Q_OS_LINUX) - sendCommand("info proc", GdbInfoProc); - #endif - #if defined(Q_OS_MAC) - sendCommand("info pid", GdbInfoProc, QVariant(), true); - #endif - sendCommand("-file-list-exec-source-files", GdbQuerySources); - tryLoadCustomDumpers(); + bool isFirstStop = data.findChild("bkptno").data() == "1"; + if (isFirstStop && m_waitingForFirstBreakpointToBeHit) { + // + // that's the "early stop" + // + #if defined(Q_OS_WIN) + sendCommand("info proc", GdbInfoProc); + #endif + #if defined(Q_OS_LINUX) + sendCommand("info proc", GdbInfoProc); + #endif + #if defined(Q_OS_MAC) + sendCommand("info pid", GdbInfoProc, QVariant(), true); + #endif + sendCommand("-file-list-exec-source-files", GdbQuerySources); + tryLoadCustomDumpers(); - // intentionally after tryLoadCustomDumpers(), - // otherwise we'd interupt solib loading. - if (qq->wantsAllPluginBreakpoints()) { - sendCommand("set auto-solib-add on"); - sendCommand("set stop-on-solib-events 0"); - sendCommand("sharedlibrary .*"); - } else if (qq->wantsSelectedPluginBreakpoints()) { - sendCommand("set auto-solib-add on"); - sendCommand("set stop-on-solib-events 1"); - sendCommand("sharedlibrary "+qq->selectedPluginBreakpointsPattern()); - } else if (qq->wantsNoPluginBreakpoints()) { - // should be like that already - sendCommand("set auto-solib-add off"); - sendCommand("set stop-on-solib-events 0"); - } - // nicer to see a bit of the world we live in - reloadModules(); - // this will "continue" if done - m_waitingForBreakpointSynchronizationToContinue = true; - QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization())); - return; + // intentionally after tryLoadCustomDumpers(), + // otherwise we'd interupt solib loading. + if (qq->wantsAllPluginBreakpoints()) { + sendCommand("set auto-solib-add on"); + sendCommand("set stop-on-solib-events 0"); + sendCommand("sharedlibrary .*"); + } else if (qq->wantsSelectedPluginBreakpoints()) { + sendCommand("set auto-solib-add on"); + sendCommand("set stop-on-solib-events 1"); + sendCommand("sharedlibrary "+qq->selectedPluginBreakpointsPattern()); + } else if (qq->wantsNoPluginBreakpoints()) { + // should be like that already + sendCommand("set auto-solib-add off"); + sendCommand("set stop-on-solib-events 0"); } - qDebug() << "EMPTY REASON FOR STOPPED"; - // fall through + // nicer to see a bit of the world we live in + reloadModules(); + // this will "continue" if done + m_waitingForBreakpointSynchronizationToContinue = true; + QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization())); + return; } + QString msg = data.findChild("consolestreamoutput").data(); if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) { if (qq->wantsSelectedPluginBreakpoints()) { qDebug() << "SHARED LIBRARY EVENT " << data.toString(); @@ -1142,6 +1138,17 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) // fall through } + // seen on XP after removing a breakpoint while running + // stdout:945*stopped,reason="signal-received",signal-name="SIGTRAP", + // signal-meaning="Trace/breakpoint trap",thread-id="2", + // frame={addr="0x7c91120f",func="ntdll!DbgUiConnectToDbg", + // args=[],from="C:\\WINDOWS\\system32\\ntdll.dll"} + if (reason == "signal-received" + && data.findChild("signal-name").toString() == "SIGTRAP") { + continueInferior(); + return; + } + if (isExitedReason(reason)) { qq->notifyInferiorExited(); QString msg = "Program exited normally"; @@ -1195,7 +1202,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) if (isStoppedReason(reason) || reason.isEmpty()) { if (m_modulesListOutdated) { reloadModules(); -QT_END_INCLUDE_NAMESPACE m_modulesListOutdated = false; } // Need another round trip @@ -1613,6 +1619,7 @@ void GdbEngine::handleStart(const GdbResultRecord &response) if (needle.indexIn(msg) != -1) { //qDebug() << "STREAM: " << msg << needle.cap(1); sendCommand("tbreak *0x" + needle.cap(1)); + m_waitingForFirstBreakpointToBeHit = true; sendCommand("-exec-run"); qq->notifyInferiorRunningRequested(); } else { diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index 58021fb765a..bf90ad97c99 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -330,6 +330,7 @@ private: QMap m_varToType; bool m_waitingForBreakpointSynchronizationToContinue; + bool m_waitingForFirstBreakpointToBeHit; bool m_modulesListOutdated; DebuggerManager *q; From 373a05af824ee2e75e8542e98832c634a5403b0f Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 13 Feb 2009 17:11:34 +0100 Subject: [PATCH 30/32] Fixes: debugger: try to extact pid from 'info threads' on windows --- src/plugins/debugger/gdbengine.cpp | 25 ++++++++++++++++++++++--- src/plugins/debugger/gdbengine.h | 1 + 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 381b28c4ef0..0641dac2114 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -112,6 +112,7 @@ enum GdbCommandType GdbExecInterrupt, GdbInfoShared, GdbInfoProc, + GdbInfoThreads, GdbQueryDataDumper1, GdbQueryDataDumper2, @@ -800,6 +801,9 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type, case GdbInfoProc: handleInfoProc(record); break; + case GdbInfoThreads: + handleInfoThreads(record); + break; case GdbShowVersion: handleShowVersion(record); @@ -993,6 +997,19 @@ void GdbEngine::handleQuerySources(const GdbResultRecord &record) } } +void GdbEngine::handleInfoThreads(const GdbResultRecord &record) +{ + if (record.resultClass == GdbResultDone) { + // FIXME: use something more robust + // WIN: * 3 Thread 2312.0x4d0 0x7c91120f in ?? () + // LINUX: * 1 Thread 0x7f466273c6f0 (LWP 21455) 0x0000000000404542 in ... + QRegExp re(QLatin1String("Thread (\\d+)\\.0x.* in")); + QString data = record.data.findChild("consolestreamoutput").data(); + if (re.indexIn(data) != -1) + maybeHandleInferiorPidChanged(re.cap(1)); + } +} + void GdbEngine::handleInfoProc(const GdbResultRecord &record) { if (record.resultClass == GdbResultDone) { @@ -1084,13 +1101,15 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) { const QString reason = data.findChild("reason").data(); - bool isFirstStop = data.findChild("bkptno").data() == "1"; - if (isFirstStop && m_waitingForFirstBreakpointToBeHit) { + //MAC: bool isFirstStop = data.findChild("bkptno").data() == "1"; + //!MAC: startSymbolName == data.findChild("frame").findChild("func") + if (m_waitingForFirstBreakpointToBeHit) { + m_waitingForFirstBreakpointToBeHit = false; // // that's the "early stop" // #if defined(Q_OS_WIN) - sendCommand("info proc", GdbInfoProc); + sendCommand("info thread", GdbInfoThreads); #endif #if defined(Q_OS_LINUX) sendCommand("info proc", GdbInfoProc); diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index bf90ad97c99..0d710e359cf 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -189,6 +189,7 @@ private: void handleExecRunToFunction(const GdbResultRecord &response); void handleInfoShared(const GdbResultRecord &response); void handleInfoProc(const GdbResultRecord &response); + void handleInfoThreads(const GdbResultRecord &response); void handleShowVersion(const GdbResultRecord &response); void handleQueryPwd(const GdbResultRecord &response); void handleQuerySources(const GdbResultRecord &response); From 0b4802c682ec3244f3c5dfbc9a666c47a79bd349 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 13 Feb 2009 17:43:06 +0100 Subject: [PATCH 31/32] Fixes: Possible crash in buildHelpId --- src/plugins/cppeditor/cpphoverhandler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp index 8f371bb2870..e47fbe65812 100644 --- a/src/plugins/cppeditor/cpphoverhandler.cpp +++ b/src/plugins/cppeditor/cpphoverhandler.cpp @@ -158,8 +158,10 @@ static QString buildHelpId(const FullySpecifiedType &type, scope = e->scope(); } else if (const NamedType *t = type->asNamedType()) { name = t->name(); - } else if (const Declaration *d = symbol->asDeclaration()) { - if (d->scope() && d->scope()->owner()->isEnum()) { + } else if (symbol && symbol->isDeclaration()) { + const Declaration *d = symbol->asDeclaration(); + + if (d->scope() && d->scope()->isEnumScope()) { name = d->name(); scope = d->scope(); } From f90706fa01cb6ed38a5047bf37eac67fcfe20baf Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 16 Feb 2009 09:59:12 +0100 Subject: [PATCH 32/32] Fixes: debugger: make shutdown a bit more robust --- src/plugins/debugger/debuggermanager.cpp | 138 ++++++++++++++++------- src/plugins/debugger/debuggermanager.h | 2 + 2 files changed, 98 insertions(+), 42 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 1898155a7ab..203bfc5b6b9 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -33,7 +33,6 @@ #include "debuggermanager.h" -#include "assert.h" #include "debuggerconstants.h" #include "idebuggerengine.h" @@ -58,6 +57,8 @@ #include "startexternaldialog.h" #include "attachexternaldialog.h" +#include + #include #include #include @@ -149,6 +150,7 @@ void DebuggerManager::init() { m_status = -1; m_busy = false; + m_shutdown = false; m_attachedPID = 0; m_startMode = startInternal; @@ -588,7 +590,18 @@ void DebuggerManager::showApplicationOutput(const QString &str) void DebuggerManager::shutdown() { //qDebug() << "DEBUGGER_MANAGER SHUTDOWN START"; - engine()->shutdown(); + m_shutdown = true; + if (m_engine) + m_engine->shutdown(); + m_engine = 0; + + delete scriptEngine; + scriptEngine = 0; + delete gdbEngine; + gdbEngine = 0; + delete winEngine; + winEngine = 0; + // Delete these manually before deleting the manager // (who will delete the models for most views) delete m_breakWindow; @@ -642,41 +655,49 @@ void DebuggerManager::toggleBreakpoint() void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber) { + QTC_ASSERT(m_engine, return); + QTC_ASSERT(m_breakHandler, return); int index = m_breakHandler->indexOf(fileName, lineNumber); if (index == -1) - breakHandler()->setBreakpoint(fileName, lineNumber); + m_breakHandler->setBreakpoint(fileName, lineNumber); else - breakHandler()->removeBreakpoint(index); - engine()->attemptBreakpointSynchronization(); + m_breakHandler->removeBreakpoint(index); + m_engine->attemptBreakpointSynchronization(); } void DebuggerManager::setToolTipExpression(const QPoint &pos, const QString &exp) { - engine()->setToolTipExpression(pos, exp); + QTC_ASSERT(m_engine, return); + m_engine->setToolTipExpression(pos, exp); } void DebuggerManager::updateWatchModel() { - engine()->updateWatchModel(); + QTC_ASSERT(m_engine, return); + m_engine->updateWatchModel(); } void DebuggerManager::expandChildren(const QModelIndex &idx) { - watchHandler()->expandChildren(idx); + QTC_ASSERT(m_watchHandler, return); + m_watchHandler->expandChildren(idx); } void DebuggerManager::collapseChildren(const QModelIndex &idx) { - watchHandler()->collapseChildren(idx); + QTC_ASSERT(m_watchHandler, return); + m_watchHandler->collapseChildren(idx); } void DebuggerManager::removeWatchExpression(const QString &exp) { - watchHandler()->removeWatchExpression(exp); + QTC_ASSERT(m_watchHandler, return); + m_watchHandler->removeWatchExpression(exp); } QVariant DebuggerManager::sessionValue(const QString &name) { + // this is answered by the plugin QVariant value; emit sessionValueRequested(name, &value); return value; @@ -684,16 +705,19 @@ QVariant DebuggerManager::sessionValue(const QString &name) void DebuggerManager::querySessionValue(const QString &name, QVariant *value) { + // this is answered by the plugin emit sessionValueRequested(name, value); } void DebuggerManager::setSessionValue(const QString &name, const QVariant &value) { + // this is answered by the plugin emit setSessionValueRequested(name, value); } QVariant DebuggerManager::configValue(const QString &name) { + // this is answered by the plugin QVariant value; emit configValueRequested(name, &value); return value; @@ -701,11 +725,13 @@ QVariant DebuggerManager::configValue(const QString &name) void DebuggerManager::queryConfigValue(const QString &name, QVariant *value) { + // this is answered by the plugin emit configValueRequested(name, value); } void DebuggerManager::setConfigValue(const QString &name, const QVariant &value) { + // this is answered by the plugin emit setConfigValueRequested(name, value); } @@ -788,7 +814,7 @@ bool DebuggerManager::startNewDebugger(StartMode mode) else setDebuggerType(GdbDebugger); - if (!engine()->startDebugger()) + if (!m_engine->startDebugger()) return false; m_busy = false; @@ -809,7 +835,10 @@ void DebuggerManager::cleanupViews() void DebuggerManager::exitDebugger() { - engine()->exitDebugger(); + if (m_shutdown) + return; + QTC_ASSERT(m_engine, return); + m_engine->exitDebugger(); cleanupViews(); setStatus(DebuggerProcessNotReady); setBusyCursor(false); @@ -818,62 +847,73 @@ void DebuggerManager::exitDebugger() void DebuggerManager::assignValueInDebugger(const QString &expr, const QString &value) { - engine()->assignValueInDebugger(expr, value); + QTC_ASSERT(m_engine, return); + m_engine->assignValueInDebugger(expr, value); } void DebuggerManager::activateFrame(int index) { - engine()->activateFrame(index); + QTC_ASSERT(m_engine, return); + m_engine->activateFrame(index); } void DebuggerManager::selectThread(int index) { - engine()->selectThread(index); + QTC_ASSERT(m_engine, return); + m_engine->selectThread(index); } void DebuggerManager::loadAllSymbols() { - engine()->loadAllSymbols(); + QTC_ASSERT(m_engine, return); + m_engine->loadAllSymbols(); } void DebuggerManager::loadSymbols(const QString &module) { - engine()->loadSymbols(module); + QTC_ASSERT(m_engine, return); + m_engine->loadSymbols(module); } void DebuggerManager::stepExec() { + QTC_ASSERT(m_engine, return); resetLocation(); - engine()->stepExec(); + m_engine->stepExec(); } void DebuggerManager::stepOutExec() { + QTC_ASSERT(m_engine, return); resetLocation(); - engine()->stepOutExec(); + m_engine->stepOutExec(); } void DebuggerManager::nextExec() { + QTC_ASSERT(m_engine, return); resetLocation(); - engine()->nextExec(); + m_engine->nextExec(); } void DebuggerManager::stepIExec() { + QTC_ASSERT(m_engine, return); resetLocation(); - engine()->stepIExec(); + m_engine->stepIExec(); } void DebuggerManager::nextIExec() { + QTC_ASSERT(m_engine, return); resetLocation(); - engine()->nextIExec(); + m_engine->nextIExec(); } void DebuggerManager::executeDebuggerCommand(const QString &command) { - engine()->executeDebuggerCommand(command); + QTC_ASSERT(m_engine, return); + m_engine->executeDebuggerCommand(command); } void DebuggerManager::sessionLoaded() @@ -891,16 +931,18 @@ void DebuggerManager::aboutToSaveSession() void DebuggerManager::loadSessionData() { + QTC_ASSERT(m_engine, return); m_breakHandler->loadSessionData(); m_watchHandler->loadSessionData(); - engine()->loadSessionData(); + m_engine->loadSessionData(); } void DebuggerManager::saveSessionData() { + QTC_ASSERT(m_engine, return); m_breakHandler->saveSessionData(); m_watchHandler->saveSessionData(); - engine()->saveSessionData(); + m_engine->saveSessionData(); } void DebuggerManager::dumpLog() @@ -959,19 +1001,24 @@ void DebuggerManager::addToWatchWindow() void DebuggerManager::watchExpression(const QString &expression) { - watchHandler()->watchExpression(expression); + QTC_ASSERT(m_watchHandler, return); + m_watchHandler->watchExpression(expression); } void DebuggerManager::setBreakpoint(const QString &fileName, int lineNumber) { - breakHandler()->setBreakpoint(fileName, lineNumber); - engine()->attemptBreakpointSynchronization(); + QTC_ASSERT(m_breakHandler, return); + QTC_ASSERT(m_engine, return); + m_breakHandler->setBreakpoint(fileName, lineNumber); + m_engine->attemptBreakpointSynchronization(); } void DebuggerManager::breakByFunction(const QString &functionName) { - breakHandler()->breakByFunction(functionName); - engine()->attemptBreakpointSynchronization(); + QTC_ASSERT(m_breakHandler, return); + QTC_ASSERT(m_engine, return); + m_breakHandler->breakByFunction(functionName); + m_engine->attemptBreakpointSynchronization(); } void DebuggerManager::breakByFunction() @@ -1081,14 +1128,16 @@ bool DebuggerManager::useCustomDumpers() const void DebuggerManager::setUseCustomDumpers(bool on) { + QTC_ASSERT(m_engine, return); m_settings.m_useCustomDumpers = on; - engine()->setUseCustomDumpers(on); + m_engine->setUseCustomDumpers(on); } void DebuggerManager::setDebugDumpers(bool on) { + QTC_ASSERT(m_engine, return); m_settings.m_debugDumpers = on; - engine()->setDebugDumpers(on); + m_engine->setDebugDumpers(on); } void DebuggerManager::setSkipKnownFrames(bool on) @@ -1104,29 +1153,31 @@ void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber, void DebuggerManager::continueExec() { - engine()->continueInferior(); + m_engine->continueInferior(); } void DebuggerManager::interruptDebuggingRequest() { + QTC_ASSERT(m_engine, return); //qDebug() << "INTERRUPTING AT" << status(); bool interruptIsExit = (status() != DebuggerInferiorRunning); if (interruptIsExit) exitDebugger(); else { setStatus(DebuggerInferiorStopRequested); - engine()->interruptInferior(); + m_engine->interruptInferior(); } } void DebuggerManager::runToLineExec() { + QTC_ASSERT(m_engine, return); QString fileName; int lineNumber = -1; emit currentTextEditorRequested(&fileName, &lineNumber, 0); if (!fileName.isEmpty()) - engine()->runToLineExec(fileName, lineNumber); + m_engine->runToLineExec(fileName, lineNumber); } void DebuggerManager::runToFunctionExec() @@ -1158,7 +1209,7 @@ void DebuggerManager::runToFunctionExec() } //qDebug() << "RUN TO FUNCTION " << functionName; if (!functionName.isEmpty()) - engine()->runToFunctionExec(functionName); + m_engine->runToFunctionExec(functionName); } void DebuggerManager::jumpToLineExec() @@ -1167,20 +1218,20 @@ void DebuggerManager::jumpToLineExec() int lineNumber = -1; emit currentTextEditorRequested(&fileName, &lineNumber, 0); if (!fileName.isEmpty()) - engine()->jumpToLineExec(fileName, lineNumber); + m_engine->jumpToLineExec(fileName, lineNumber); } void DebuggerManager::resetLocation() { - //m_watchHandler->removeMouseMoveCatcher(editor->widget()); + // connected to the plugin emit resetLocationRequested(); } void DebuggerManager::gotoLocation(const QString &fileName, int line, bool setMarker) { + // connected to the plugin emit gotoLocationRequested(fileName, line, setMarker); - //m_watchHandler->installMouseMoveCatcher(editor->widget()); } @@ -1192,9 +1243,10 @@ void DebuggerManager::gotoLocation(const QString &fileName, int line, void DebuggerManager::reloadDisassembler() { + QTC_ASSERT(m_engine, return); if (!m_disassemblerDock || !m_disassemblerDock->isVisible()) return; - engine()->reloadDisassembler(); + m_engine->reloadDisassembler(); } void DebuggerManager::disassemblerDockToggled(bool on) @@ -1214,7 +1266,7 @@ void DebuggerManager::reloadModules() { if (!m_modulesDock || !m_modulesDock->isVisible()) return; - engine()->reloadModules(); + m_engine->reloadModules(); } void DebuggerManager::modulesDockToggled(bool on) @@ -1232,11 +1284,13 @@ void DebuggerManager::modulesDockToggled(bool on) void DebuggerManager::showDebuggerOutput(const QString &prefix, const QString &msg) { + QTC_ASSERT(m_outputWindow, return); m_outputWindow->showOutput(prefix, msg); } void DebuggerManager::showDebuggerInput(const QString &prefix, const QString &msg) { + QTC_ASSERT(m_outputWindow, return); m_outputWindow->showInput(prefix, msg); } @@ -1257,7 +1311,7 @@ void DebuggerManager::reloadRegisters() { if (!m_registerDock || !m_registerDock->isVisible()) return; - engine()->reloadRegisters(); + m_engine->reloadRegisters(); } diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index a3407a0aa59..bd10b7b0259 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -466,6 +466,8 @@ private: IDebuggerEngine *engine(); IDebuggerEngine *m_engine; DebuggerSettings m_settings; + // set during application shutdown + bool m_shutdown; }; } // namespace Internal