diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index d1aa6ff33cb8603b88582a17db0df18e48a10f36..f7edac224f73d604c659ee75c8a5d3a7942cadf4 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -54,6 +54,7 @@ namespace Internal { DebuggerAction::DebuggerAction(QObject *parent) : QAction(parent) { + m_widget = 0; connect(this, SIGNAL(triggered(bool)), this, SLOT(actionTriggered(bool))); } @@ -126,8 +127,7 @@ QString DebuggerAction::toString() const { return "value: " + m_value.toString() + " defaultvalue: " + m_defaultValue.toString() - + " settingskey: " + m_settingsGroup + '/' + m_settingsKey - + " deferedValue: " + m_deferedValue.toString(); + + " settingskey: " + m_settingsGroup + '/' + m_settingsKey; } QAction *DebuggerAction::updatedAction(const QString &text0) @@ -173,9 +173,9 @@ void DebuggerAction::writeSettings(QSettings *settings) void DebuggerAction::connectWidget(QWidget *widget, ApplyMode applyMode) { using namespace Core::Utils; - //qDebug() << "CONNECT WIDGET " << widget << " TO " << m_settingsKey; - m_applyModes[widget] = applyMode; - m_deferedValue = m_value; + m_widget = widget; + m_applyMode = applyMode; + if (QAbstractButton *button = qobject_cast<QAbstractButton *>(widget)) { if (button->isCheckable()) { button->setChecked(m_value.toBool()); @@ -203,9 +203,16 @@ void DebuggerAction::connectWidget(QWidget *widget, ApplyMode applyMode) void DebuggerAction::apply(QSettings *s) { - setValue(m_deferedValue); + using namespace Core::Utils; + if (QAbstractButton *button = qobject_cast<QAbstractButton *>(m_widget)) + setValue(button->isChecked()); + else if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(m_widget)) + setValue(lineEdit->text()); + else if (PathChooser *pathChooser = qobject_cast<PathChooser *>(m_widget)) + setValue(pathChooser->path()); + m_widget = 0; if (s) - writeSettings(s); + writeSettings(s); } void DebuggerAction::uncheckableButtonClicked() @@ -221,9 +228,7 @@ void DebuggerAction::checkableButtonClicked(bool) QAbstractButton *button = qobject_cast<QAbstractButton *>(sender()); QTC_ASSERT(button, return); //qDebug() << "CHECKABLE BUTTON: " << sender(); - if (m_applyModes[sender()] == DeferedApply) - m_deferedValue = button->isChecked(); - else + if (m_applyMode == ImmediateApply) setValue(button->isChecked()); } @@ -232,9 +237,7 @@ void DebuggerAction::lineEditEditingFinished() QLineEdit *lineEdit = qobject_cast<QLineEdit *>(sender()); QTC_ASSERT(lineEdit, return); //qDebug() << "LINEEDIT: " << sender() << lineEdit->text(); - if (m_applyModes[sender()] == DeferedApply) - m_deferedValue = lineEdit->text(); - else + if (m_applyMode == ImmediateApply) setValue(lineEdit->text()); } @@ -244,9 +247,7 @@ void DebuggerAction::pathChooserEditingFinished() PathChooser *pathChooser = qobject_cast<PathChooser *>(sender()); QTC_ASSERT(pathChooser, return); //qDebug() << "PATHCHOOSER: " << sender() << pathChooser->path(); - if (m_applyModes[sender()] == DeferedApply) - m_deferedValue = pathChooser->path(); - else + if (m_applyMode == ImmediateApply) setValue(pathChooser->path()); } @@ -262,13 +263,13 @@ void DebuggerAction::trigger(const QVariant &data) QAction::trigger(); } + ////////////////////////////////////////////////////////////////////////// // // DebuggerSettings // ////////////////////////////////////////////////////////////////////////// - DebuggerSettings::DebuggerSettings(QObject *parent) : QObject(parent) {} diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index b635840df06921815ceb02aa708f4ba5e397f447..47ccfa9638620e4f8557a1825ea8ab10e27b587b 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -96,12 +96,12 @@ private: QVariant m_value; QVariant m_defaultValue; - QVariant m_deferedValue; // basically a temporary copy of m_value QString m_settingsKey; QString m_settingsGroup; QString m_textPattern; QString m_textData; - QHash<QObject *, ApplyMode> m_applyModes; + QWidget *m_widget; + ApplyMode m_applyMode; }; class DebuggerSettings : public QObject diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index c2c18dec377a78eee63a68d55dab30f4889cd0e0..535276b326cfde9604675929fc1b7a9989807092 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -4232,7 +4232,7 @@ void GdbEngine::assignValueInDebugger(const QString &expression, const QString & QString GdbEngine::dumperLibraryName() const { - if (theDebuggerAction(UsePrebuiltDumpers)) + if (theDebuggerAction(UsePrebuiltDumpers)->value().toBool()) return theDebuggerAction(PrebuiltDumpersLocation)->value().toString(); #if defined(Q_OS_WIN) return q->m_buildDir + "/qtc-gdbmacros/debug/gdbmacros.dll"; @@ -4252,48 +4252,45 @@ void GdbEngine::tryLoadCustomDumpers() m_dataDumperState = DataDumperUnavailable; QString lib = dumperLibraryName(); - if (QFileInfo(lib).exists()) { -#if defined(Q_OS_WIN) - 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)); -#elif defined(Q_OS_MAC) - 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)); - m_dataDumperState = DataDumperLoadTried; -#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 - sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)"); - sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper); - } else { + if (!QFileInfo(lib).exists()) { debugMessage(QString("DEBUG HELPER LIBRARY IS NOT USABLE: " " %1 EXISTS: %2, EXECUTABLE: %3").arg(lib) .arg(QFileInfo(lib).exists()) .arg(QFileInfo(lib).isExecutable())); + return; } + + m_dataDumperState = DataDumperLoadTried; +#if defined(Q_OS_WIN) + sendCommand("sharedlibrary .*"); // for LoadLibraryA + //sendCommand("handle SIGSEGV pass stop print"); + //sendCommand("set unwindonsignal off"); + sendCommand("call LoadLibraryA(\"" + lib + "\")", + WatchDumpCustomSetup); + sendCommand("sharedlibrary " + dotEscape(lib)); +#elif defined(Q_OS_MAC) + //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)); + m_dataDumperState = DataDumperLoadTried; +#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 + // retreive list of dumpable classes + sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)"); + sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper); } void GdbEngine::recheckCustomDumperAvailability()