diff options
author | hjk <qtc-committer@nokia.com> | 2009-02-12 13:04:01 +0100 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2009-02-12 13:04:01 +0100 |
commit | 6f64b19ebf8f7859d7266aa283a65485c1b1b782 (patch) | |
tree | 1023211be6757fa52b887ecfddb975baaac2493d /src/plugins | |
parent | b928f7b5701d35f030ad08640288bd3b8da2196e (diff) | |
download | qt-creator-6f64b19ebf8f7859d7266aa283a65485c1b1b782.tar.gz |
Fixes: debugger: work on plugin breakpoints
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/debugger/debuggermanager.cpp | 10 | ||||
-rw-r--r-- | src/plugins/debugger/debuggermanager.h | 16 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 2 | ||||
-rw-r--r-- | src/plugins/debugger/gdbengine.cpp | 98 | ||||
-rw-r--r-- | 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 60e91697b7..213edee43c 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 a43feb7e96..a3407a0aa5 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 aa3fca911f..18c7e6d0c5 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -282,6 +282,8 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) m_ui.radioButtonNoPluginBreakpoints-> setChecked(m_settings.m_pluginNoBreakpoints); m_ui.lineEditSelectedPluginBreakpointsPattern-> + setText(m_settings.m_pluginSelectedBreakpointsPattern); + m_ui.lineEditSelectedPluginBreakpointsPattern-> setEnabled(m_settings.m_pluginSelectedBreakpoints); m_ui.checkBoxSkipKnownFrames->setChecked(m_settings.m_skipKnownFrames); diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 97bca9381f..8b4051f839 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<Module> 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<GdbMi>(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 fbb56a1b4d..7973ef4c68 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<QString, QString> m_shortToFullName; |