Commit 60bb3616 authored by hjk's avatar hjk
Browse files

debugger: make position of debugger lib configurable

parent 1682a418
......@@ -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)
{}
......
......@@ -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
......
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment