debugger: streamline classical dumper setup

Remote dumpers are not used anymore, there's also no need to
have it in the engine base class anymore.

Change-Id: If0b6930b07e468d5973d848e02696bc5da40a197
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2012-08-09 04:47:47 +02:00
parent ac9458e664
commit e7fea1aa7a
9 changed files with 41 additions and 93 deletions

View File

@@ -79,7 +79,6 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
params.debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString(); params.debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
if (ToolChain *tc = ToolChainProfileInformation::toolChain(profile)) if (ToolChain *tc = ToolChainProfileInformation::toolChain(profile))
params.toolChainAbi = tc->targetAbi(); params.toolChainAbi = tc->targetAbi();
params.dumperLibrary = runConfig->dumperLib();
params.executable = project(runConfig)->rootQt4ProjectNode()->buildDir() + QLatin1String("/app_process"); params.executable = project(runConfig)->rootQt4ProjectNode()->buildDir() + QLatin1String("/app_process");
params.remoteChannel = runConfig->remoteChannel(); params.remoteChannel = runConfig->remoteChannel();
params.useServerStartScript = true; params.useServerStartScript = true;

View File

@@ -84,7 +84,6 @@ public:
virtual void setConfigValue(const QString &name, const QVariant &value) = 0; virtual void setConfigValue(const QString &name, const QVariant &value) = 0;
virtual void updateState(DebuggerEngine *engine) = 0; virtual void updateState(DebuggerEngine *engine) = 0;
virtual void updateWatchersWindow(bool showWatch, bool showReturn) = 0; virtual void updateWatchersWindow(bool showWatch, bool showReturn) = 0;
virtual void showQtDumperLibraryWarning(const QString &details) = 0;
virtual QIcon locationMarkIcon() const = 0; virtual QIcon locationMarkIcon() const = 0;
virtual const CPlusPlus::Snapshot &cppCodeModelSnapshot() const = 0; virtual const CPlusPlus::Snapshot &cppCodeModelSnapshot() const = 0;
virtual bool hasSnapshots() const = 0; virtual bool hasSnapshots() const = 0;

View File

