forked from qt-creator/qt-creator
debugger: some cleanup after the model/view reorganization
This commit is contained in:
@@ -35,7 +35,6 @@
|
|||||||
#include "debuggerplugin.h"
|
#include "debuggerplugin.h"
|
||||||
#include "debuggerstringutils.h"
|
#include "debuggerstringutils.h"
|
||||||
#include "debuggertooltip.h"
|
#include "debuggertooltip.h"
|
||||||
#include "logwindow.h"
|
|
||||||
|
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
#include "moduleshandler.h"
|
#include "moduleshandler.h"
|
||||||
@@ -45,8 +44,6 @@
|
|||||||
#include "stackhandler.h"
|
#include "stackhandler.h"
|
||||||
#include "threadshandler.h"
|
#include "threadshandler.h"
|
||||||
#include "watchhandler.h"
|
#include "watchhandler.h"
|
||||||
#include "watchutils.h"
|
|
||||||
#include "breakwindow.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/ifile.h>
|
#include <coreplugin/ifile.h>
|
||||||
@@ -55,8 +52,6 @@
|
|||||||
|
|
||||||
#include <projectexplorer/toolchaintype.h>
|
#include <projectexplorer/toolchaintype.h>
|
||||||
|
|
||||||
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
|
||||||
|
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
@@ -67,17 +62,9 @@
|
|||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtCore/QFutureInterface>
|
#include <QtCore/QFutureInterface>
|
||||||
|
|
||||||
#include <QtGui/QAbstractItemView>
|
|
||||||
#include <QtGui/QStandardItemModel>
|
#include <QtGui/QStandardItemModel>
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QMenu>
|
|
||||||
#include <QtGui/QMessageBox>
|
|
||||||
#include <QtGui/QPlainTextEdit>
|
|
||||||
#include <QtGui/QPushButton>
|
|
||||||
#include <QtGui/QTextBlock>
|
|
||||||
#include <QtGui/QTextCursor>
|
|
||||||
#include <QtGui/QTreeWidget>
|
#include <QtGui/QTreeWidget>
|
||||||
#include <QtGui/QMainWindow>
|
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Debugger;
|
using namespace Debugger;
|
||||||
@@ -550,57 +537,6 @@ void DebuggerEngine::gotoLocation(const StackFrame &frame, bool setMarker)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DebuggerEngine::executeRunToLine()
|
|
||||||
{
|
|
||||||
QString fileName;
|
|
||||||
int lineNumber;
|
|
||||||
if (currentTextEditorPosition(&fileName, &lineNumber)) {
|
|
||||||
resetLocation();
|
|
||||||
executeRunToLine(fileName, lineNumber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEngine::executeRunToFunction()
|
|
||||||
{
|
|
||||||
ITextEditor *textEditor = currentTextEditor();
|
|
||||||
QTC_ASSERT(textEditor, return);
|
|
||||||
QPlainTextEdit *ed = qobject_cast<QPlainTextEdit*>(textEditor->widget());
|
|
||||||
if (!ed)
|
|
||||||
return;
|
|
||||||
QTextCursor cursor = ed->textCursor();
|
|
||||||
QString functionName = cursor.selectedText();
|
|
||||||
if (functionName.isEmpty()) {
|
|
||||||
const QTextBlock block = cursor.block();
|
|
||||||
const QString line = block.text();
|
|
||||||
foreach (const QString &str, line.trimmed().split('(')) {
|
|
||||||
QString a;
|
|
||||||
for (int i = str.size(); --i >= 0; ) {
|
|
||||||
if (!str.at(i).isLetterOrNumber())
|
|
||||||
break;
|
|
||||||
a = str.at(i) + a;
|
|
||||||
}
|
|
||||||
if (!a.isEmpty()) {
|
|
||||||
functionName = a;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (functionName.isEmpty())
|
|
||||||
return;
|
|
||||||
resetLocation();
|
|
||||||
executeRunToFunction(functionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEngine::executeJumpToLine()
|
|
||||||
{
|
|
||||||
QString fileName;
|
|
||||||
int lineNumber;
|
|
||||||
if (currentTextEditorPosition(&fileName, &lineNumber))
|
|
||||||
executeJumpToLine(fileName, lineNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called from RunControl.
|
// Called from RunControl.
|
||||||
void DebuggerEngine::handleStartFailed()
|
void DebuggerEngine::handleStartFailed()
|
||||||
{
|
{
|
||||||
@@ -663,33 +599,7 @@ QStringList DebuggerEngine::qtDumperLibraryLocations() const
|
|||||||
|
|
||||||
void DebuggerEngine::showQtDumperLibraryWarning(const QString &details)
|
void DebuggerEngine::showQtDumperLibraryWarning(const QString &details)
|
||||||
{
|
{
|
||||||
QMessageBox dialog(plugin()->mainWindow());
|
plugin()->showQtDumperLibraryWarning(details);
|
||||||
QPushButton *qtPref = dialog.addButton(tr("Open Qt4 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. "
|
|
||||||
"On the Qt4 options page, select a Qt installation "
|
|
||||||
"and click Rebuild."));
|
|
||||||
if (!details.isEmpty())
|
|
||||||
dialog.setDetailedText(details);
|
|
||||||
dialog.exec();
|
|
||||||
if (dialog.clickedButton() == qtPref) {
|
|
||||||
Core::ICore::instance()->showOptionsDialog(
|
|
||||||
_(Qt4ProjectManager::Constants::QT_SETTINGS_CATEGORY),
|
|
||||||
_(Qt4ProjectManager::Constants::QTVERSION_SETTINGS_PAGE_ID));
|
|
||||||
} else if (dialog.clickedButton() == helperOff) {
|
|
||||||
theDebuggerAction(UseDebuggingHelpers)
|
|
||||||
->setValue(qVariantFromValue(false), false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DebuggerEngine::qtDumperLibraryName() const
|
QString DebuggerEngine::qtDumperLibraryName() const
|
||||||
|
|||||||
@@ -339,11 +339,6 @@ protected:
|
|||||||
DebuggerRunControl *runControl() const;
|
DebuggerRunControl *runControl() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void executeRunToLine();
|
|
||||||
void executeRunToFunction();
|
|
||||||
void executeJumpToLine();
|
|
||||||
void addToWatchWindow();
|
|
||||||
|
|
||||||
// wrapper engine needs access to state of its subengines
|
// wrapper engine needs access to state of its subengines
|
||||||
friend class QmlCppEngine;
|
friend class QmlCppEngine;
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,8 @@
|
|||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/toolchaintype.h>
|
#include <projectexplorer/toolchaintype.h>
|
||||||
|
|
||||||
|
#include <qt4projectmanager/qt4projectmanagerconstants.h>
|
||||||
|
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
#include <texteditor/basetextmark.h>
|
#include <texteditor/basetextmark.h>
|
||||||
#include <texteditor/fontsettings.h>
|
#include <texteditor/fontsettings.h>
|
||||||
@@ -109,6 +111,9 @@
|
|||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
#include <QtGui/QTextBlock>
|
||||||
|
#include <QtGui/QTextCursor>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
@@ -1044,20 +1049,51 @@ public slots:
|
|||||||
{
|
{
|
||||||
//removeTooltip();
|
//removeTooltip();
|
||||||
resetLocation();
|
resetLocation();
|
||||||
currentEngine()->executeJumpToLine(); // FIXME: move code from engine here.
|
QString fileName;
|
||||||
|
int lineNumber;
|
||||||
|
if (currentTextEditorPosition(&fileName, &lineNumber))
|
||||||
|
currentEngine()->executeJumpToLine(fileName, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleExecRunToLine()
|
void handleExecRunToLine()
|
||||||
{
|
{
|
||||||
//removeTooltip();
|
//removeTooltip();
|
||||||
resetLocation();
|
resetLocation();
|
||||||
currentEngine()->executeRunToLine(); // FIXME: move code from engine here.
|
QString fileName;
|
||||||
|
int lineNumber;
|
||||||
|
if (currentTextEditorPosition(&fileName, &lineNumber))
|
||||||
|
currentEngine()->executeRunToLine(fileName, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleExecRunToFunction()
|
void handleExecRunToFunction()
|
||||||
{
|
{
|
||||||
resetLocation();
|
resetLocation();
|
||||||
currentEngine()->executeRunToFunction(); // FIXME: move code from engine here.
|
ITextEditor *textEditor = currentTextEditor();
|
||||||
|
QTC_ASSERT(textEditor, return);
|
||||||
|
QPlainTextEdit *ed = qobject_cast<QPlainTextEdit*>(textEditor->widget());
|
||||||
|
if (!ed)
|
||||||
|
return;
|
||||||
|
QTextCursor cursor = ed->textCursor();
|
||||||
|
QString functionName = cursor.selectedText();
|
||||||
|
if (functionName.isEmpty()) {
|
||||||
|
const QTextBlock block = cursor.block();
|
||||||
|
const QString line = block.text();
|
||||||
|
foreach (const QString &str, line.trimmed().split('(')) {
|
||||||
|
QString a;
|
||||||
|
for (int i = str.size(); --i >= 0; ) {
|
||||||
|
if (!str.at(i).isLetterOrNumber())
|
||||||
|
break;
|
||||||
|
a = str.at(i) + a;
|
||||||
|
}
|
||||||
|
if (!a.isEmpty()) {
|
||||||
|
functionName = a;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!functionName.isEmpty())
|
||||||
|
currentEngine()->executeRunToFunction(functionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void slotEditBreakpoint()
|
void slotEditBreakpoint()
|
||||||
@@ -3129,6 +3165,37 @@ void DebuggerPlugin::remoteCommand(const QStringList &options, const QStringList
|
|||||||
qWarning("%s", qPrintable(errorMessage));
|
qWarning("%s", qPrintable(errorMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerPlugin::showQtDumperLibraryWarning(const QString &details)
|
||||||
|
{
|
||||||
|
QMessageBox dialog(mainWindow());
|
||||||
|
QPushButton *qtPref = dialog.addButton(tr("Open Qt4 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. "
|
||||||
|
"On the Qt4 options page, select a Qt installation "
|
||||||
|
"and click Rebuild."));
|
||||||
|
if (!details.isEmpty())
|
||||||
|
dialog.setDetailedText(details);
|
||||||
|
dialog.exec();
|
||||||
|
if (dialog.clickedButton() == qtPref) {
|
||||||
|
Core::ICore::instance()->showOptionsDialog(
|
||||||
|
_(Qt4ProjectManager::Constants::QT_SETTINGS_CATEGORY),
|
||||||
|
_(Qt4ProjectManager::Constants::QTVERSION_SETTINGS_PAGE_ID));
|
||||||
|
} else if (dialog.clickedButton() == helperOff) {
|
||||||
|
theDebuggerAction(UseDebuggingHelpers)
|
||||||
|
->setValue(qVariantFromValue(false), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Testing
|
// Testing
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public:
|
|||||||
void setConfigValue(const QString &name, const QVariant &value);
|
void setConfigValue(const QString &name, const QVariant &value);
|
||||||
void updateState(DebuggerEngine *engine);
|
void updateState(DebuggerEngine *engine);
|
||||||
virtual void remoteCommand(const QStringList &options, const QStringList &arguments);
|
virtual void remoteCommand(const QStringList &options, const QStringList &arguments);
|
||||||
|
void showQtDumperLibraryWarning(const QString &details);
|
||||||
|
|
||||||
QIcon locationMarkIcon() const;
|
QIcon locationMarkIcon() const;
|
||||||
void activateDebugMode();
|
void activateDebugMode();
|
||||||
|
|||||||
Reference in New Issue
Block a user