Commit 3fcf39a7 authored by hjk's avatar hjk

debugger: finish moving of binary setting

parent e1c20ea1
......@@ -14,24 +14,24 @@
<item>
<widget class="QGroupBox" name="behaviorBox">
<property name="title">
<string>GUI Behavior</string>
<string>Behavior</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxUseAlternatingRowColors">
<property name="text">
<string>Use alternating row colors in debug views</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxUseToolTipsInMainEditor">
<property name="text">
<string>Use tooltips in main editor while debugging</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxListSourceFiles">
<property name="toolTip">
<string>Checking this will populate the source file view automatically but might slow down debugger startup considerably.</string>
......@@ -41,7 +41,7 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxRegisterForPostMortem">
<property name="toolTip">
<string>Register Qt Creator for debugging crashed applications.</string>
......@@ -51,7 +51,7 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxCloseBuffersOnExit">
<property name="toolTip">
<string>Close temporary buffers on debugger exit.</string>
......@@ -61,7 +61,7 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxSwitchModeOnExit">
<property name="toolTip">
<string>Switch to previous mode on debugger exit.</string>
......@@ -71,7 +71,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="labelMaximalStackDepth">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
......@@ -84,7 +84,7 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSpinBox" name="spinBoxMaximalStackDepth">
......@@ -129,6 +129,18 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>External Debuggers</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="Debugger::Internal::DebuggerChooserWidget" name="debuggerChooserWidget" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......@@ -144,6 +156,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Debugger::Internal::DebuggerChooserWidget</class>
<extends>QWidget</extends>
<header>debuggerchooserwidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -24,6 +24,7 @@ HEADERS += breakhandler.h \
consolewindow.h \
debugger_global.h \
debuggeractions.h \
debuggerchooserwidget.h \
debuggercore.h \
debuggerconstants.h \
debuggerdialogs.h \
......@@ -70,6 +71,7 @@ SOURCES += breakhandler.cpp \
commonoptionspage.cpp \
consolewindow.cpp \
debuggeractions.cpp \
debuggerchooserwidget.cpp \
debuggerdialogs.cpp \
debuggerengine.cpp \
debuggermainwindow.cpp \
......
......@@ -31,31 +31,33 @@
**
**************************************************************************/
#include "gdbchooserwidget.h"
#include "debuggerchooserwidget.h"
#include <utils/pathchooser.h>
#include <projectexplorer/toolchain.h>
#include <coreplugin/coreconstants.h>
#include <projectexplorer/toolchain.h>
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
#include <QtGui/QTreeView>
#include <QtGui/QStandardItemModel>
#include <QtGui/QStandardItem>
#include <QtGui/QToolButton>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QProcess>
#include <QtCore/QSet>
#include <QtGui/QCheckBox>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QFormLayout>
#include <QtGui/QVBoxLayout>
#include <QtGui/QGroupBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QIcon>
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
#include <QtGui/QIcon>
#include <QtGui/QGroupBox>
#include <QtGui/QCheckBox>
#include <QtCore/QSet>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QProcess>
#include <QtGui/QStandardItem>
#include <QtGui/QStandardItemModel>
#include <QtGui/QToolButton>
#include <QtGui/QTreeView>
#include <QtGui/QVBoxLayout>
enum Columns { abiColumn, binaryColumn, ColumnCount };
......@@ -66,18 +68,19 @@ namespace Internal {
// -----------------------------------------------
// Obtain a tooltip for a gdb binary by running --version
static inline QString gdbToolTip(const QString &binary)
// Obtain a tooltip for a debugger binary by running --version
static QString debuggerToolTip(const QString &binary)
{
if (binary.isEmpty())
return QString();
if (!QFileInfo(binary).exists())
return GdbChooserWidget::tr("File not found.");
return DebuggerChooserWidget::tr("File not found.");
QProcess process;
process.start(binary, QStringList(QLatin1String("--version")));
process.closeWriteChannel();
if (!process.waitForStarted())
return GdbChooserWidget::tr("Unable to run '%1': %2").arg(binary, process.errorString());
return DebuggerChooserWidget::tr("Unable to run '%1': %2")
.arg(binary, process.errorString());
process.waitForFinished(); // That should never fail
QString rc = QDir::toNativeSeparators(binary);
rc += QLatin1String("\n\n");
......@@ -86,19 +89,20 @@ static inline QString gdbToolTip(const QString &binary)
return rc;
}
// GdbBinaryModel: Show gdb binaries and associated toolchains as a list.
// Provides a delayed tooltip listing the gdb version as
// DebuggerBinaryModel: Show toolchains and associated debugger binaries.
// Provides a delayed tooltip listing the debugger version as
// obtained by running it. Provides conveniences for getting/setting the maps and
// for listing the toolchains used and the ones still available.
class GdbBinaryModel : public QStandardItemModel {
class DebuggerBinaryModel : public QStandardItemModel
{
public:
explicit GdbBinaryModel(QObject * parent = 0);
explicit DebuggerBinaryModel(QObject *parent = 0);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
// get / set data as map.
QMap<QString, QString> gdbMapping() const;
void setGdbMapping(const QMap<QString, QString> &m);
QMap<QString, QString> debuggerMapping() const;
void setDebuggerMapping(const QMap<QString, QString> &m);
QString binary(int row) const;
QString abi(int row) const;
......@@ -111,23 +115,24 @@ public:
static void setBinaryItem(QStandardItem *item, const QString &binary);
};
GdbBinaryModel::GdbBinaryModel(QObject *parent) :
DebuggerBinaryModel::DebuggerBinaryModel(QObject *parent) :
QStandardItemModel(0, ColumnCount, parent)
{
QStringList headers;
headers << GdbChooserWidget::tr("ABI") << GdbChooserWidget::tr("Debugger");
headers.append(DebuggerChooserWidget::tr("ABI"));
headers.append(DebuggerChooserWidget::tr("Debugger"));
setHorizontalHeaderLabels(headers);
}
QVariant GdbBinaryModel::data(const QModelIndex &index, int role) const
QVariant DebuggerBinaryModel::data(const QModelIndex &index, int role) const
{
if (index.isValid() && role == Qt::ToolTipRole) {
// Is there a tooltip set?
const QString itemToolTip = itemFromIndex(index)->toolTip();
if (!itemToolTip.isEmpty())
return QVariant(itemToolTip);
// Run the gdb and obtain the tooltip
const QString tooltip = gdbToolTip(binary(index.row()));
// Run the debugger and obtain the tooltip
const QString tooltip = debuggerToolTip(binary(index.row()));
// Set on the whole row
item(index.row(), abiColumn)->setToolTip(tooltip);
item(index.row(), binaryColumn)->setToolTip(tooltip);
......@@ -136,7 +141,7 @@ QVariant GdbBinaryModel::data(const QModelIndex &index, int role) const
return QStandardItemModel::data(index, role);
}
bool GdbBinaryModel::setData(const QModelIndex &index, const QVariant &value, int role)
bool DebuggerBinaryModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (index.isValid() && role == Qt::EditRole) {
Q_ASSERT(index.column() == binaryColumn);
......@@ -150,7 +155,7 @@ bool GdbBinaryModel::setData(const QModelIndex &index, const QVariant &value, in
return QStandardItemModel::setData(index, value, role);
}
QMap<QString, QString> GdbBinaryModel::gdbMapping() const
QMap<QString, QString> DebuggerBinaryModel::debuggerMapping() const
{
QMap<QString, QString> rc;
const int binaryCount = rowCount();
......@@ -159,24 +164,25 @@ QMap<QString, QString> GdbBinaryModel::gdbMapping() const
return rc;
}
void GdbBinaryModel::setGdbMapping(const QMap<QString, QString> &m)
void DebuggerBinaryModel::setDebuggerMapping(const QMap<QString, QString> &m)
{
removeRows(0, rowCount());
for (QMap<QString, QString>::const_iterator i = m.constBegin(); i != m.constEnd(); ++i)
append(i.key(), i.value());
}
QString GdbBinaryModel::binary(int row) const
QString DebuggerBinaryModel::binary(int row) const
{
return QDir::fromNativeSeparators(item(row, binaryColumn)->data(Qt::DisplayRole).toString());
return QDir::fromNativeSeparators(
item(row, binaryColumn)->data(Qt::DisplayRole).toString());
}
QString GdbBinaryModel::abi(int row) const
QString DebuggerBinaryModel::abi(int row) const
{
return item(row, abiColumn)->data(Qt::DisplayRole).toString();
}
void GdbBinaryModel::setBinaryItem(QStandardItem *item, const QString &binary)
void DebuggerBinaryModel::setBinaryItem(QStandardItem *item, const QString &binary)
{
item->setText(binary.isEmpty() ? QString() : QDir::toNativeSeparators(binary));
item->setToolTip(QString());; // clean out delayed tooltip
......@@ -184,26 +190,26 @@ void GdbBinaryModel::setBinaryItem(QStandardItem *item, const QString &binary)
item->setData(false);
}
void GdbBinaryModel::setAbiItem(QStandardItem *item, const QString &abi)
void DebuggerBinaryModel::setAbiItem(QStandardItem *item, const QString &abi)
{
item->setText(abi);
item->setToolTip(QString()); // clean out delayed tooltip
item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
}
void GdbBinaryModel::append(const QString &abi, const QString &binary)
void DebuggerBinaryModel::append(const QString &abi, const QString &binary)
{
QStandardItem *binaryItem = new QStandardItem;
QStandardItem *abiItem = new QStandardItem;
GdbBinaryModel::setAbiItem(abiItem, abi);
GdbBinaryModel::setBinaryItem(binaryItem, binary);
DebuggerBinaryModel::setAbiItem(abiItem, abi);
DebuggerBinaryModel::setBinaryItem(binaryItem, binary);
StandardItemList row;
row << abiItem << binaryItem;
appendRow(row);
}
bool GdbBinaryModel::isDirty() const
bool DebuggerBinaryModel::isDirty() const
{
for (int i = 0; i < rowCount(); ++i) {
if (item(i, binaryColumn)->data().toBool())
......@@ -212,11 +218,11 @@ bool GdbBinaryModel::isDirty() const
return false;
}
// ----------- GdbChooserWidget
GdbChooserWidget::GdbChooserWidget(QWidget *parent) :
// ----------- DebuggerChooserWidget
DebuggerChooserWidget::DebuggerChooserWidget(QWidget *parent) :
QWidget(parent),
m_treeView(new QTreeView),
m_model(new GdbBinaryModel(m_treeView))
m_model(new DebuggerBinaryModel(m_treeView))
{
QVBoxLayout *layout = new QVBoxLayout(this);
m_treeView->setRootIsDecorated(false);
......@@ -227,19 +233,19 @@ GdbChooserWidget::GdbChooserWidget(QWidget *parent) :
layout->addWidget(m_treeView);
}
QMap<QString, QString> GdbChooserWidget::gdbMapping() const
QMap<QString, QString> DebuggerChooserWidget::debuggerMapping() const
{
return m_model->gdbMapping();
return m_model->debuggerMapping();
}
void GdbChooserWidget::setGdbMapping(const QMap<QString, QString> &m)
void DebuggerChooserWidget::setDebuggerMapping(const QMap<QString, QString> &m)
{
m_model->setGdbMapping(m);
m_model->setDebuggerMapping(m);
for (int c = 0; c < ColumnCount; c++)
m_treeView->resizeColumnToContents(c);
}
bool GdbChooserWidget::isDirty() const
bool DebuggerChooserWidget::isDirty() const
{
return m_model->isDirty();
}
......
......@@ -31,8 +31,8 @@
**
**************************************************************************/
#ifndef GDBCHOOSERWIDGET_H
#define GDBCHOOSERWIDGET_H
#ifndef DEGUBBER_DEBUGGERCHOOSERWIDGET_H
#define DEGUBBER_DEBUGGERCHOOSERWIDGET_H
#include <QtCore/QMultiMap>
#include <QtGui/QDialog>
......@@ -55,20 +55,20 @@ namespace Utils {
namespace Debugger {
namespace Internal {
class GdbBinaryModel;
class DebuggerBinaryModel;
/* GdbChooserWidget: Shows a list of gdb binary and associated toolchains with
* 'add' and 'remove' buttons. Provides delayed tooltip showing version information.
* Based on a multimap of binaries to toolchain. */
/* DebuggerChooserWidget: Shows a list of toolchains and associated debugger
* binaries together with 'add' and 'remove' buttons.
* Provides delayed tooltip showing version information. */
class GdbChooserWidget : public QWidget
class DebuggerChooserWidget : public QWidget
{
Q_OBJECT
public:
explicit GdbChooserWidget(QWidget *parent = 0);
explicit DebuggerChooserWidget(QWidget *parent = 0);
QMap<QString, QString> gdbMapping() const;
void setGdbMapping(const QMap<QString, QString> &m);
QMap<QString, QString> debuggerMapping() const;
void setDebuggerMapping(const QMap<QString, QString> &m);
bool isDirty() const;
......@@ -77,10 +77,10 @@ private:
QToolButton *createAddToolMenuButton();
QTreeView *m_treeView;
GdbBinaryModel *m_model;
DebuggerBinaryModel *m_model;
};
} // namespace Internal
} // namespace Debugger
#endif // GDBCHOOSERWIDGET_H
#endif // DEGUBBER_DEBUGGERCHOOSERWIDGET_H
......@@ -92,7 +92,7 @@ extern QString msgNoBinaryForToolChain(const ProjectExplorer::Abi &abi);
static QString msgEngineNotAvailable(const char *engine)
{
return DebuggerPlugin::tr("The application requires the debugger engine '%1', "
"which is disabled.").arg(QLatin1String(engine));
"which is disabled.").arg(_(engine));
}
////////////////////////////////////////////////////////////////////////
......@@ -338,7 +338,7 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
const QString msg = tr("Cannot debug '%1' (binary format: '%2'): %3")
.arg(sp.executable, sp.toolChainAbi.toString(), d->m_errorMessage);
Core::ICore::instance()->showWarningWithOptions(tr("Warning"),
msg, QString(), QLatin1String(Constants::DEBUGGER_SETTINGS_CATEGORY),
msg, QString(), _(Constants::DEBUGGER_SETTINGS_CATEGORY),
d->m_settingsIdHint);
}
}
......@@ -384,18 +384,18 @@ ConfigurationCheck checkDebugConfiguration(const ProjectExplorer::Abi &abi)
if (debuggerCore()->debuggerForAbi(abi).isEmpty()) {
result.errorMessage = msgNoBinaryForToolChain(abi);
result.errorMessage += QLatin1Char(' ') + msgEngineNotAvailable("Gdb");
//result.settingsPage = GdbOptionsPage::settingsId();
result.settingsPage = _(Constants::DEBUGGER_COMMON_SETTINGS_ID);
}
} else if (abi.binaryFormat() == Abi::Format_PE && abi.osFlavor() != Abi::Windows_msys) {
result = checkCdbConfiguration(abi);
if (!result) {
result.errorMessage += msgEngineNotAvailable("Cdb");
result.settingsPage = QLatin1String("Cdb");
result.settingsPage = _("Cdb");
}
}
if (!result && !result.settingsPage.isEmpty())
result.settingsCategory = QLatin1String(Constants::DEBUGGER_SETTINGS_CATEGORY);
result.settingsCategory = _(Constants::DEBUGGER_SETTINGS_CATEGORY);
return result;
}
......@@ -521,8 +521,8 @@ static inline QString findQtInstallPath(const QString &qmakePath)
{
QProcess proc;
QStringList args;
args.append(QLatin1String("-query"));
args.append(QLatin1String("QT_INSTALL_HEADERS"));
args.append(_("-query"));
args.append(_("QT_INSTALL_HEADERS"));
proc.start(qmakePath, args);
if (!proc.waitForStarted()) {
qWarning("%s: Cannot start '%s': %s", Q_FUNC_INFO, qPrintable(qmakePath),
......@@ -565,7 +565,7 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
sp.dumperLibraryLocations = rc->dumperLibraryLocations();
if (debuggerCore()->isActiveDebugLanguage(QmlLanguage)) {
sp.qmlServerAddress = QLatin1String("127.0.0.1");
sp.qmlServerAddress = _("127.0.0.1");
sp.qmlServerPort = runConfiguration->qmlDebugServerPort();
sp.projectDir = runConfiguration->target()->project()->projectDirectory();
......@@ -575,11 +575,11 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
// Makes sure that all bindings go through the JavaScript engine, so that
// breakpoints are actually hit!
if (!sp.environment.hasKey(QLatin1String("QML_DISABLE_OPTIMIZER"))) {
sp.environment.set(QLatin1String("QML_DISABLE_OPTIMIZER"), QLatin1String("1"));
if (!sp.environment.hasKey(_("QML_DISABLE_OPTIMIZER"))) {
sp.environment.set(_("QML_DISABLE_OPTIMIZER"), _("1"));
}
Utils::QtcProcess::addArg(&sp.processArgs, QLatin1String("-qmljsdebugger=port:")
Utils::QtcProcess::addArg(&sp.processArgs, _("-qmljsdebugger=port:")
+ QString::number(sp.qmlServerPort));
}
......
......@@ -2,7 +2,6 @@ HEADERS += \
$$PWD/gdbmi.h \
$$PWD/gdbengine.h \
$$PWD/gdboptionspage.h \
$$PWD/gdbchooserwidget.h \
$$PWD/abstractgdbadapter.h \
$$PWD/attachgdbadapter.h \
$$PWD/coregdbadapter.h \
......@@ -25,7 +24,6 @@ SOURCES += \
$$PWD/classicgdbengine.cpp \
$$PWD/pythongdbengine.cpp \
$$PWD/gdboptionspage.cpp \
$$PWD/gdbchooserwidget.cpp \
$$PWD/abstractgdbadapter.cpp \
$$PWD/attachgdbadapter.cpp \
$$PWD/coregdbadapter.cpp \
......
......@@ -4219,7 +4219,7 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb,
if (m_gdb.isEmpty()) {
handleAdapterStartFailed(
msgNoBinaryForToolChain(sp.toolChainAbi),
GdbOptionsPage::settingsId());
_(Constants::DEBUGGER_COMMON_SETTINGS_ID));
return false;
}
QStringList gdbArgs;
......
......@@ -21,10 +21,7 @@
<property name="margin">
<number>9</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="Debugger::Internal::GdbChooserWidget" name="gdbChooserWidget" native="true"/>
</item>
<item row="1" column="0">
<item row="0" column="0">
<widget class="QLabel" name="labelGdbStartupScript">
<property name="toolTip">
<string>This is either empty or points to a file containing gdb commands that will be executed immediately after gdb starts up.</string>
......@@ -34,17 +31,17 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="Utils::PathChooser" name="scriptFileChooser"/>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="labelGdbWatchdogTimeout">
<property name="text">
<string>Gdb timeout:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxGdbWatchdogTimeout">
<property name="toolTip">
<string>This is the number of seconds Qt Creator will wait before
......@@ -70,14 +67,14 @@ on slow machines. In this case, the value should be increased.</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxEnableReverseDebugging">
<property name="text">
<string>Enable reverse debugging</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
<property name="toolTip">
<string>When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic
......@@ -88,28 +85,28 @@ on slow machines. In this case, the value should be increased.</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxUseMessageBoxForSignals">
<property name="text">
<string>Show a message box when receiving a signal</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxAdjustBreakpointLocations">
<property name="text">
<string>Adjust breakpoint locations</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxLoadGdbInit">
<property name="text">
<string>Load .gdbinit file on startup</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxTargetAsync">
<property name="text">
<string>Use asynchronous mode to control the inferior</string>
......
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