@@ -686,36 +686,6 @@ DebuggerStartParameters &DebuggerEngine::startParameters()
return d->m_startParameters; return d->m_startParameters;
} }
//////////////////////////////////////////////////////////////////////
//
// Dumpers. "Custom dumpers" are a library compiled against the current
// Qt containing functions to evaluate values of Qt classes
// (such as QString, taking pointers to their addresses).
// The library must be loaded into the debuggee.
//
//////////////////////////////////////////////////////////////////////
bool DebuggerEngine::qtDumperLibraryEnabled() const
{
return debuggerCore()->boolSetting(UseDebuggingHelpers);
}
QStringList DebuggerEngine::qtDumperLibraryLocations() const
{
return d->m_startParameters.dumperLibraryLocations;
}
void DebuggerEngine::showQtDumperLibraryWarning(const QString &details)
{
debuggerCore()->showQtDumperLibraryWarning(details);
}
QString DebuggerEngine::qtDumperLibraryName() const
{
return startParameters().dumperLibrary;
}
DebuggerState DebuggerEngine::state() const DebuggerState DebuggerEngine::state() const
{ {
return d->m_state; return d->m_state;

View File

@@ -244,12 +244,6 @@ public:
DebuggerState targetState() const; DebuggerState targetState() const;
bool isDying() const; bool isDying() const;
// Dumper stuff (common to cdb and gdb).
bool qtDumperLibraryEnabled() const;
QString qtDumperLibraryName() const;
QStringList qtDumperLibraryLocations() const;
void showQtDumperLibraryWarning(const QString &details);
static const char *stateName(int s); static const char *stateName(int s);
void notifyInferiorPid(qint64 pid); void notifyInferiorPid(qint64 pid);

View File

@@ -795,7 +795,6 @@ public slots:
const CPlusPlus::Snapshot &cppCodeModelSnapshot() const; const CPlusPlus::Snapshot &cppCodeModelSnapshot() const;
void showQtDumperLibraryWarning(const QString &details);
DebuggerMainWindow *mainWindow() const { return m_mainWindow; } DebuggerMainWindow *mainWindow() const { return m_mainWindow; }
bool isDockVisible(const QString &objectName) const bool isDockVisible(const QString &objectName) const
{ return mainWindow()->isDockVisible(objectName); } { return mainWindow()->isDockVisible(objectName); }
@@ -2558,36 +2557,6 @@ void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int tim
} }
} }
void DebuggerPluginPrivate::showQtDumperLibraryWarning(const QString &details)
{
QMessageBox dialog(mainWindow());
QPushButton *qtPref = dialog.addButton(tr("Open Qt Options"),
QMessageBox::ActionRole);
QPushButton *helperOff = dialog.addButton(tr("Turn off Helper Usage"),
QMessageBox::ActionRole);
QPushButton *justContinue = dialog.addButton(tr("Continue Anyway"),
QMessageBox::AcceptRole);
dialog.setDefaultButton(justContinue);
dialog.setWindowTitle(tr("Debugging Helper Missing"));
dialog.setText(tr("The debugger could not load the debugging helper library."));
dialog.setInformativeText(tr(
"The debugging helper is used to nicely format the values of some Qt "
"and Standard Library data types. "
"It must be compiled for each used Qt version separately. "
"In the Qt Creator Build and Run preferences page, select a Qt version, "
"expand the Details section and click Build All."));
if (!details.isEmpty())
dialog.setDetailedText(details);
dialog.exec();
if (dialog.clickedButton() == qtPref) {
ICore::showOptionsDialog(
_(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
_(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID));
} else if (dialog.clickedButton() == helperOff) {
action(UseDebuggingHelpers)->setValue(qVariantFromValue(false), false);
}
}
void DebuggerPluginPrivate::createNewDock(QWidget *widget) void DebuggerPluginPrivate::createNewDock(QWidget *widget)
{ {
QDockWidget *dockWidget = QDockWidget *dockWidget =
@@ -2646,8 +2615,6 @@ static QString formatStartParameters(DebuggerStartParameters &sp)
<< sp.qmlServerPort << '\n'; << sp.qmlServerPort << '\n';
if (!sp.remoteChannel.isEmpty()) { if (!sp.remoteChannel.isEmpty()) {
str << "Remote: " << sp.remoteChannel << '\n'; str << "Remote: " << sp.remoteChannel << '\n';
if (!sp.remoteDumperLib.isEmpty())
str << "Remote dumpers: " << sp.remoteDumperLib << '\n';
if (!sp.remoteSourcesDir.isEmpty()) if (!sp.remoteSourcesDir.isEmpty())
str << "Remote sources: " << sp.remoteSourcesDir << '\n'; str << "Remote sources: " << sp.remoteSourcesDir << '\n';
if (!sp.remoteMountPoint.isEmpty()) if (!sp.remoteMountPoint.isEmpty())

View File

@@ -115,7 +115,6 @@ public:
QString searchPath; // Gdb "set solib-search-path" QString searchPath; // Gdb "set solib-search-path"
QString debugInfoLocation; // Gdb "set-debug-file-directory". QString debugInfoLocation; // Gdb "set-debug-file-directory".
QStringList debugSourceLocation; // Gdb "directory" QStringList debugSourceLocation; // Gdb "directory"
QByteArray remoteDumperLib;
QByteArray remoteSourcesDir; QByteArray remoteSourcesDir;
QString remoteMountPoint; QString remoteMountPoint;
QString localMountDir; QString localMountDir;

View File

@@ -39,6 +39,8 @@
#include "stackhandler.h" #include "stackhandler.h"
#include "watchhandler.h" #include "watchhandler.h"
#include <coreplugin/icore.h>
#include <qtsupport/qtsupportconstants.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
@@ -46,6 +48,7 @@
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton>
#if !defined(Q_OS_WIN) #if !defined(Q_OS_WIN)
#include <dlfcn.h> #include <dlfcn.h>
@@ -1118,18 +1121,13 @@ void GdbEngine::tryLoadDebuggingHelpersClassic()
return; return;
m_debuggingHelperState = DebuggingHelperLoadTried; m_debuggingHelperState = DebuggingHelperLoadTried;
QByteArray dlopenLib;
const DebuggerStartMode startMode = startParameters().startMode;
if (startMode == AttachToRemoteServer || startMode == StartRemoteGdb)
dlopenLib = startParameters().remoteDumperLib;
else
dlopenLib = qtDumperLibraryName().toLocal8Bit();
// Do not use STRINGIFY for RTLD_NOW as we really want to expand that to a number. // Do not use STRINGIFY for RTLD_NOW as we really want to expand that to a number.
#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
// We are using Python on Windows and Symbian. // We are using Python on Windows and Symbian.
QTC_CHECK(false); QTC_CHECK(false);
#elif defined(Q_OS_MAC) #elif defined(Q_OS_MAC)
QByteArray dlopenLib = startParameters().dumperLibrary.toLocal8Bit();
//postCommand("sharedlibrary libc"); // for malloc //postCommand("sharedlibrary libc"); // for malloc
//postCommand("sharedlibrary libdl"); // for dlopen //postCommand("sharedlibrary libdl"); // for dlopen
const QByteArray flag = QByteArray::number(RTLD_NOW); const QByteArray flag = QByteArray::number(RTLD_NOW);
@@ -1138,6 +1136,7 @@ void GdbEngine::tryLoadDebuggingHelpersClassic()
CB(handleDebuggingHelperSetup)); CB(handleDebuggingHelperSetup));
//postCommand("sharedlibrary " + dotEscape(dlopenLib)); //postCommand("sharedlibrary " + dotEscape(dlopenLib));
#else #else
QByteArray dlopenLib = startParameters().dumperLibrary.toLocal8Bit();
//postCommand("p dlopen"); //postCommand("p dlopen");
const QByteArray flag = QByteArray::number(RTLD_NOW); const QByteArray flag = QByteArray::number(RTLD_NOW);
postCommand("sharedlibrary libc"); // for malloc postCommand("sharedlibrary libc"); // for malloc
@@ -1151,16 +1150,10 @@ void GdbEngine::tryLoadDebuggingHelpersClassic()
CB(handleDebuggingHelperSetup)); CB(handleDebuggingHelperSetup));
postCommand("sharedlibrary " + dotEscape(dlopenLib)); postCommand("sharedlibrary " + dotEscape(dlopenLib));
#endif #endif
tryQueryDebuggingHelpersClassic();
}
void GdbEngine::tryQueryDebuggingHelpersClassic()
{
PRECONDITION;
// Retrieve list of dumpable classes. // Retrieve list of dumpable classes.
postCommand("call (void*)qDumpObjectData440(1,0,0,0,0,0,0,0)"); postCommand("call (void*)qDumpObjectData440(1,0,0,0,0,0,0,0)");
postCommand("p (char*)&qDumpOutBuffer", postCommand("p (char*)&qDumpOutBuffer", CB(handleQueryDebuggingHelperClassic));
CB(handleQueryDebuggingHelperClassic));
} }
// Called from CoreAdapter and AttachAdapter // Called from CoreAdapter and AttachAdapter
@@ -1267,15 +1260,45 @@ void GdbEngine::handleStackListLocalsClassic(const GdbResponse &response)
watchHandler()->updateWatchers(); watchHandler()->updateWatchers();
} }
static void showQtDumperLibraryWarning(const QString &details)
{
QMessageBox dialog(debuggerCore()->mainWindow());
QPushButton *qtPref = dialog.addButton(DebuggerCore::tr("Open Qt Options"),
QMessageBox::ActionRole);
QPushButton *helperOff = dialog.addButton(DebuggerCore::tr("Turn off Helper Usage"),
QMessageBox::ActionRole);
QPushButton *justContinue = dialog.addButton(DebuggerCore::tr("Continue Anyway"),
QMessageBox::AcceptRole);
dialog.setDefaultButton(justContinue);
dialog.setWindowTitle(DebuggerCore::tr("Debugging Helper Missing"));
dialog.setText(DebuggerCore::tr("The debugger could not load the debugging helper library."));
dialog.setInformativeText(DebuggerCore::tr(
"The debugging helper is used to nicely format the values of some Qt "
"and Standard Library data types. "
"It must be compiled for each used Qt version separately. "
"In the Qt Creator Build and Run preferences page, select a Qt version, "
"expand the Details section and click Build All."));
if (!details.isEmpty())
dialog.setDetailedText(details);
dialog.exec();
if (dialog.clickedButton() == qtPref) {
Core::ICore::showOptionsDialog(
_(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
_(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID));
} else if (dialog.clickedButton() == helperOff) {
debuggerCore()->action(UseDebuggingHelpers)->setValue(qVariantFromValue(false), false);
}
}
bool GdbEngine::checkDebuggingHelpersClassic() bool GdbEngine::checkDebuggingHelpersClassic()
{ {
PRECONDITION; PRECONDITION;
if (!qtDumperLibraryEnabled()) if (!debuggerCore()->boolSetting(UseDebuggingHelpers))
return false; return false;
const QString lib = qtDumperLibraryName(); const QString lib = startParameters().dumperLibrary;
if (QFileInfo(lib).exists()) if (QFileInfo(lib).exists())
return true; return true;
const QStringList &locations = qtDumperLibraryLocations(); const QStringList &locations = startParameters().dumperLibraryLocations;
const QString loc = locations.join(QLatin1String(", ")); const QString loc = locations.join(QLatin1String(", "));
const QString msg = tr("The debugging helper library was not found at %1.") const QString msg = tr("The debugging helper library was not found at %1.")
.arg(loc); .arg(loc);

View File

@@ -1851,10 +1851,8 @@ void GdbEngine::pythonDumpersFailed()
else else
cmd += "LD_PRELOAD"; cmd += "LD_PRELOAD";
cmd += ' '; cmd += ' ';
if (sp.startMode == StartRemoteGdb) if (sp.startMode != StartRemoteGdb)
cmd += sp.remoteDumperLib; cmd += sp.dumperLibrary.toLocal8Bit();
else
cmd += qtDumperLibraryName().toLocal8Bit();
postCommand(cmd); postCommand(cmd);
m_debuggingHelperState = DebuggingHelperLoadTried; m_debuggingHelperState = DebuggingHelperLoadTried;
} }

View File

@@ -646,7 +646,6 @@ protected:
bool checkDebuggingHelpersClassic(); bool checkDebuggingHelpersClassic();
void setDebuggingHelperStateClassic(DebuggingHelperState); void setDebuggingHelperStateClassic(DebuggingHelperState);
void tryLoadDebuggingHelpersClassic(); void tryLoadDebuggingHelpersClassic();
void tryQueryDebuggingHelpersClassic();
DebuggingHelperState m_debuggingHelperState; DebuggingHelperState m_debuggingHelperState;
DumperHelper m_dumperHelper; DumperHelper m_dumperHelper;