Commit e7fea1aa authored by hjk's avatar hjk

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: default avatarhjk <qthjk@ovi.com>
parent ac9458e6
......@@ -79,7 +79,6 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
params.debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
if (ToolChain *tc = ToolChainProfileInformation::toolChain(profile))
params.toolChainAbi = tc->targetAbi();
params.dumperLibrary = runConfig->dumperLib();
params.executable = project(runConfig)->rootQt4ProjectNode()->buildDir() + QLatin1String("/app_process");
params.remoteChannel = runConfig->remoteChannel();
params.useServerStartScript = true;
......
......@@ -84,7 +84,6 @@ public:
virtual void setConfigValue(const QString &name, const QVariant &value) = 0;
virtual void updateState(DebuggerEngine *engine) = 0;
virtual void updateWatchersWindow(bool showWatch, bool showReturn) = 0;
virtual void showQtDumperLibraryWarning(const QString &details) = 0;
virtual QIcon locationMarkIcon() const = 0;
virtual const CPlusPlus::Snapshot &cppCodeModelSnapshot() const = 0;
virtual bool hasSnapshots() const = 0;
......
......@@ -686,36 +686,6 @@ DebuggerStartParameters &DebuggerEngine::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
{
return d->m_state;
......
......@@ -244,12 +244,6 @@ public:
DebuggerState targetState() 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);
void notifyInferiorPid(qint64 pid);
......
......@@ -795,7 +795,6 @@ public slots:
const CPlusPlus::Snapshot &cppCodeModelSnapshot() const;
void showQtDumperLibraryWarning(const QString &details);
DebuggerMainWindow *mainWindow() const { return m_mainWindow; }
bool isDockVisible(const QString &objectName) const
{ 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)
{
QDockWidget *dockWidget =
......@@ -2646,8 +2615,6 @@ static QString formatStartParameters(DebuggerStartParameters &sp)
<< sp.qmlServerPort << '\n';
if (!sp.remoteChannel.isEmpty()) {
str << "Remote: " << sp.remoteChannel << '\n';
if (!sp.remoteDumperLib.isEmpty())
str << "Remote dumpers: " << sp.remoteDumperLib << '\n';
if (!sp.remoteSourcesDir.isEmpty())
str << "Remote sources: " << sp.remoteSourcesDir << '\n';
if (!sp.remoteMountPoint.isEmpty())
......
......@@ -115,7 +115,6 @@ public:
QString searchPath; // Gdb "set solib-search-path"
QString debugInfoLocation; // Gdb "set-debug-file-directory".
QStringList debugSourceLocation; // Gdb "directory"
QByteArray remoteDumperLib;
QByteArray remoteSourcesDir;
QString remoteMountPoint;
QString localMountDir;
......
......@@ -39,6 +39,8 @@
#include "stackhandler.h"
#include "watchhandler.h"
#include <coreplugin/icore.h>
#include <qtsupport/qtsupportconstants.h>
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <utils/fileutils.h>
......@@ -46,6 +48,7 @@
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QPushButton>
#if !defined(Q_OS_WIN)
#include <dlfcn.h>
......@@ -1118,18 +1121,13 @@ void GdbEngine::tryLoadDebuggingHelpersClassic()
return;
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.
#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
// We are using Python on Windows and Symbian.
QTC_CHECK(false);
#elif defined(Q_OS_MAC)
QByteArray dlopenLib = startParameters().dumperLibrary.toLocal8Bit();
//postCommand("sharedlibrary libc"); // for malloc
//postCommand("sharedlibrary libdl"); // for dlopen
const QByteArray flag = QByteArray::number(RTLD_NOW);
......@@ -1138,6 +1136,7 @@ void GdbEngine::tryLoadDebuggingHelpersClassic()
CB(handleDebuggingHelperSetup));
//postCommand("sharedlibrary " + dotEscape(dlopenLib));
#else
QByteArray dlopenLib = startParameters().dumperLibrary.toLocal8Bit();
//postCommand("p dlopen");
const QByteArray flag = QByteArray::number(RTLD_NOW);
postCommand("sharedlibrary libc"); // for malloc
......@@ -1151,16 +1150,10 @@ void GdbEngine::tryLoadDebuggingHelpersClassic()
CB(handleDebuggingHelperSetup));
postCommand("sharedlibrary " + dotEscape(dlopenLib));
#endif
tryQueryDebuggingHelpersClassic();
}
void GdbEngine::tryQueryDebuggingHelpersClassic()
{
PRECONDITION;
// Retrieve list of dumpable classes.
postCommand("call (void*)qDumpObjectData440(1,0,0,0,0,0,0,0)");
postCommand("p (char*)&qDumpOutBuffer",
CB(handleQueryDebuggingHelperClassic));
postCommand("p (char*)&qDumpOutBuffer", CB(handleQueryDebuggingHelperClassic));
}
// Called from CoreAdapter and AttachAdapter
......@@ -1267,15 +1260,45 @@ void GdbEngine::handleStackListLocalsClassic(const GdbResponse &response)
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()
{
PRECONDITION;
if (!qtDumperLibraryEnabled())
if (!debuggerCore()->boolSetting(UseDebuggingHelpers))
return false;
const QString lib = qtDumperLibraryName();
const QString lib = startParameters().dumperLibrary;
if (QFileInfo(lib).exists())
return true;
const QStringList &locations = qtDumperLibraryLocations();
const QStringList &locations = startParameters().dumperLibraryLocations;
const QString loc = locations.join(QLatin1String(", "));
const QString msg = tr("The debugging helper library was not found at %1.")
.arg(loc);
......
......@@ -1851,10 +1851,8 @@ void GdbEngine::pythonDumpersFailed()
else
cmd += "LD_PRELOAD";
cmd += ' ';
if (sp.startMode == StartRemoteGdb)
cmd += sp.remoteDumperLib;
else
cmd += qtDumperLibraryName().toLocal8Bit();
if (sp.startMode != StartRemoteGdb)
cmd += sp.dumperLibrary.toLocal8Bit();
postCommand(cmd);
m_debuggingHelperState = DebuggingHelperLoadTried;
}
......
......@@ -646,7 +646,6 @@ protected:
bool checkDebuggingHelpersClassic();
void setDebuggingHelperStateClassic(DebuggingHelperState);
void tryLoadDebuggingHelpersClassic();
void tryQueryDebuggingHelpersClassic();
DebuggingHelperState m_debuggingHelperState;
DumperHelper m_dumperHelper;
......
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