Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

This commit is contained in:
Erik Verbruggen
2009-09-23 16:41:12 +02:00
18 changed files with 404 additions and 157 deletions

View File

@@ -29,6 +29,7 @@
#include "breakhandler.h"
#include "debuggeractions.h"
#include "debuggermanager.h"
#include "stackframe.h"
@@ -507,7 +508,8 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
break;
}
if (role == Qt::ToolTipRole)
return data->toToolTip();
return theDebuggerBoolSetting(UseToolTipsInLocalsView)
? data->toToolTip() : QVariant();
return QVariant();
}

View File

@@ -99,7 +99,6 @@ public:
virtual void reloadRegisters();
virtual void reloadSourceFiles();
virtual void reloadFullStack() {}
virtual void addOptionPages(QList<Core::IOptionsPage*> *) const;
public slots:
void syncDebuggerPaths();

View File

@@ -53,12 +53,22 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseToolTips">
<widget class="QCheckBox" name="checkBoxUseToolTipsInMainEditor">
<property name="toolTip">
<string>Checking this will enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default.</string>
</property>
<property name="text">
<string>Use tooltips while debugging</string>
<string>Use tooltips in locals view while debugging</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseToolTipsInLocalsView">
<property name="toolTip">
<string>Checking this will enable tooltips for in the locals view during debugging.</string>
</property>
<property name="text">
<string>Use tooltips in main editor while debugging</string>
</property>
</widget>
</item>

View File

