diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index b336b638a3ad85384f8df33674d5403a8eed0ebc..d1aa6ff33cb8603b88582a17db0df18e48a10f36 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -32,6 +32,7 @@ #include <utils/qtcassert.h> #include <utils/pathchooser.h> +#include <QtCore/QDebug> #include <QtCore/QSettings> #include <QtGui/QAction> #include <QtGui/QAbstractButton> @@ -39,9 +40,11 @@ #include <QtGui/QCheckBox> #include <QtGui/QLineEdit> + namespace Debugger { namespace Internal { + ////////////////////////////////////////////////////////////////////////// // // DebuggerAction @@ -119,6 +122,14 @@ void DebuggerAction::setTextPattern(const QString &value) m_textPattern = value; } +QString DebuggerAction::toString() const +{ + return "value: " + m_value.toString() + + " defaultvalue: " + m_defaultValue.toString() + + " settingskey: " + m_settingsGroup + '/' + m_settingsKey + + " deferedValue: " + m_deferedValue.toString(); +} + QAction *DebuggerAction::updatedAction(const QString &text0) { QString text = text0; @@ -155,7 +166,7 @@ void DebuggerAction::writeSettings(QSettings *settings) return; settings->beginGroup(m_settingsGroup); settings->setValue(m_settingsKey, m_value); - //qDebug() << "WRITING: " << m_settingsKey << " -> " << m_value; + //qDebug() << "WRITING: " << m_settingsKey << " -> " << toString(); settings->endGroup(); } diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index a319fa668c2cce1ecebf8f5024a6ccb5abc37769..b635840df06921815ceb02aa708f4ba5e397f447 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -80,6 +80,8 @@ public: virtual QString textPattern() const; Q_SLOT virtual void setTextPattern(const QString &value); + QString toString() const; + signals: void valueChanged(const QVariant &newValue); void boolValueChanged(bool newValue); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 5f5aa0dd834412d9337626db2285d3ed3dede14c..2a66c1422e73e3b9fdb5adcc3e9c7f2ac9f06a65 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -378,6 +378,9 @@ QWidget *DumperOptionPage::createPage(QWidget *parent) m_ui.dumperLocationChooser->setInitialBrowsePathBackup( Core::ICore::instance()->resourcePath() + "../../lib"); + connect(m_ui.radioButtonUsePrebuiltDumpers, SIGNAL(toggled(bool)), + m_ui.dumperLocationChooser, SLOT(setEnabled(bool))); + theDebuggerAction(UsePrebuiltDumpers) ->connectWidget(m_ui.radioButtonUsePrebuiltDumpers); theDebuggerAction(BuildDumpersOnTheFly) @@ -392,8 +395,6 @@ QWidget *DumperOptionPage::createPage(QWidget *parent) m_ui.dumperLocationChooser-> setEnabled(theDebuggerAction(UsePrebuiltDumpers)->value().toBool()); - connect(m_ui.radioButtonUsePrebuiltDumpers, SIGNAL(toggled(bool)), - m_ui.dumperLocationChooser, SLOT(setEnabled(bool))); #ifndef QT_DEBUG #if 0 diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 8b5ed5ea018d2c05d3a4bff9f7d9fd602e560667..2a88a318acf269ca1a8457150923f32feabd7ffd 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -4230,6 +4230,19 @@ void GdbEngine::assignValueInDebugger(const QString &expression, const QString & sendCommand("-var-assign assign " + value, WatchVarAssign); } +QString GdbEngine::dumperLibraryName() const +{ + if (theDebuggerAction(UsePrebuiltDumpers)) + return theDebuggerAction(PrebuiltDumpersLocation)->value().toString(); +#if defined(Q_OS_WIN) + return q->m_buildDir + "/qtc-gdbmacros/debug/gdbmacros.dll"; +#elif defined(Q_OS_MAC) + retirn q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.dylib"; +#else // generic UNIX + return q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.so"; +#endif +} + void GdbEngine::tryLoadCustomDumpers() { if (m_dataDumperState != DataDumperUninitialized) @@ -4237,26 +4250,18 @@ void GdbEngine::tryLoadCustomDumpers() PENDING_DEBUG("TRY LOAD CUSTOM DUMPERS"); m_dataDumperState = DataDumperUnavailable; + QString lib = dumperLibraryName(); -#if defined(Q_OS_LINUX) - QString lib = q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.so"; if (QFileInfo(lib).exists()) { +#if defined(Q_OS_WIN) m_dataDumperState = DataDumperLoadTried; - //sendCommand("p dlopen"); - QString flag = QString::number(RTLD_NOW); - 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: - sendCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")", + sendCommand("sharedlibrary .*"); // for LoadLibraryA + //sendCommand("handle SIGSEGV pass stop print"); + //sendCommand("set unwindonsignal off"); + sendCommand("call LoadLibraryA(\"" + lib + "\")", WatchDumpCustomSetup); sendCommand("sharedlibrary " + dotEscape(lib)); - } -#endif -#if defined(Q_OS_MAC) - QString lib = q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.dylib"; - if (QFileInfo(lib).exists()) { +#elif defined(Q_OS_MAC) m_dataDumperState = DataDumperLoadTried; //sendCommand("sharedlibrary libc"); // for malloc //sendCommand("sharedlibrary libdl"); // for dlopen @@ -4264,20 +4269,20 @@ void GdbEngine::tryLoadCustomDumpers() sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", WatchDumpCustomSetup); //sendCommand("sharedlibrary " + dotEscape(lib)); - } -#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 + "\")", +#else + //sendCommand("p dlopen"); + QString flag = QString::number(RTLD_NOW); + 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: + sendCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")", WatchDumpCustomSetup); sendCommand("sharedlibrary " + dotEscape(lib)); - } #endif + } if (m_dataDumperState == DataDumperLoadTried) { // retreive list of dumpable classes diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index d0186493972a9ab1d7d32fe81fbb8fe3c22e2c60..20c9c222877b92dfbdb544ba90f5dfd8990a03f3 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -199,6 +199,7 @@ private: void handleQuerySources(const GdbResultRecord &response); void handleTargetCore(const GdbResultRecord &response); void debugMessage(const QString &msg); + QString dumperLibraryName() const; OutputCollector m_outputCollector; QTextCodec *m_outputCodec; diff --git a/src/plugins/debugger/gdbmi.cpp b/src/plugins/debugger/gdbmi.cpp index e2e11e07ba13a7b28bebb6a79e44f5e05f2c4e89..2e778cb8e83c9b6965f56ccc7c81d6a0cf65def8 100644 --- a/src/plugins/debugger/gdbmi.cpp +++ b/src/plugins/debugger/gdbmi.cpp @@ -37,7 +37,7 @@ namespace Debugger { namespace Internal { -QTextStream & operator<<(QTextStream & os, const GdbMi & mi) +QTextStream &operator<<(QTextStream &os, const GdbMi &mi) { return os << mi.toString(); }