Commit 380cb40f authored by hjk's avatar hjk

debugger: work on optional prebuild dumper library

parent 1c110388
......@@ -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();
}
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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();
}
......
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