@@ -254,10 +254,17 @@ DebuggerSettings *DebuggerSettings::instance()
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseToolTips"));
item->setText(tr("Use tooltips when debugging"));
item->setText(tr("Use tooltips in main editor when debugging"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(UseToolTips, item);
instance->insertItem(UseToolTipsInMainEditor, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseToolTipsInLocalsView"));
item->setText(tr("Use tooltips in locals view when debugging"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(UseToolTipsInLocalsView, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("ListSourceFiles"));

View File

@@ -100,7 +100,8 @@ enum DebuggerActionCode
WatchExpressionInWindow,
RemoveWatchExpression,
WatchPoint,
UseToolTips,
UseToolTipsInMainEditor,
UseToolTipsInLocalsView,
AssignValue,
AssignType,

View File

@@ -248,6 +248,7 @@ AttachExternalDialog::AttachExternalDialog(QWidget *parent)
QPushButton *refreshButton = new QPushButton(tr("Refresh"));
connect(refreshButton, SIGNAL(clicked()), this, SLOT(rebuildProcessList()));
m_ui->buttonBox->addButton(refreshButton, QDialogButtonBox::ActionRole);
m_ui->filterLineEdit->setFocus(Qt::TabFocusReason);
// Do not use activated, will be single click in Oxygen
connect(m_ui->procView, SIGNAL(doubleClicked(QModelIndex)),

View File

@@ -769,6 +769,9 @@ static IDebuggerEngine *determineDebuggerEngine(const QString &executable,
return gdbEngine;
#else
// A remote executable?
if (!executable.endsWith(_(".exe")))
return gdbEngine;
// If a file has PDB files, it has been compiled by VS.
QStringList pdbFiles;
if (!getPDBFiles(executable, &pdbFiles, errorMessage))

View File

@@ -366,6 +366,7 @@ private:
ThreadsHandler *threadsHandler() { return m_threadsHandler; }
WatchHandler *watchHandler() { return m_watchHandler; }
SourceFilesWindow *sourceFileWindow() { return m_sourceFilesWindow; }
QWidget *threadsWindow() const { return m_threadsWindow; }
void notifyInferiorStopped();
void notifyInferiorRunningRequested();
@@ -376,20 +377,16 @@ private:
void cleanupViews();
//
// Implementation of IDebuggerManagerAccessForDebugMode
//
QWidget *threadsWindow() const { return m_threadsWindow; }
virtual bool qtDumperLibraryEnabled() const;
virtual QString qtDumperLibraryName() const;
virtual QStringList qtDumperLibraryLocations() const;
virtual void showQtDumperLibraryWarning(const QString &details = QString());
virtual bool isReverseDebugging() const;
//
// internal implementation
//
bool qtDumperLibraryEnabled() const;
QString qtDumperLibraryName() const;
QStringList qtDumperLibraryLocations() const;
void showQtDumperLibraryWarning(const QString &details = QString());
bool isReverseDebugging() const;
QAbstractItemModel *threadsModel();
Q_SLOT void loadSessionData();
Q_SLOT void saveSessionData();
Q_SLOT void dumpLog();
@@ -397,7 +394,6 @@ private:
public:
// stuff in this block should be made private by moving it to
// one of the interfaces
QAbstractItemModel *threadsModel();
int status() const { return m_status; }
// FIXME: hide this in the engines?
//DebuggerStartMode startMode() const;
@@ -471,14 +467,12 @@ private:
QAction *m_watchAction;
QAction *m_breakAction;
QAction *m_sepAction;
//QActio *m_stepByInstructionAction;
QAction *m_reverseDirectionAction;
QWidget *m_breakWindow;
QWidget *m_localsWindow;
QWidget *m_registerWindow;
QWidget *m_modulesWindow;
//QWidget *m_tooltipWindow;
QWidget *m_stackWindow;
QWidget *m_threadsWindow;
QWidget *m_watchersWindow;

View File

@@ -292,8 +292,10 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
m_ui.checkBoxUseMessageBoxForSignals);
m_group.insert(theDebuggerAction(SkipKnownFrames),
m_ui.checkBoxSkipKnownFrames);
m_group.insert(theDebuggerAction(UseToolTips),
m_ui.checkBoxUseToolTips);
m_group.insert(theDebuggerAction(UseToolTipsInMainEditor),
m_ui.checkBoxUseToolTipsInMainEditor);
m_group.insert(theDebuggerAction(UseToolTipsInLocalsView),
m_ui.checkBoxUseToolTipsInLocalsView);
m_group.insert(theDebuggerAction(EnableReverseDebugging),
m_ui.checkBoxEnableReverseDebugging);
m_group.insert(theDebuggerAction(MaximalStackDepth),
@@ -1036,7 +1038,8 @@ void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber
void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
const QPoint &point, int pos)
{
if (!theDebuggerBoolSetting(UseToolTips) || m_manager->status() == DebuggerProcessNotReady)
if (!theDebuggerBoolSetting(UseToolTipsInMainEditor)
|| m_manager->status() == DebuggerProcessNotReady)
return;
m_manager->setToolTipExpression(point, editor, pos);
@@ -1229,7 +1232,7 @@ void DebuggerPlugin::attachExternalApplication(qint64 pid, const QString &crashP
const DebuggerStartParametersPtr sp(new DebuggerStartParameters);
sp->attachPID = pid;
sp->crashParameter = crashParameter;
sp->startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal;
sp->startMode = crashParameter.isEmpty() ? AttachExternal : AttachCrashedExternal;
RunConfigurationPtr rc = activeRunConfiguration();
if (rc.isNull())
rc = DebuggerRunner::createDefaultRunConfiguration();

View File

@@ -0,0 +1,205 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "attachgdbadapter.h"
#include "debuggeractions.h"
#include "gdbengine.h"
#include "procinterrupt.h"
#include <utils/qtcassert.h>
namespace Debugger {
namespace Internal {
#define STRINGIFY_INTERNAL(x) #x
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
#define CB(callback) \
static_cast<GdbEngine::AdapterCallback>(&AttachGdbAdapter::callback), \
STRINGIFY(callback)
///////////////////////////////////////////////////////////////////////
//
// AttachGdbAdapter
//
///////////////////////////////////////////////////////////////////////
AttachGdbAdapter::AttachGdbAdapter(GdbEngine *engine, QObject *parent)
: AbstractGdbAdapter(engine, parent)
{
QTC_ASSERT(state() == AdapterNotRunning, qDebug() << state());
connect(&m_gdbProc, SIGNAL(error(QProcess::ProcessError)),
this, SIGNAL(error(QProcess::ProcessError)));
connect(&m_gdbProc, SIGNAL(readyReadStandardOutput()),
this, SIGNAL(readyReadStandardOutput()));
connect(&m_gdbProc, SIGNAL(readyReadStandardError()),
this, SIGNAL(readyReadStandardError()));
connect(&m_gdbProc, SIGNAL(started()),
this, SLOT(handleGdbStarted()));
connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(handleGdbFinished(int, QProcess::ExitStatus)));
}
void AttachGdbAdapter::startAdapter()
{
QTC_ASSERT(state() == AdapterNotRunning, qDebug() << state());
setState(AdapterStarting);
debugMessage(_("TRYING TO START ADAPTER"));
QStringList gdbArgs;
gdbArgs.prepend(_("mi"));
gdbArgs.prepend(_("-i"));
if (!m_engine->m_outputCollector.listen()) {
emit adapterStartFailed(tr("Cannot set up communication with child process: %1")
.arg(m_engine->m_outputCollector.errorString()));
return;
}
gdbArgs.prepend(_("--tty=") + m_engine->m_outputCollector.serverName());
if (!startParameters().workingDir.isEmpty())
setWorkingDirectory(startParameters().workingDir);
if (!startParameters().environment.isEmpty())
setEnvironment(startParameters().environment);
QString location = theDebuggerStringSetting(GdbLocation);
m_gdbProc.start(location, gdbArgs);
}
void AttachGdbAdapter::handleGdbStarted()
{
QTC_ASSERT(state() == AdapterStarting, qDebug() << state());
setState(AdapterStarted);
emit adapterStarted();
}
void AttachGdbAdapter::prepareInferior()
{
const qint64 pid = startParameters().attachPID;
QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
setState(InferiorPreparing);
qDebug() << "USING " << pid;
m_engine->postCommand(_("attach %1").arg(pid), CB(handleAttach));
// Task 254674 does not want to remove them
//qq->breakHandler()->removeAllBreakpoints();
}
void AttachGdbAdapter::handleAttach(const GdbResultRecord &response, const QVariant &)
{
QTC_ASSERT(state() == InferiorPreparing, qDebug() << state());
if (response.resultClass == GdbResultDone) {
setState(InferiorPrepared);
emit inferiorPrepared();
} else if (response.resultClass == GdbResultError) {
QString msg = __(response.data.findChild("msg").data());
setState(InferiorPreparationFailed);
emit inferiorPreparationFailed(msg);
}
}
void AttachGdbAdapter::startInferior()
{
QTC_ASSERT(state() == InferiorPrepared, qDebug() << state());
setState(InferiorStarting);
m_engine->postCommand(_("-exec-continue"), CB(handleContinue));
}
void AttachGdbAdapter::handleContinue(const GdbResultRecord &response, const QVariant &)
{
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
if (response.resultClass == GdbResultRunning) {
setState(InferiorStarted);
emit inferiorStarted();
} else {
QTC_ASSERT(response.resultClass == GdbResultError, /**/);
const QByteArray &msg = response.data.findChild("msg").data();
setState(InferiorStartFailed);
emit inferiorStartFailed(msg);
}
}
void AttachGdbAdapter::interruptInferior()
{
debugMessage(_("TRYING TO INTERUPT INFERIOR"));
const qint64 pid = startParameters().attachPID;
if (!interruptProcess(pid))
debugMessage(_("CANNOT INTERRUPT %1").arg(pid));
}
void AttachGdbAdapter::shutdown()
{
if (state() == InferiorStarted) {
setState(InferiorShuttingDown);
m_engine->postCommand(_("detach"), CB(handleDetach));
return;
}
if (state() == InferiorShutDown) {
setState(AdapterShuttingDown);
m_engine->postCommand(_("-gdb-exit"), CB(handleExit));
return;
}
QTC_ASSERT(state() == AdapterNotRunning, qDebug() << state());
}
void AttachGdbAdapter::handleDetach(const GdbResultRecord &response, const QVariant &)
{
if (response.resultClass == GdbResultDone) {
setState(InferiorShutDown);
emit inferiorShutDown();
shutdown(); // re-iterate...
} else if (response.resultClass == GdbResultError) {
QString msg = tr("Inferior process could not be stopped:\n") +
__(response.data.findChild("msg").data());
setState(InferiorShutdownFailed);
emit inferiorShutdownFailed(msg);
}
}
void AttachGdbAdapter::handleExit(const GdbResultRecord &response, const QVariant &)
{
if (response.resultClass == GdbResultDone) {
// don't set state here, this will be handled in handleGdbFinished()
} else if (response.resultClass == GdbResultError) {
QString msg = tr("Gdb process could not be stopped:\n") +
__(response.data.findChild("msg").data());
emit adapterShutdownFailed(msg);
}
}
void AttachGdbAdapter::handleGdbFinished(int, QProcess::ExitStatus)
{
debugMessage(_("GDB PROESS FINISHED"));
setState(AdapterNotRunning);
emit adapterShutDown();
}
} // namespace Internal
} // namespace Debugger

View File

@@ -0,0 +1,84 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef DEBUGGER_ATTACHGDBADAPTER_H
#define DEBUGGER_ATTACHGDBADAPTER_H
#include "abstractgdbadapter.h"
#include "gdbengine.h"
#include <QtCore/QDebug>
#include <QtCore/QProcess>
namespace Debugger {
namespace Internal {
///////////////////////////////////////////////////////////////////////
//
// AttachGdbAdapter
//
///////////////////////////////////////////////////////////////////////
class AttachGdbAdapter : public AbstractGdbAdapter
{
Q_OBJECT
public:
AttachGdbAdapter(GdbEngine *engine, QObject *parent = 0);
private:
QByteArray readAllStandardError() { return m_gdbProc.readAllStandardError(); }
QByteArray readAllStandardOutput() { return m_gdbProc.readAllStandardOutput(); }
qint64 write(const char *data) { return m_gdbProc.write(data); }
void setWorkingDirectory(const QString &dir) { m_gdbProc.setWorkingDirectory(dir); }
void setEnvironment(const QStringList &env) { m_gdbProc.setEnvironment(env); }
bool isTrkAdapter() const { return false; }
void startAdapter();
void prepareInferior();
void startInferior();
void interruptInferior();
void shutdown();
void handleAttach(const GdbResultRecord &, const QVariant &);
void handleContinue(const GdbResultRecord &, const QVariant &);
void handleDetach(const GdbResultRecord &, const QVariant &);
void handleExit(const GdbResultRecord &, const QVariant &);
void debugMessage(const QString &msg) { m_engine->debugMessage(msg); }
Q_SLOT void handleGdbFinished(int, QProcess::ExitStatus);
Q_SLOT void handleGdbStarted();
QProcess m_gdbProc;
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_ATTACHDBADAPTER_H

View File

@@ -31,13 +31,10 @@
#include "debuggeractions.h"
#include "gdbengine.h"
#include "procinterrupt.h"
#include <utils/qtcassert.h>
#include <coreplugin/icore.h>
#include <QtCore/QFileInfo>
#include <QtGui/QMessageBox>
namespace Debugger {
namespace Internal {
@@ -148,7 +145,7 @@ void CoreGdbAdapter::handleTargetCore(const GdbResultRecord &response, const QVa
if (response.resultClass == GdbResultDone) {
setState(InferiorStarted);
emit inferiorStarted();
m_engine->handleTargetCore();
m_engine->updateAll();
} else {
QTC_ASSERT(response.resultClass == GdbResultError, /**/);
const QByteArray &msg = response.data.findChild("msg").data();

View File

@@ -1,29 +1,31 @@
include(../../../shared/trk/trk.pri)
HEADERS += \
$$PWD/abstractgdbadapter.h \
$$PWD/plaingdbadapter.h \
$$PWD/gdbmi.h \
$$PWD/gdbengine.h \
$$PWD/gdboptionspage.h \
$$PWD/remotegdbadapter.h \
$$PWD/coregdbadapter.h \
$$PWD/trkgdbadapter.h \
$$PWD/trkoptions.h \
$$PWD/trkoptionswidget.h \
$$PWD/trkoptionspage.h
$$PWD/trkoptionspage.h \
$$PWD/abstractgdbadapter.h \
$$PWD/attachgdbadapter.h \
$$PWD/coregdbadapter.h \
$$PWD/plaingdbadapter.h \
$$PWD/remotegdbadapter.h \
$$PWD/trkgdbadapter.h \
SOURCES += \
$$PWD/gdbmi.cpp \
$$PWD/gdbengine.cpp \
$$PWD/gdboptionspage.cpp \
$$PWD/plaingdbadapter.cpp \
$$PWD/remotegdbadapter.cpp \
$$PWD/coregdbadapter.cpp \
$$PWD/trkoptions.cpp \
$$PWD/trkoptionswidget.cpp \
$$PWD/trkoptionspage.cpp \
$$PWD/trkgdbadapter.cpp
$$PWD/attachgdbadapter.cpp \
$$PWD/coregdbadapter.cpp \
$$PWD/plaingdbadapter.cpp \
$$PWD/remotegdbadapter.cpp \
$$PWD/trkgdbadapter.cpp \
FORMS += $$PWD/gdboptionspage.ui \
$$PWD/trkoptionswidget.ui

View File

@@ -34,10 +34,11 @@
#include "trkoptions.h"
#include "trkoptionspage.h"
#include "plaingdbadapter.h"
#include "trkgdbadapter.h"
#include "remotegdbadapter.h"
#include "attachgdbadapter.h"
#include "coregdbadapter.h"
#include "plaingdbadapter.h"
#include "remotegdbadapter.h"
#include "trkgdbadapter.h"
#include "watchutils.h"
#include "debuggeractions.h"
@@ -46,7 +47,6 @@
#include "debuggermanager.h"
#include "debuggertooltip.h"
#include "gdbmi.h"
#include "procinterrupt.h"
#include "breakhandler.h"
#include "moduleshandler.h"
@@ -182,6 +182,7 @@ GdbEngine::GdbEngine(DebuggerManager *parent) :
m_trkAdapter = new TrkGdbAdapter(this, options);
m_remoteAdapter = new RemoteGdbAdapter(this);
m_coreAdapter = new CoreGdbAdapter(this);
m_attachAdapter = new AttachGdbAdapter(this);
// Output
connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)),
@@ -198,22 +199,23 @@ GdbEngine::GdbEngine(DebuggerManager *parent) :
Qt::QueuedConnection);
}
void GdbEngine::connectDebuggingHelperActions(bool on)
void GdbEngine::connectDebuggingHelperActions()
{
if (on) {
connect(theDebuggerAction(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
this, SLOT(setUseDebuggingHelpers(QVariant)));
connect(theDebuggerAction(DebugDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
this, SLOT(setDebugDebuggingHelpers(QVariant)));
connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()),
this, SLOT(recheckDebuggingHelperAvailability()));
} else {
disconnect(theDebuggerAction(UseDebuggingHelpers), 0, this, 0);
disconnect(theDebuggerAction(DebugDebuggingHelpers), 0, this, 0);
disconnect(theDebuggerAction(RecheckDebuggingHelpers), 0, this, 0);
}
connect(theDebuggerAction(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
this, SLOT(setUseDebuggingHelpers(QVariant)));
connect(theDebuggerAction(DebugDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
this, SLOT(setDebugDebuggingHelpers(QVariant)));
connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()),
this, SLOT(recheckDebuggingHelperAvailability()));
}
void GdbEngine::disconnectDebuggingHelperActions()
{
disconnect(theDebuggerAction(UseDebuggingHelpers), 0, this, 0);
disconnect(theDebuggerAction(DebugDebuggingHelpers), 0, this, 0);
disconnect(theDebuggerAction(RecheckDebuggingHelpers), 0, this, 0);
}
DebuggerStartMode GdbEngine::startMode() const
{
QTC_ASSERT(!m_startParameters.isNull(), return NoStartMode);
@@ -232,6 +234,7 @@ GdbEngine::~GdbEngine()
delete m_trkAdapter;
delete m_remoteAdapter;
delete m_coreAdapter;
delete m_attachAdapter;
}
void GdbEngine::connectAdapter()
@@ -324,7 +327,6 @@ void GdbEngine::initializeVariables()
m_outputCodec = QTextCodec::codecForLocale();
m_pendingRequests = 0;
m_continuationAfterDone = 0;
m_waitingForFirstBreakpointToBeHit = false;
m_commandsToRunOnTemporaryBreak.clear();
m_cookieForToken.clear();
m_customOutputForToken.clear();
@@ -698,6 +700,7 @@ void GdbEngine::interruptInferior()
return;
}
debugMessage(_("TRYING TO INTERUPT INFERIOR"));
m_gdbAdapter->interruptInferior();
}
@@ -812,7 +815,6 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
{
//qDebug() << "TOKEN:" << record.token
// << " ACCEPTABLE:" << m_oldestAcceptableToken;
//qDebug() << "";
//qDebug() << "\nRESULT" << record.token << record.toString();
int token = record.token;
@@ -823,7 +825,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
// In theory this should not happen, in practice it does.
debugMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN. "
"TWO RESPONSES FOR ONE COMMAND?").arg(token));
// handle a case known to occur on Linux/gdb 6.8 when debugging moc
// Handle a case known to occur on Linux/gdb 6.8 when debugging moc
// with helpers enabled. In this case we get a second response with
// msg="Cannot find new threads: generic error"
if (record.resultClass == GdbResultError) {
@@ -832,8 +834,6 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
tr("Executable failed"), QString::fromLocal8Bit(msg));
showStatusMessage(tr("Process failed to start."));
exitDebugger();
//qq->notifyInferiorStopped();
//qq->notifyInferiorExited();
}
return;
}
@@ -858,8 +858,6 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
<< "\n record: " << record.toString();
#endif
// << "\n data: " << record.data.toString(true);
if (cmd.callback)
(this->*cmd.callback)(record, cmd.cookie);
if (cmd.adapterCallback)
@@ -904,14 +902,14 @@ void GdbEngine::executeDebuggerCommand(const QString &command)
m_gdbAdapter->write(command.toLatin1() + "\r\n");
}
void GdbEngine::handleTargetCore()
void GdbEngine::updateAll()
{
qq->notifyInferiorStopped();
showStatusMessage(tr("Core file loaded."));
m_manager->resetLocation();
tryLoadDebuggingHelpers();
qq->stackHandler()->setCurrentIndex(0);
updateLocals(); // Quick shot
updateLocals();
reloadStack();
if (supportsThreads())
postCommand(_("-thread-list-ids"), WatchUpdate, CB(handleStackListThreads), 0);
@@ -935,7 +933,6 @@ void GdbEngine::handleQuerySources(const GdbResultRecord &record, const QVariant
full = QDir::cleanPath(full);
#endif
if (fullName.isValid() && QFileInfo(full).isReadable()) {
//qDebug() << "STORING 2:" << fileName << full;
m_shortToFullName[fileName] = full;
m_fullToShortName[full] = fileName;
}
@@ -1128,21 +1125,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
return;
}
//MAC: bool isFirstStop = data.findChild("bkptno").data() == "1";
//!MAC: startSymbolName == data.findChild("frame").findChild("func")
if (m_waitingForFirstBreakpointToBeHit) {
m_waitingForFirstBreakpointToBeHit = false;
// If the executable dies already that early we might get something
// like >49*stopped,reason="exited",exit-code="0177"
// This is handled now above.
qq->notifyInferiorStopped();
handleAqcuiredInferior();
// FIXME: m_continuationAfterDone = true;
return;
}
if (!m_commandsToRunOnTemporaryBreak.isEmpty()) {
QTC_ASSERT(status() == DebuggerInferiorStopRequested,
qDebug() << "STATUS:" << status())
@@ -1375,11 +1357,13 @@ void GdbEngine::handleStop2(const GdbMi &data)
qq->stackHandler()->setCurrentIndex(0);
updateLocals(); // Quick shot
int currentId = data.findChild("thread-id").data().toInt();
reloadStack();
if (supportsThreads())
postCommand(_("-thread-list-ids"), WatchUpdate, CB(handleStackListThreads), currentId);
if (supportsThreads()) {
int currentId = data.findChild("thread-id").data().toInt();
postCommand(_("-thread-list-ids"), WatchUpdate,
CB(handleStackListThreads), currentId);
}
//
// Registers
@@ -1525,22 +1509,19 @@ void GdbEngine::shutdown()
void GdbEngine::detachDebugger()
{
postCommand(_("detach"), CB(handleDetach));
//postCommand(_("detach"), CB(handleDetach));
QTC_ASSERT(startMode() == AttachExternal, /**/);
shutdown();
}
void GdbEngine::exitDebugger()
{
connectDebuggingHelperActions(false);
disconnectDebuggingHelperActions();
m_outputCollector.shutdown();
initializeVariables();
m_gdbAdapter->shutdown();
}
void GdbEngine::handleDetach(const GdbResultRecord &, const QVariant &)
{
exitDebugger();
}
int GdbEngine::currentFrame() const
{
return qq->stackHandler()->currentIndex();
@@ -1556,7 +1537,7 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
m_startParameters = sp;
if (startModeAllowsDumpers())
connectDebuggingHelperActions(true);
connectDebuggingHelperActions();
if (m_gdbAdapter)
disconnectAdapter();
@@ -1567,6 +1548,8 @@ void GdbEngine::startDebugger(const DebuggerStartParametersPtr &sp)
m_gdbAdapter = m_coreAdapter;
else if (sp->startMode == StartRemote)
m_gdbAdapter = m_remoteAdapter;
else if (sp->startMode == AttachExternal)
m_gdbAdapter = m_attachAdapter;
else
m_gdbAdapter = m_plainAdapter;
@@ -1622,31 +1605,6 @@ void GdbEngine::continueInferior()
}
#if 0
void GdbEngine::handleAttach(const GdbResultRecord &, const QVariant &)
{
qq->notifyInferiorStopped();
showStatusMessage(tr("Attached to running process. Stopped."));
handleAqcuiredInferior();
m_manager->resetLocation();
recheckDebuggingHelperAvailability();
//
// Stack
//
qq->stackHandler()->setCurrentIndex(0);
updateLocals(); // Quick shot
reloadStack();
if (supportsThreads())
postCommand(_("-thread-list-ids"), WatchUpdate, CB(handleStackListThreads), 0);
//
// Registers
//
qq->reloadRegisters();
}
void GdbEngine::handleSetTargetAsync(const GdbResultRecord &record, const QVariant &)
{
if (record.resultClass == GdbResultDone) {
@@ -4126,7 +4084,7 @@ void GdbEngine::handleAdapterStarted()
void GdbEngine::handleInferiorPreparationFailed(const QString &msg)
{
debugMessage(_("INFERIOR PREPARATION FAILD"));
debugMessage(_("INFERIOR PREPARATION FAILED"));
showMessageBox(QMessageBox::Critical,
tr("Inferior start preparation failed"), msg);
shutdown();

View File

@@ -62,13 +62,14 @@ class IDebuggerManagerAccessForEngines;
class GdbResultRecord;
class GdbMi;
class WatchData;
class BreakpointData;
class WatchData;
class PlainGdbAdapter;
class TrkGdbAdapter;
class RemoteGdbAdapter;
class AttachGdbAdapter;
class CoreGdbAdapter;
class PlainGdbAdapter;
class RemoteGdbAdapter;
class TrkGdbAdapter;
enum DebuggingHelperState
{
@@ -92,10 +93,11 @@ signals:
void applicationOutputAvailable(const QString &output);
private:
friend class PlainGdbAdapter;
friend class TrkGdbAdapter;
friend class RemoteGdbAdapter;
friend class AttachGdbAdapter;
friend class CoreGdbAdapter;
friend class PlainGdbAdapter;
friend class RemoteGdbAdapter;
friend class TrkGdbAdapter;
//
// IDebuggerEngine implementation
@@ -226,6 +228,7 @@ private:
void postCommandHelper(const GdbCommand &cmd);
void setTokenBarrier();
void updateAll();
void updateLocals();
private slots:
@@ -251,7 +254,6 @@ private:
int terminationIndex(const QByteArray &buffer, int &length);
void handleResponse(const QByteArray &buff);
void handleStart(const GdbResultRecord &response, const QVariant &);
//void handleAttach(const GdbResultRecord &, const QVariant &);
void handleAqcuiredInferior();
void handleAsyncOutput(const GdbMi &data);
void handleStop1(const GdbResultRecord &, const QVariant &cookie);
@@ -260,7 +262,6 @@ private:
void handleResultRecord(const GdbResultRecord &response);
void handleFileExecAndSymbols(const GdbResultRecord &response, const QVariant &);
void handleExecContinue(const GdbResultRecord &response, const QVariant &);
//void handleExecRun(const GdbResultRecord &response, const QVariant &);
void handleExecJumpToLine(const GdbResultRecord &response, const QVariant &);
void handleExecRunToFunction(const GdbResultRecord &response, const QVariant &);
void handleInfoShared(const GdbResultRecord &response, const QVariant &);
@@ -270,11 +271,9 @@ private:
void handleQueryPwd(const GdbResultRecord &response, const QVariant &);
void handleQuerySources(const GdbResultRecord &response, const QVariant &);
void handleExit(const GdbResultRecord &, const QVariant &);
void handleDetach(const GdbResultRecord &, const QVariant &);
//void handleSetTargetAsync(const GdbResultRecord &, const QVariant &);
//void handleTargetRemote(const GdbResultRecord &, const QVariant &);
void handleWatchPoint(const GdbResultRecord &, const QVariant &);
void handleTargetCore();
bool showToolTip();
// Convenience
@@ -412,7 +411,8 @@ private:
void setWatchDataType(WatchData &data, const GdbMi &mi);
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
void setLocals(const QList<GdbMi> &locals);
void connectDebuggingHelperActions(bool on);
void connectDebuggingHelperActions();
void disconnectDebuggingHelperActions();
bool startModeAllowsDumpers() const;
QString parseDisassembler(const GdbMi &lines);
@@ -432,7 +432,6 @@ private:
Continuation m_continuationAfterDone;
void handleInitialBreakpointsSet();
bool m_waitingForFirstBreakpointToBeHit;
bool m_modulesListOutdated;
QList<GdbCommand> m_commandsToRunOnTemporaryBreak;
@@ -444,10 +443,11 @@ private:
// only one of those is active at a given time, available in m_gdbAdapter
AbstractGdbAdapter *m_gdbAdapter; // pointer to one listed below
PlainGdbAdapter *m_plainAdapter; // owned
TrkGdbAdapter *m_trkAdapter; // owned
RemoteGdbAdapter *m_remoteAdapter; // owned
AttachGdbAdapter *m_attachAdapter; // owned
CoreGdbAdapter *m_coreAdapter; // owned
PlainGdbAdapter *m_plainAdapter; // owned
RemoteGdbAdapter *m_remoteAdapter; // owned
TrkGdbAdapter *m_trkAdapter; // owned
public:
void showMessageBox(int icon, const QString &title, const QString &text);

View File

@@ -225,11 +225,6 @@ void PlainGdbAdapter::startInferior()
void PlainGdbAdapter::interruptInferior()
{
debugMessage(_("TRYING TO INTERUPT INFERIOR"));
if (m_engine->startMode() == StartRemote) {
m_engine->postCommand(_("-exec-interrupt"));
return;
}
const qint64 attachedPID = m_engine->inferiorPid();
if (attachedPID <= 0) {
debugMessage(_("TRYING TO INTERRUPT INFERIOR BEFORE PID WAS OBTAINED"));

View File

@@ -31,10 +31,8 @@
#include "debuggeractions.h"
#include "gdbengine.h"
#include "procinterrupt.h"
#include <utils/qtcassert.h>
#include <coreplugin/icore.h>
#include <QtCore/QFileInfo>
#include <QtGui/QMessageBox>
@@ -229,20 +227,7 @@ void RemoteGdbAdapter::handleExecRun(const GdbResultRecord &response, const QVar
void RemoteGdbAdapter::interruptInferior()
{
debugMessage(_("TRYING TO INTERUPT INFERIOR"));
if (m_engine->startMode() == StartRemote) {
m_engine->postCommand(_("-exec-interrupt"));
return;
}
const qint64 attachedPID = m_engine->inferiorPid();
if (attachedPID <= 0) {
debugMessage(_("TRYING TO INTERRUPT INFERIOR BEFORE PID WAS OBTAINED"));
return;
}
if (!interruptProcess(attachedPID))
debugMessage(_("CANNOT INTERRUPT %1").arg(attachedPID));
m_engine->postCommand(_("-exec-interrupt"));
}
void RemoteGdbAdapter::shutdown()

View File

@@ -702,7 +702,8 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
}
case Qt::ToolTipRole:
return data.toToolTip();
return theDebuggerBoolSetting(UseToolTipsInLocalsView)
? data.toToolTip() : QVariant();
case Qt::ForegroundRole: {
static const QVariant red(QColor(200, 0, 0));